http://stackoverflow.com/q/25555189
has comment: http://stackoverflow.com/comment/39905464
has answer: http://stackoverflow.com/a/25562923
answer count: 5
tagged with: android-listview
tagged with: android
has answer: http://stackoverflow.com/a/25556217
has comment: http://stackoverflow.com/comment/39919827
has body: SOLUTION FOUND (THANKYOU FOR ANSWERS!) IT WAS THE HIGH FILE SIZE OF DRAWABLES (.PNG) I have a listview and many .png images in my /drawables folder. As I load these images in my imageview of the listview item the scrolling of the listview gets laggy public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); ViewHolder holder; if (convertView == null) { convertView = inflater.inflate(R.layout.drawer_list_item, null); holder = new ViewHolder(); holder.title = (TextView) convertView.findViewById(R.id.title); holder.store_image = (ImageView) convertView.findViewById(R.id.store_image); convertView.setTag(holder); } else{ holder = (ViewHolder) convertView.getTag(); } holder.title.setText(stores[position]); switch(position){ case 0: Picasso.with(context).load(R.drawable.first).into(holder.store_image);break; ///... more cases ... default: break; } } return convertView; } I am implementing this in the NavigationDrawer EDIT: I also tried this method of creating and drawable array and then setting the imageview but still its laggy. //in the adapter int[] store_images = new int[]{R.drawable.first,...and so on}; // and then in getView() holder.store_image.setImageResource(store_images[position]);
score: 0
has comment: http://stackoverflow.com/comment/39905479
has comment: http://stackoverflow.com/comment/39905239
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39905502
has comment: http://stackoverflow.com/comment/39906555
has comment: http://stackoverflow.com/comment/39905270
type: Question
has answer: http://stackoverflow.com/a/25562956
has answer: http://stackoverflow.com/a/25562805
has comment: http://stackoverflow.com/comment/39905873
has answer: http://stackoverflow.com/a/25555297
has title: ListView with drawable images is laggy

http://stackoverflow.com/a/27044862
downvote count: 0
upvote count: 1
has body: From spring-security 3.2 docs (also applies for version 4.0.0): On a successful switch, the user's SecurityContext will be updated to reflect the specified user and will also contain an additional SwitchUserGrantedAuthority which contains the original user. Before switching, a check will be made on whether the user is already currently switched, and any current switch will be exited to prevent "nested" switches. So, after you have switched users, when you call: request.getUserPrincipal().getAuthorities() for retrieving the logged user, it will contain the authorities of the current USER and of the previous ADMIN user. The authorities of the previous user will be in a SwitchUserGrantedAuthority instance. What I do in my code is verify if the current user has some SwitchUserGrantedAuthority in its authorities and add a property to that user so the client side I know that I am logged as admin, but have switched users. I used that so I could display a buttom for loging out from that user and going back to admin's page.
accepted answer of: http://stackoverflow.com/q/25591320
type: Answer
answers question: http://stackoverflow.com/q/25591320
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/40088644
comment on: http://stackoverflow.com/q/25653371
score: 0
type: Comment
type: QuestionComment
has text: there r no useful answer i can use in that question how could i call a classloader and not make the same conflict

http://stackoverflow.com/a/25661438
has comment: http://stackoverflow.com/comment/40100415
has comment: http://stackoverflow.com/comment/40100687
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
has body: You should try to clean the project Menu:Project/Clean and make sure that Build Automatically in project menu is checked.
accepted answer of: http://stackoverflow.com/q/25661334
answers question: http://stackoverflow.com/q/25661334
type: Answer

http://stackoverflow.com/q/25661519
has comment: http://stackoverflow.com/comment/40110323
has answer: http://stackoverflow.com/a/25667680
has answer: http://stackoverflow.com/a/60197710
has answer: http://stackoverflow.com/a/49156085
favorite count: 0
type: Question
answer count: 28
has answer: http://stackoverflow.com/a/58074953
has answer: http://stackoverflow.com/a/30905141
has body: I have a question regarding the CountDiv problem in Codility. The problem given is: Write a function: class Solution { public int solution(int A, int B, int K); } that, given three integers A, B and K, returns the number of integers within the range [A..B] that are divisible by K, i.e.: { i : A ≤ i ≤ B, i mod K = 0 } My code: class Solution { public int solution(int A, int B, int K) { int start=0; if (B&lt;A || K==0 || K&gt;B ) return 0; else if (K&lt;A) start = K * ( A/K +1); else if (K&lt;=B) start = K; return (B-start+1)/K+ 1; } } I don't get why I'm wrong, specially with this test case: extreme_ifempty A = 10, B = 10, K in {5,7,20} WRONG ANSWER got 1 expected 0 if K =5 then with i=10 A&lt;=i&lt;=B and i%k =0 so why should I have 0? Problem statement.
has answer: http://stackoverflow.com/a/50926990
tagged with: algorithm
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/55330283
has title: Find the number of multiples for a number in range
has answer: http://stackoverflow.com/a/31788439
has answer: http://stackoverflow.com/a/79359989
tagged with: java
has answer: http://stackoverflow.com/a/25665714
has answer: http://stackoverflow.com/a/25664832
has answer: http://stackoverflow.com/a/25849387
upvote count: 16
has answer: http://stackoverflow.com/a/28187517
has answer: http://stackoverflow.com/a/31638760
has answer: http://stackoverflow.com/a/54373361
has answer: http://stackoverflow.com/a/48337479
has answer: http://stackoverflow.com/a/48554766
has answer: http://stackoverflow.com/a/73397495
has answer: http://stackoverflow.com/a/68647481
has answer: http://stackoverflow.com/a/33193216
has answer: http://stackoverflow.com/a/34665822
has answer: http://stackoverflow.com/a/47309291
has answer: http://stackoverflow.com/a/58548320
has answer: http://stackoverflow.com/a/44291423
has answer: http://stackoverflow.com/a/52730268
has answer: http://stackoverflow.com/a/56770348
downvote count: 0
has comment: http://stackoverflow.com/comment/40100909
score: 16
has answer: http://stackoverflow.com/a/33648759
has answer: http://stackoverflow.com/a/55308694

http://stackoverflow.com/a/25690681
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25690625
has comment: http://stackoverflow.com/comment/40153655
has comment: http://stackoverflow.com/comment/40153608
has body: These lines here: @Override public void focusGained(FocusEvent e) { textField.setText(""); //HERE textField.setForeground(Color.BLACK); } in the focus listener code says that when you click in the textfield then set its text to a empty string.

http://stackoverflow.com/comment/40058801
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25629817
has text: possible duplicate of [Java: Get month Integer from Date](http://stackoverflow.com/questions/7182996/java-get-month-integer-from-date)

http://stackoverflow.com/a/25637701
has comment: http://stackoverflow.com/comment/40060187
has comment: http://stackoverflow.com/comment/40063225
has comment: http://stackoverflow.com/comment/40062441
type: Answer
answers question: http://stackoverflow.com/q/25637417
score: 0
has comment: http://stackoverflow.com/comment/40063502
has comment: http://stackoverflow.com/comment/40063761
has comment: http://stackoverflow.com/comment/40059055
has body: Guess the json format is wrong.. And No Need to transfer to JSONArray JSONArray jsonArray = (JSONArray)JSONSerializer.toJSON(gridModels); String json = "{'page':1,'total':'2','records':'1','rows':"+jsonArray+"}"; JSONObject jsonObject = (JSONObject)JSONSerializer.toJSON(json); PrintWriter out = response.getWriter(); out.print(jsonObject.toString()); change to JSONObject jsonobj = new JSONObject(); jsonobj.put("total", totalPages); jsonobj.put("page", page); jsonobj.put("records", records); jsonobj.put("rows", gridModels ); out.println(jsonobj); hope it helps

http://stackoverflow.com/q/25643435
answer count: 2
score: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40067359
downvote count: 1
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25643707
has title: How to run tests with maven twice?
has answer: http://stackoverflow.com/a/25643707
tagged with: maven
has comment: http://stackoverflow.com/comment/40067508
linked to: http://stackoverflow.com/q/3257080
accepted answer: http://stackoverflow.com/a/25643646
has body: I want to run maven tests twice, the second run must be straight after the first one. Is there any command to fire mvn tests twice?
has comment: http://stackoverflow.com/comment/40067376
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25643646

http://stackoverflow.com/a/25626697
has body: To apply elasticsearch mapping using java api, STEP 1) First create your mapping for the Elasticsearch type in a json file, eg. resources/Customer.json { "Customer" : { "settings" : { }, "properties" : { "category" : { "type":"String" , "index" : "not_analyzed"} } } } } } STEP 2) create a java method to apply mapping from a json file, (see complete example here) class EsUtils { public static Client client public static void applyMapping(String index, String type, String location) throws Exception { String source = readJsonDefn(location); if (source != null) { PutMappingRequestBuilder pmrb = client.admin().indices() .preparePutMapping(index) .setType(type); pmrb.setSource(source); MappingListener mappingListener = new MappingListener(pmrb) // Create type and mapping Thread thread = new Thread(mappingListener) thread.start(); while (!mappingListener.processComplete.get()) { System.out.println("not complete yet. Waiting for 100 ms") Thread.sleep(100); } } else { System.out.println("mapping error"); } } public static String readJsonDefn(String url) throws Exception { //implement it the way you like StringBuffer bufferJSON = new StringBuffer(); FileInputStream input = new FileInputStream(new File(url).absolutePath); DataInputStream inputStream = new DataInputStream(input); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); String line; while ((line = br.readLine()) != null) { bufferJSON.append(line); } br.close(); return bufferJSON.toString(); } } STEP 3) call applyMapping() method passing your es client, String index = "search"; //yourIndex String type = "Customer"; String location = "resources/Customer.json"; EsUtils.client = yourClient; //pass your client EsUtils.applyMapping(index, type, location); STEP 4) query as you want, SearchRequestBuilder builder = client.prepareSearch("search"); builder.addAggregation(AggregationBuilders.terms("categoryterms") .field("category").size(0)) SearchResponse response = builder.execute().actionGet(); Complet…
answers question: http://stackoverflow.com/q/25620471
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25620471
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25656040
tagged with: java
has comment: http://stackoverflow.com/comment/40091288
tagged with: regex
accepted answer: http://stackoverflow.com/a/25656055
has answer: http://stackoverflow.com/a/25656055
possible better answer: http://stackoverflow.com/a/25656060
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40091078
answer count: 2
has body: I have a String to match with regex String str = "(1a/2s-/-)" The conditions I need to get: There has to be a parentheses only alphanumeric dash and slash could be inside parentheses and it repeats regex I have tried so far ([A-Za-z0-9]/[A-Za-z0-9]+) Does anyone could help me solve this?
type: Question
has title: regex match hyphen slash alphanumeric in parentheses
has answer: http://stackoverflow.com/a/25656060

http://stackoverflow.com/a/25678790
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25673713
downvote count: 0
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25673713
has body: If you have the two images already made, use a Button element in your GridView and set the Background element of your button to a state selector drawable. refer to this link for XML declarations on making your selector drawable example here . For your scenario you will have to create different selector XML files for each button.

http://stackoverflow.com/comment/40109436
has text: The example is so good, I'd almost just needed copy and paste, but when I right clicked the class and run as junit test. I received: message there (see my edition after your code)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25645897
score: 0

http://stackoverflow.com/comment/40133709
comment on: http://stackoverflow.com/a/25679703
type: AnswerComment
score: 0
type: Comment
has text: I'm sorry, but that is not true. Resteasy knows to look for annotated resources in a couple of ways - either through the resteasy.scan property or by listing out your resources directly in your web.xml.

http://stackoverflow.com/comment/40007355
comment on: http://stackoverflow.com/a/25610026
score: 0
type: Comment
has text: So how would that help me? Doesn't that force the loop to skip the previous slots for z?
type: AnswerComment

http://stackoverflow.com/q/25552433
has body: I am trying to create a login feature for my apache tapestry website, where after logging in, instead of the 'Log In' and 'Register' button, the email of the logged user should be displayed, along with a 'Log Out' button. Could anyone please tell how should this be implemented the best way? I can't seem to figure out how should i detect if the user is logged in, in the frontend part, in order to display a different menu options (i am new in tapestry). Best regards, Marius.
has answer: http://stackoverflow.com/a/25555179
score: 0
answer count: 2
has title: Apache Tapestry user logged in feature
tagged with: user-management
tagged with: java
tagged with: apache
tagged with: authentication
tagged with: tapestry
type: Question
has answer: http://stackoverflow.com/a/25568132
type: UnansweredQuestion

http://stackoverflow.com/q/25554592
answer count: 1
tagged with: android-activity
has answer: http://stackoverflow.com/a/25554721
tagged with: http://stackoverflow.com/tag/xml
type: Question
tagged with: android-button
has body: I have created fragments(6 fragment) in my app.In my first fragment(android_frag) there is a button "Show Places on Map". When I click on that button new activity names "ShowPlaces" opens up. In the show_places xml file I have created one button that should return me to the previous screen i.e the android fragment but button is not showing up in when the ShowPlaces activity opnes up, though I can see the button in graphical layout of the xml file. I have not been able to find out where the problem is.Please help. Here is my show_places.xml file &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:gravity="center" android:orientation="vertical" &gt; &lt;!-- Show on Map button --&gt; &lt;Button android:id="@+id/btn_show_map1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5dip" android:text="@string/showplaces" /&gt; &lt;/LinearLayout&gt; Here is the ShowPlaces.java file package com.example.tabswipe; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.app.Activity; import android.view.Menu; public class ShowPlaces extends Activity implements OnClickListener { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View ios = inflater.inflate(R.layout.show_places, container, false); Button button = (Button) ios.findViewById(R.id.btn_show_map); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // here you set what you want to do when user clicks your button, // e.g. launch a new activity Intent openStartingPoint = new Intent("com.example.tabswipe.Android"); startActivity(openStart…
type: UnansweredQuestion
has title: Button not showing up on Activity that opens from Fragment,but button shows up in Graphical Layout
score: 0
tagged with: android-fragments
tagged with: java

http://stackoverflow.com/a/25563264
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
has body: Don't use eval. If you're inserting a JSON string into JavaScript, just insert it. var json = ${mappings}; No escaping needed, the string is already valid JavaScript. (And if you do ever need to parse JSON, please use JSON.parse() and not eval(). It slows down your code significantly.)
accepted answer of: http://stackoverflow.com/q/25563201
answers question: http://stackoverflow.com/q/25563201
downvote count: 0

http://stackoverflow.com/q/25663007
has body: If I want to convert a int to string and my code is database.setMinConnectionsPerPartition (dbPoolElement.getAttribute("ConPoolminConnections")); Am I right in using (String.valueOf to convert it from int to string?
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/25663112
tagged with: string
has title: Conversion of an Int to String value
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40103397
has answer: http://stackoverflow.com/a/25663594
has comment: http://stackoverflow.com/comment/40103554
tagged with: int
has comment: http://stackoverflow.com/comment/40103447
answer count: 2

http://stackoverflow.com/a/25627116
has body: I think the intent of option two is much clearer than that of option one. It took me a few seconds to work out what was happening with the first one, it doesn't look "right" - although it seems valid. Option two was more obvious to me. Essentially, the intent of what you are doing is a flatmap. If that's the case I'd expect to see flatmap used rather than using addAll().
type: Answer
score: 4
answers question: http://stackoverflow.com/q/25626348
upvote count: 4
downvote count: 0

jcr
tags question: http://stackoverflow.com/q/25638099
tag name: jcr
type: Tag
tags question: http://stackoverflow.com/q/25690708

http://stackoverflow.com/a/25703659
has body: The problem is not when running java. Even bash is not being executed. I don't think so that you need to run java from bash at all. ProcessBuilder pb = new ProcessBuilder("java", "-jar", "spigot.jar", "-Xmx2048M", "-Xms2G, "-XX:MaxPermSize=128M", "nogui"); What is happening is that java is trying to run executable named "bash java -jar -Xmx2048M -Xms2G -XX:MaxPermSize=128M spigot.jar nogui" instad of "bash" with parameters. See: http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html
answers question: http://stackoverflow.com/q/25703593
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25703593
score: 1
type: Answer

http://stackoverflow.com/q/25577852
has comment: http://stackoverflow.com/comment/39982286
has answer: http://stackoverflow.com/a/25597288
has body: I am building an application where audio data is uploaded to my GAE server, processed, and displayed as a response to an HTTP GET request. Part of the data I wish to display is in the format of a graph. What I am having a hard time understanding is how to create my response in such a way that I can include graphs. From what I understand, one approach might be to create the graph using this API: http://googleappsdeveloper.blogspot.ca/2011/09/visualize-your-data-charts-in-google.html And then store it as a blob in my datastore. I can then create a JSP to serve the blob as an image? Not sure if I am understanding this correctly. Specifically, I'm not sure about being able to access all of this functionality from GAE, and if I'm doing this in a convoluted way. I am quite new to GAE and web programming in general, so I greatly appreciate feedback and suggestions on how to do this in the simplest/quickest way. I wouldn't mind links to relevant resources as well.
tagged with: get
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39979634
has title: How to include graphs and tables in Google App Engine HTTP Response
tagged with: java
answer count: 1
tagged with: http
accepted answer: http://stackoverflow.com/a/25597288
type: Question
tagged with: google-app-engine

http://stackoverflow.com/a/25606398
type: Answer
answers question: http://stackoverflow.com/q/25605898
has comment: http://stackoverflow.com/comment/40001710
has body: Try this custom TouchImageView: public class TouchImageView extends ImageView { Matrix matrix; // We can be in one of these 3 states static final int NONE = 0; static final int DRAG = 1; static final int ZOOM = 2; int mode = NONE; // Remember some things for zooming PointF last = new PointF(); PointF start = new PointF(); float minScale = 1f; float maxScale = 3f; float[] m; int viewWidth, viewHeight; static final int CLICK = 3; float saveScale = 1f; protected float origWidth, origHeight; int oldMeasuredWidth, oldMeasuredHeight; ScaleGestureDetector mScaleDetector; Context context; public TouchImageView(Context context) { super(context); sharedConstructing(context); } public TouchImageView(Context context, AttributeSet attrs) { super(context, attrs); sharedConstructing(context); } /* */ private void stopInterceptEvent() { getParent().requestDisallowInterceptTouchEvent(true); } private void startInterceptEvent() { getParent().requestDisallowInterceptTouchEvent(false); } private void sharedConstructing(Context context) { super.setClickable(true); this.context = context; mScaleDetector = new ScaleGestureDetector(context, new ScaleListener()); matrix = new Matrix(); m = new float[9]; setImageMatrix(matrix); setScaleType(ScaleType.MATRIX); setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { mScaleDetector.onTouchEvent(event); PointF curr = new PointF(event.getX(), event.getY()); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: last.set(curr); start.set(last); mode = DRAG; stopInterceptEvent(); break; case MotionEvent.ACTION_MOVE: if (mode == DRAG) { float deltaX = curr.x - last.x; float deltaY = curr.y - last.y; float fixTransX = getFixDragTrans(deltaX, viewWidth, origWidth * saveScale); float fixTransY = getFixDragTrans(deltaY, viewHeight, origHeight * saveScale); matrix.postTranslate(fixTransX, fixTransY); fixTrans(); last.set(curr.x, curr.y); float transX = m[Matrix.MTRANS_X]; if((int) (getFixTrans(transX, …
score: 0

http://stackoverflow.com/q/25626301
has answer: http://stackoverflow.com/a/25631722
has answer: http://stackoverflow.com/a/25643115
accepted answer: http://stackoverflow.com/a/25643115
has title: javamail does not send message content
has body: I'm trying to send an email from a webapp using javamail and the email is sent without the body and attachment. I have tried debuging it and I can't see what is wrong. I'm using tomee+ 1.7 and javamail 1.4.7. Here is my code: // Msg body session.setDebug(true); BodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setText("Attached are your query results"); messageBodyPart.addHeader("Content-Type", "text/html; charset=windows-1255"); messageBodyPart.addHeader("Content-Transfer-Encoding", "base64"); // attachment LOG.info("Building attachment from file " + file.getName()); MimeBodyPart attachmentPart = new MimeBodyPart(); attachmentPart.attachFile(file); attachmentPart.setFileName(file.getName()); Multipart multipart = new MimeMultipart(); multipart.addBodyPart(messageBodyPart); multipart.addBodyPart(attachmentPart); // Send message Message message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject("Query report..."); message.setContent(multipart); Transport.send(message); LOG.info("Sent message successfully ..."); The message I am getting: From: x@x.x To: x@x.x Message-ID: &lt;371010179.1.1409738093141.JavaMail.root@claimqa01&gt; Subject: Query report... MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_0_1099874708.1409738093124"
has comment: http://stackoverflow.com/comment/40037581
has comment: http://stackoverflow.com/comment/40063297
type: AnsweredQuestion
tagged with: jakarta-mail
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/36306728
has comment: http://stackoverflow.com/comment/40037825
has answer: http://stackoverflow.com/a/25627668
answer count: 4
type: Question
has answer: http://stackoverflow.com/a/36306728

http://stackoverflow.com/q/25699499
tagged with: algorithm
tagged with: arrays
has comment: http://stackoverflow.com/comment/40170311
has answer: http://stackoverflow.com/a/25709058
possible better answer: http://stackoverflow.com/a/25709058
type: AnsweredQuestion
has title: Shift an ordered Array
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25708920
accepted answer: http://stackoverflow.com/a/25708920
has answer: http://stackoverflow.com/a/25705561
tagged with: java
has comment: http://stackoverflow.com/comment/40170075
has body: I am trying insert a number in an ordered array. In order to accomplish this i search for the last number that is less or equal to the searched number. From there i want to move that part of the array to the right. int lowerBound = 0; int upperBound = nElems.length-1; int curIn = 0; boolean check = true; while(check) { curIn = (lowerBound + upperBound ) / 2; if(nElems[curIn] == replaceKey) { for(int i = nElems.length - 2; i &gt;= curIn - 1; i--) { nElems[i + 1] = nElems[i]; } nElems[curIn] = replaceKey; check = false;// found it } else if (lowerBound &gt; upperBound) { for(int i = nElems.length - 2; i &gt;= curIn - 1; i--) { nElems[i + 1] = nElems[i]; } nElems[curIn] = replaceKey; check = false;// found it //return nElems; // can’t find it } else // divide range { if (curIn &lt; replaceKey) { lowerBound = curIn + 1; // it’s in upper half } else { upperBound = curIn - 1; // it’s in lower half } } // end else divide range } // end while The problem is when i try for example to insert the number 7 the outcome is this: Before: 1 3 6 10 15 21 28 0 After: 1 3 6 10 15 21 7 28 Can someone help me?
type: Question
has comment: http://stackoverflow.com/comment/40170098

http://stackoverflow.com/a/25707381
has body: Your logic is backwards. You want the loop to continue if the input is incorrect. There are two ways to fix this: Change while(checker) to while(!checker) Change checker=false to checker=true after printing the error message. And set checker=false in the if branch. It might help if you change the name of your checker variable to something that reads more directly. For example isInputCorrect reads very nicely when you write while(!isInputCorrect) and it also makes it more clear what the values of true and false represent.
has comment: http://stackoverflow.com/comment/40184590
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25707347
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25707347
score: 1
has comment: http://stackoverflow.com/comment/40184748
type: Answer

http://stackoverflow.com/a/25610114
type: Answer
has body: Probably you are not oppenig the file, check the status of fileReader variable. and if is null, you have to check the path of your file
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25610084
score: 0
accepted answer of: http://stackoverflow.com/q/25610084

http://stackoverflow.com/a/25697468
has comment: http://stackoverflow.com/comment/40166412
has comment: http://stackoverflow.com/comment/40176853
has comment: http://stackoverflow.com/comment/40166565
has comment: http://stackoverflow.com/comment/40166624
answers question: http://stackoverflow.com/q/25697362
downvote count: 0
upvote count: 1
has body: Change this from listView = (ListView) getActivity().findViewById(R.id.list); to listView = (ListView)v.findViewById(R.id.list); This is because getActivity() is generally used for as a Context in Fragment. While you'r find id for your UI elements in Fragment then you have to give reference of your View's object which will be returned in onCreateView() method. Update: Change your Adapter Like, listAdapter = new FeedListAdapter(getActivity(),feedItems); Now in its Constructor ImageLoader imageLoader; public FeedListAdapter(Context ctx,List&lt;FeedItem&gt; feedItems) { this.context= ctx; this.feedItems = feedItems; imageLoader = AppController.getInstance().getImageLoader() } Now in your adapter class use context variable as a Context.
has comment: http://stackoverflow.com/comment/40166549
score: 1
type: Answer

http://stackoverflow.com/comment/39960790
comment on: http://stackoverflow.com/a/25566673
type: AnswerComment
score: 0
has text: Can you please update your answer so I mark it correct? I have done a number of things.Updated intellij 13.0 to 13.1, Started from scratch, put my application.groovy in another package. and it worked
type: Comment

http://stackoverflow.com/comment/40037154
type: Comment
type: QuestionComment
has text: user1676075 I have tried that, same problem.
score: 0
comment on: http://stackoverflow.com/q/25625569

http://stackoverflow.com/a/25669300
score: 81
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40132991
has body: localhost-startStop-1 is trying to create a new instance of SecureRandom and it's stuck trying to read data from an entropy source. This typically occurs because the source has been depleted. The default entropy source is /dev/random. It's known as a blocking source as it will block when an attempt is made to read random data and none is available. Another source on Linux is /dev/urandom. Its main benefit over /dev/random is that it's non-blocking. There's some debate over whether or not using /dev/urandom will make things less secure. This article may be of interest. In summary, using /dev/urandom will avoid the problem you're seeing, at the possible cost of decreased security. You can configure Spring Boot's embedded Tomcat instance to use /dev/urandom via a system property: -Djava.security.egd=file:/dev/./urandom
accepted answer of: http://stackoverflow.com/q/25660899
upvote count: 81
has comment: http://stackoverflow.com/comment/40414637
answers question: http://stackoverflow.com/q/25660899
type: Answer

http://stackoverflow.com/a/32175461
downvote count: 0
upvote count: 1
has body: Try to create a XML Document and unmarshal it. It was worked for me. JAXBContext jc = JAXBContext.newInstance( Message.class ); InputStream stream = new ByteArrayInputStream( string.getBytes( StandardCharsets.UTF_8 ) ); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse( stream ); Unmarshaller unmarshaller = jc.createUnmarshaller(); Message msg = ( Message ) unmarshaller.unmarshal( doc );
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25644023
has comment: http://stackoverflow.com/comment/54665153

http://stackoverflow.com/comment/39985802
type: Comment
has text: What does the error field Component.Name is not visible mean? I dont see any name variable?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25598308

http://stackoverflow.com/q/25707902
tagged with: javacv
type: UnansweredQuestion
has title: android : how to load haarcascade inside the raw folder in javacv?
has comment: http://stackoverflow.com/comment/40185304
has comment: http://stackoverflow.com/comment/40186073
has comment: http://stackoverflow.com/comment/40185343
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40185085
has body: I am new in Javacv and android and i totally don't know what to do with this error. I am trying to load the haarcascade file but unfortunately the app always crashes. Here's my code for mainactivity.java package com.example.cameraapp; import java.io.File; import android.app.Activity; import android.content.ContentResolver; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends ActionBarActivity { private static String logtag = "CAMERA APP"; private Uri imageUri; private static int TAKE_PICTURE=1; String s ; Bitmap bitmap; ImageView k ; private static final int MAX_FACES = 5; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button c = (Button)findViewById(R.id.button_camera); c.setOnClickListener(cameraListener); } private OnClickListener cameraListener = new OnClickListener(){ public void onClick(View v){takePhoto(v);} }; private void takePhoto(View v){ Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); File image = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "picture.jpg"); imageUri = Uri.fromFile(image); s = image.getAbsolutePath(); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); startActivityForResult(intent, TAKE_PICTURE); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent){ super.onActivityResult(requestCode, resultCode, intent); if(resultCode==Activity.RESULT_OK){ Uri selectedImage = imageUri; getConten…
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40185294
answer count: 0

http://stackoverflow.com/comment/40141514
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25682040
type: AnswerComment
has text: I saw it. Cant I use AbstractMultipartConfig and StrutsMultipartConfig and configure it in the applicationContext.xml? As we are in critical time in releasing our web application, it would be immensely helpful if you can give any other way around to fix this.

http://stackoverflow.com/a/25602244
has body: I would focus on this line: Caused by: javax.naming.NameNotFoundException: Name [${jdbc.pivotDB.jndi.name}] is not bound in this Context. Unable to find [${jdbc.pivotDB.jndi.name}]. Probably you are missing JNDI name definition in the server.xml or somewhere else ...
answers question: http://stackoverflow.com/q/25601393
type: Answer
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/39961400
comment on: http://stackoverflow.com/q/25564799
has text: More details! Also "I have already included groovy-all.jar in classpath" : why? It should be packaged with Mule.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40043422
type: QuestionComment
has text: Ok, how would I go about adding specific filterMap["displayName"] values? Like filterMap["displayName"][1];?
type: Comment
comment on: http://stackoverflow.com/q/25629105
score: 0

http://stackoverflow.com/a/25643824
upvote count: 1
answers question: http://stackoverflow.com/q/25643070
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40068454
has body: Signals that an error occurred while attempting to bind a socket to a local address and port. Typically, the port is in use, or the requested local address could not be assigned. When you start a web server or application server, which typically listen on a port e.g. Tomcat or Jetty listens on 8080 and 8084 for HTTP and HTTPS traffic, they bind a socket to a local address and port. If you give them hostname e.g. localhost or devhost, then they used /etc/host in both Windows and Linux to resolve domain name into IP address, if this mapping is incorrect than you will get java.net.BindException: Cannot assign requested address: JVM_Bind. This host to IP address mapping file can be found at C:\Windows\System32\Drivers\etc\hosts, where C:\Windows is where you have installed windows operating system. If you look at this file, you will see it contains IP address and hostname as shown below : 127.0.0.1 localhost 192.168.52.1 localhost Just, correct the mapping, or add 127.0.0.1 against localhost to resolve this issue
type: Answer

http://stackoverflow.com/q/25597088
has comment: http://stackoverflow.com/comment/39983499
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3059383
duplicate of: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/25597103
score: -1
tagged with: text
has comment: http://stackoverflow.com/comment/39983515
has title: Reading text file into Java array
has body: So I'm trying to take a series of "scores" from a text file to put into an array and then sort in order, rows of four, and write other methods to get the highest, lowest, average, etc. The println commands are in there but I haven't written the methods yet. I've been working all day and I'm starting to confuse myself, and now I'm getting a NullPointerException error in the main method. Any help? package arrayops1d; import java.io.*; import java.util.*; public class ArrayOps1D { static int scores[]; public static void main(String[] args) throws Exception{ FileReader file = new FileReader("C:/Users/Steve/Documents/" + "NetBeansProjects/ArrayOps1D/Scores.txt"); BufferedReader reader = new BufferedReader(file); String scores = ""; String line = reader.readLine(); while (line != null){ scores += line; line = reader.readLine(); } System.out.println(scores); System.out.println(getTotal()); System.out.println(getAverage()); System.out.println(getHighest()); System.out.println(getLowest()); System.out.println(getMedian()); System.out.println(getPosition()); System.out.println(getDeviations); System.out.println(getStdDev); }
has comment: http://stackoverflow.com/comment/39983521
has comment: http://stackoverflow.com/comment/39983580
linked to: http://stackoverflow.com/q/5585779
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/39983429
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/218384
linked to: http://stackoverflow.com/q/3481828
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/25597197
tagged with: arrays

http://stackoverflow.com/comment/39980173
has text: @ANtonSavin Ah, thank you, I was just following the steps of a program I mad a few weeks ago, which needed that -1 and I completely forgot about it!
type: Comment
comment on: http://stackoverflow.com/q/25595250
score: 1
type: QuestionComment

http://stackoverflow.com/q/25681520
has title: Spring as Broker Relay by using an external Message Broker
type: Question
upvote count: 9
score: 9
answer count: 1
downvote count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: rabbitmq
tagged with: message-queue
tagged with: spring-jms
tagged with: java
favorite count: 0
has answer: http://stackoverflow.com/a/25814794
has body: I would like to use Spring Messaging to create a real time notification system for logged users for my webapp. I defined a AbstractWebSocketMessageBrokerConfigurer as follows: @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/notifications").withSockJS() .setSessionCookieNeeded(true) .setWebSocketEnabled(true); } @Override public void configureMessageBroker(MessageBrokerRegistry registry) { registry.enableSimpleBroker("/topic/", "/queue/"); } And, according to the documentation: An application can send messages targeting a specific user. Spring’s STOMP support recognizes destinations prefixed with "/user/". For example, a client might subscribe to the destination "/user/queue/position-updates". This destination will be handled by the UserDestinationMessageHandler and transformed into a destination unique to the user session, e.g. "/queue/position-updates-user123". This provides the convenience of subscribing to a generically named destination while at the same time ensuring no collisions with other users subscribing to the same destination so that each user can receive unique stock position updates. On the sending side messages can be sent to a destination such as "/user/{username}/queue/position-updates", which in turn will be translated by the UserDestinationMessageHandler into one or more destinations, one for each session associated with the user. This allows any component within the application to send messages targeting a specific user without necessarily knowing anything more than their name and the generic destination. This is also supported through an annotation as well as a messaging template. By sending a message to /user/{username}/queue/something, it will be delivered only to the specific user identified by {username}. Now, I'm looking for a solution that allows me to use an external Message Broker (for instance, RabbitMQ), with Spring just as Broker Relay: registry.enableStompBrokerRelay("/topic/", "/…

http://stackoverflow.com/q/25586222
has answer: http://stackoverflow.com/a/25586283
has title: Android Development using Head First
type: Question
tagged with: android
tagged with: java
tagged with: eclipse
type: AnsweredQuestion
score: 0
has body: I am making an android app to check whether the string entered by user is palindrome or not.I am using charAt function to extract every character from string.But it shows the error that 'the method char(int) is undefined for the type View.OnClickListener() {}'. I have written the code as:- b.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub String str=input.getText().toString(); String st=""; int i=1,l=str.length(); while(i&gt;l) { st=st+charAt(i); i--; } if(st.equalsIgnoreCase(str)==true) disp.setText("Your string is Palindrome"); else disp.setText("Your string is Not Palindrome"); } }); Plz. help me out with this charAt function....
accepted answer: http://stackoverflow.com/a/25586283
answer count: 1

gson
tag name: gson
tags question: http://stackoverflow.com/q/25588719
tags question: http://stackoverflow.com/q/25590303
tags question: http://stackoverflow.com/q/25582968
tags question: http://stackoverflow.com/q/25640439
tags question: http://stackoverflow.com/q/25615936
tags question: http://stackoverflow.com/q/25707728
tags question: http://stackoverflow.com/q/25551283
tags question: http://stackoverflow.com/q/25693828
tags question: http://stackoverflow.com/q/25655404
tags question: http://stackoverflow.com/q/25599577
tags question: http://stackoverflow.com/q/25595931
tags question: http://stackoverflow.com/q/25652740
tags question: http://stackoverflow.com/q/25653017
tags question: http://stackoverflow.com/q/25592170
tags question: http://stackoverflow.com/q/25556908
tags question: http://stackoverflow.com/q/25663840
type: Tag
tags question: http://stackoverflow.com/q/25705112

http://stackoverflow.com/comment/40151979
comment on: http://stackoverflow.com/q/25689983
score: 0
has text: I think date comparisons normalise to UTC time anyway, so you shouldn't have anything to worry about
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40183472
type: Comment
has text: i did what you suggested but this times my results were 106 0 0 0 0 and 106 was the total....is there anyway you could directly look at my code and textfile?@jackarms
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25706776

http://stackoverflow.com/comment/40108122
type: Comment
has text: This should be the right and clean way to do this if you want to avoid iterating over your list each time you want to get an element.
type: AnswerComment
comment on: http://stackoverflow.com/a/25665912
score: 0

http://stackoverflow.com/comment/40185731
type: Comment
has text: Also, I suggest breaking this method into several smaller ones. For example, you could have one method that inputs the array of numbers and another method that checks if a given number is prime.
score: 0
comment on: http://stackoverflow.com/q/25708222
type: QuestionComment

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/25712243
tags question: http://stackoverflow.com/q/25650857
tags question: http://stackoverflow.com/q/25684564
tags question: http://stackoverflow.com/q/25673071
tags question: http://stackoverflow.com/q/25619916
tags question: http://stackoverflow.com/q/25612214
tag name: jfreechart
tags question: http://stackoverflow.com/q/25599463

http://stackoverflow.com/q/25634820
downvote count: 0
has comment: http://stackoverflow.com/comment/40052637
score: 2
tagged with: android
tagged with: java
has body: I get this on Logcat when I try to test my app on the emulator but it runs perfectly on desktop mode. I am using Eclipse, Android SDK, and LIBGDX. I don't know why it doesn't want to run. This is the Logcat information I get when the emulator doesn't run the app. 09-03 01:09:24.940: D/dalvikvm(762): Not late-enabling CheckJNI (already on) 09-03 01:09:28.020: D/dalvikvm(762): Trying to load lib /data/app-lib/com.kovach.flappytimberman.android-1/libgdx.so 0xb1d30748 09-03 01:09:28.060: D/dalvikvm(762): Added shared lib /data/app- lib/com.kovach.flappytimberman.android-1/libgdx.so 0xb1d30748 09-03 01:09:28.060: D/dalvikvm(762): No JNI_OnLoad found in /data/app-lib/com.kovach.flappytimberman.android-1/libgdx.so 0xb1d30748, skipping init 09-03 01:09:28.170: D/(762): HostConnection::get() New Host Connection established 0xb7741878, tid 762 09-03 01:09:28.860: I/AndroidInput(762): sensor listener setup 09-03 01:09:29.130: W/EGL_emulation(762): eglSurfaceAttrib not implemented 09-03 01:09:29.180: D/OpenGLRenderer(762): Enabling debug mode 0 09-03 01:09:29.290: D/(762): HostConnection::get() New Host Connection established 0xb782e448, tid 776 09-03 01:09:29.320: W/GL2JNIView(762): creating OpenGL ES 2.0 context 09-03 01:09:29.410: D/dalvikvm(762): Trying to load lib /data/app-lib/com.kovach.flappytimberman.android-1/libgdx.so 0xb1d30748 09-03 01:09:29.420: D/dalvikvm(762): Shared lib '/data/app-lib/com.kovach.flappytimberman.android-1/libgdx.so' already loaded in same CL 0xb1d30748 09-03 01:09:29.420: I/GL2(762): all initialized 2 09-03 01:09:29.420: I/AndroidGraphics(762): OGL renderer: Android Emulator OpenGL ES Translator (GeForce GT 740M/PCIe/SSE2) 09-03 01:09:29.420: I/AndroidGraphics(762): OGL vendor: Google (NVIDIA Corporation) 09-03 01:09:29.420: I/AndroidGraphics(762): OGL version: OpenGL ES 2.0 (4.4.0) 09-03 01:09:29.420: I/AndroidGraphics(762): OGL extensions: GL_EXT_debug_marker GL_OES_EGL_image GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_textu…
favorite count: 0
has title: Error when running android emulator
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/40052664
upvote count: 2
type: UnansweredQuestion

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

http://stackoverflow.com/a/25704176
type: Answer
has comment: http://stackoverflow.com/comment/40179207
has body: With Java 8 there is elegant solution based on closure: package com.java.se.stackoverflow; import java.util.Arrays; public class ArrayCast { public static void main(String[] argv) throws Exception { int[] inputArray = new int[]{23, 4, 5, 6, 89}; double[] outputArray = new double[inputArray.length]; Arrays.setAll(outputArray, inputArrayIndex -&gt; (double) inputArray[inputArrayIndex]); System.out.println(Arrays.toString(outputArray)); } }
has comment: http://stackoverflow.com/comment/40179477
has comment: http://stackoverflow.com/comment/40178490
score: 1
has comment: http://stackoverflow.com/comment/40178618
downvote count: 1
has comment: http://stackoverflow.com/comment/40178514
upvote count: 2
answers question: http://stackoverflow.com/q/25704077
has comment: http://stackoverflow.com/comment/40178457

http://stackoverflow.com/comment/40170266
type: AnswerComment
comment on: http://stackoverflow.com/a/25698934
has text: @AndrewThompson: My bad, I wanted to remove, all, I did saw that too, thought I removed that also :-) Thankyou for pointing out :-)
type: Comment
score: 0

jsp
tags question: http://stackoverflow.com/q/25690566
tags question: http://stackoverflow.com/q/25577656
tags question: http://stackoverflow.com/q/25702939
tags question: http://stackoverflow.com/q/25641043
tags question: http://stackoverflow.com/q/25632639
tags question: http://stackoverflow.com/q/25682302
tags question: http://stackoverflow.com/q/25693448
tags question: http://stackoverflow.com/q/25686704
tags question: http://stackoverflow.com/q/25690410
tags question: http://stackoverflow.com/q/25711040
tags question: http://stackoverflow.com/q/25652855
tags question: http://stackoverflow.com/q/25628601
tags question: http://stackoverflow.com/q/25601315
tags question: http://stackoverflow.com/q/25660400
tags question: http://stackoverflow.com/q/25609856
tags question: http://stackoverflow.com/q/25611753
tags question: http://stackoverflow.com/q/25616907
tags question: http://stackoverflow.com/q/25647545
tags question: http://stackoverflow.com/q/25706770
tags question: http://stackoverflow.com/q/25575166
tags question: http://stackoverflow.com/q/25685383
tags question: http://stackoverflow.com/q/25591194
tag name: jsp
tags question: http://stackoverflow.com/q/25650568
tags question: http://stackoverflow.com/q/25580207
tags question: http://stackoverflow.com/q/25677974
tags question: http://stackoverflow.com/q/25622153
tags question: http://stackoverflow.com/q/25711726
tags question: http://stackoverflow.com/q/25648492
tags question: http://stackoverflow.com/q/25685669
tags question: http://stackoverflow.com/q/25552450
tags question: http://stackoverflow.com/q/25580564
tags question: http://stackoverflow.com/q/25681442
tags question: http://stackoverflow.com/q/25706370
tags question: http://stackoverflow.com/q/25635537
tags question: http://stackoverflow.com/q/25564633
tags question: http://stackoverflow.com/q/25568711
tags question: http://stackoverflow.com/q/25646122
tags question: http://stackoverflow.com/q/25554021
tags question: http://stackoverflow.com/q/25620859
tags question: http://stackoverflow.com/q/25691102
tags question: http://stackoverflow.com/q/25635696
tags question: http://stackoverflow.com/q/25642035
tags question: http://stackoverflow.com/q/25638917
tags question: http://stackoverflow.com/q/25617519
tags question: http://stackoverflow.com/q/25562384
tags question: http://stackoverflow.com/q/25573977
tags question: http://stackoverflow.com/q/25691464
tags question: http://stackoverflow.com/q/25622625
tags question: http://stackoverflow.com/q/25604470
tags question: http://stackoverflow.com/q/25680401
tags question: http://stackoverflow.com/q/25673433
tags question: http://stackoverflow.com/q/25644120
tags question: http://stackoverflow.com/q/25699590
tags question: http://stackoverflow.com/q/25588917
tags question: http://stackoverflow.com/q/25703534
tags question: http://stackoverflow.com/q/25571343
tags question: http://stackoverflow.com/q/25603028
tags question: http://stackoverflow.com/q/25562017
tags question: http://stackoverflow.com/q/25581842
tags question: http://stackoverflow.com/q/25658554
tags question: http://stackoverflow.com/q/25637433
tags question: http://stackoverflow.com/q/25602590
tags question: http://stackoverflow.com/q/25638322
tags question: http://stackoverflow.com/q/25701303
tags question: http://stackoverflow.com/q/25617907
tags question: http://stackoverflow.com/q/25554723
tags question: http://stackoverflow.com/q/25695676
tags question: http://stackoverflow.com/q/25551141
tags question: http://stackoverflow.com/q/25626755
tags question: http://stackoverflow.com/q/25632779
tags question: http://stackoverflow.com/q/25630913
tags question: http://stackoverflow.com/q/25634710
tags question: http://stackoverflow.com/q/25638151
tags question: http://stackoverflow.com/q/25638500
tags question: http://stackoverflow.com/q/25560742
tags question: http://stackoverflow.com/q/25685048
tags question: http://stackoverflow.com/q/25568279
tags question: http://stackoverflow.com/q/25689731
tags question: http://stackoverflow.com/q/25675458

http://stackoverflow.com/comment/39934163
score: 0
type: AnswerComment
has text: Oh, that was obvious. Thx anyway! How do I set not to use proxy?
comment on: http://stackoverflow.com/a/25568306
type: Comment

http://stackoverflow.com/q/25585955
answer count: 1
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25585970
type: Question
has answer: http://stackoverflow.com/a/25585970
has body: I am following a tutorial on making list views, but I cannot find the cause of the error mainlistview1 cannot be resolved or is not a field. Here is my current code: import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.app.Activity; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListAdapter; import android.widget.ListView; import android.os.Build; import android.widget.AdapterView.*; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_main); String[] riverCities = new String[] {"Greenville", "Vicksburg", "Memphis", "Natchez", "Cape Girardeau", "Helena"}; ListView listView = (ListView)findViewById(R.id.mainListView1); ListAdapter adapter = new ArrayAdapter<String>(this, android.R.id.mainListView1, riverCities); listView.setAdapter(adapter); } The layout
tagged with: android
has title: mainlistview1 cannot be resolved or is not a field
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/a/25627867
has comment: http://stackoverflow.com/comment/40040224
accepted answer of: http://stackoverflow.com/q/25627673
type: Answer
answers question: http://stackoverflow.com/q/25627673
has comment: http://stackoverflow.com/comment/40040209
upvote count: 4
score: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/91360003
has body: Telephony.Sms.Outbox. This class will help you retreive messages which were not sent due to some reason. use URI as content://sms/failed for retrieving failed sent messages. Similarly other types can be retrieved as : Inbox = "content://sms/inbox" Failed = "content://sms/failed" Queued = "content://sms/queued" Sent = "content://sms/sent" Draft = "content://sms/draft" Outbox = "content://sms/outbox" Undelivered = "content://sms/undelivered" All = "content://sms/all" Conversations = "content://sms/conversations". If you want to retrieve it based on type, take a look here. public static final int MESSAGE_TYPE_ALL = 0; public static final int MESSAGE_TYPE_INBOX = 1; public static final int MESSAGE_TYPE_SENT = 2; public static final int MESSAGE_TYPE_DRAFT = 3; public static final int MESSAGE_TYPE_OUTBOX = 4; public static final int MESSAGE_TYPE_FAILED = 5; // for failed outgoing messages public static final int MESSAGE_TYPE_QUEUED = 6; // for messages to send later
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/83739987

http://stackoverflow.com/q/25585387
has comment: http://stackoverflow.com/comment/39961899
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
has title: Java - casting to unknown type
accepted answer: http://stackoverflow.com/a/25585465
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25585465
tagged with: list
tagged with: casting
tagged with: java
has comment: http://stackoverflow.com/comment/39962054
has body: I'm creating a method that takes in a list containing an unknown type. The method returns the last element of the list. I will have different lists containing objects of different types being passed into this method. I need to somehow figure out the class type of the last element of the list passed in. I will then want to cast what I'm returning to it. I want this method to be very generic, I don't want to have to update it every time I want to pass in a list with a new class type. Any ideas? public static Object getLastElement(List&lt;? extends Object&gt; cells) { return cells.get(cells.size() - 1); } Thanks.
has comment: http://stackoverflow.com/comment/39961987
answer count: 1

http://stackoverflow.com/comment/39965038
has text: maven doesn't resolv this, because that is a java standard class. Have you tried to clean and rebuild your project?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25587091

http://stackoverflow.com/comment/39988557
comment on: http://stackoverflow.com/q/25599725
type: Comment
type: QuestionComment
score: 0
has text: @user3875672 what concept? there is no such concept at all! at least in java!

http://stackoverflow.com/comment/40064075
comment on: http://stackoverflow.com/a/25641403
score: 0
type: Comment
has text: Not try to open. Because it automatic start by Bootup Receiver. After factory reset and boot. My phone say my app force Close
type: AnswerComment

http://stackoverflow.com/comment/39928410
score: 0
has text: no i havent, but i could do so. i just shuold change the buildpath then?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25552922

http://stackoverflow.com/q/25564233
has body: I am trying to obfuscate an Android 4+ app that uses Dropbox with Proguard in Eclipse. So far I have no experience with Proguard and thus I used different tutorials and answers here on SO to configure my proguard-project.txt: -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider -keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class com.android.vending.licensing.ILicensingService When I try to export the APK using the File/Export.../Export Android Application/... dialog the creation fails with an Proguard error: [2014-08-29 09:50:30 - MyApp] Proguard returned with error code 1. See console [2014-08-29 09:50:30 - MyApp] Note: there were 367 duplicate class definitions. [2014-08-29 09:50:30 - MyApp] Warning: org.apache.commons.logging.impl.ServletContextCleaner: can't find superclass or interface javax.servlet.ServletContextListener [2014-08-29 09:50:30 - MyApp] Warning: org.apache.http.entity.mime.FormBodyPart: can't find superclass or interface org.apache.james.mime4j.message.BodyPart ... [2014-08-29 09:50:30 - MyApp] Warning: library class android.net.http.AndroidHttpClient extends or implements program class org.apache.http.client.HttpClient ... [2014-08-29 09:50:30 - MyApp] Warning: org.bouncycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.DirContext [2014-08-29 09:50:30 - MyApp] You should check if you need to specify additional program jars. [2014-08-29 09:50:30 - MyApp] Warning: there were 223 unresolved references to classes or interfaces. […
score: 1
tagged with: java
has title: Proguard complains about missing classes in external JARs. How to solve this correctly?
accepted answer: http://stackoverflow.com/a/25564444
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25564444
tagged with: eclipse
tagged with: proguard
favorite count: 0
type: Question
tagged with: android
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/40047152
score: 0
type: Comment
type: QuestionComment
has text: The compiler does not look at the method name to try to figure out what you're doing, even if it follows a JavaBean convention. You could call it `destroyName` or `reverseName`, but it will do whatever you tell it to do in the body, period.
comment on: http://stackoverflow.com/q/25631591

generics
tags question: http://stackoverflow.com/q/25688017
tags question: http://stackoverflow.com/q/25655652
tags question: http://stackoverflow.com/q/25655909
tags question: http://stackoverflow.com/q/25708277
tags question: http://stackoverflow.com/q/25689673
tags question: http://stackoverflow.com/q/25570889
tags question: http://stackoverflow.com/q/25585581
tags question: http://stackoverflow.com/q/25650726
tags question: http://stackoverflow.com/q/25571600
tags question: http://stackoverflow.com/q/25695011
tags question: http://stackoverflow.com/q/25623049
tags question: http://stackoverflow.com/q/25648414
tags question: http://stackoverflow.com/q/25710107
tags question: http://stackoverflow.com/q/25617284
tags question: http://stackoverflow.com/q/25618452
tags question: http://stackoverflow.com/q/25630370
tags question: http://stackoverflow.com/q/25711332
tags question: http://stackoverflow.com/q/25711067
tags question: http://stackoverflow.com/q/25688642
tags question: http://stackoverflow.com/q/25639476
tags question: http://stackoverflow.com/q/25614188
tags question: http://stackoverflow.com/q/25686930
tags question: http://stackoverflow.com/q/25551629
tags question: http://stackoverflow.com/q/25568496
tags question: http://stackoverflow.com/q/25602014
tags question: http://stackoverflow.com/q/25619909
tags question: http://stackoverflow.com/q/25600007
tags question: http://stackoverflow.com/q/25661730
tags question: http://stackoverflow.com/q/25676368
tags question: http://stackoverflow.com/q/25656651
tags question: http://stackoverflow.com/q/25599577
tags question: http://stackoverflow.com/q/25630132
type: Tag
tags question: http://stackoverflow.com/q/25693024
tags question: http://stackoverflow.com/q/25619676
tags question: http://stackoverflow.com/q/25594728
tags question: http://stackoverflow.com/q/25681716
tags question: http://stackoverflow.com/q/25613223
tags question: http://stackoverflow.com/q/25620787
tags question: http://stackoverflow.com/q/25552064
tags question: http://stackoverflow.com/q/25679700
tag name: generics
tags question: http://stackoverflow.com/q/25634149
tags question: http://stackoverflow.com/q/25693204
tags question: http://stackoverflow.com/q/25650424
tags question: http://stackoverflow.com/q/25709155
tags question: http://stackoverflow.com/q/25682509
tags question: http://stackoverflow.com/q/25697739
tags question: http://stackoverflow.com/q/25653204

http://stackoverflow.com/comment/39969888
score: 0
type: AnswerComment
has text: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
comment on: http://stackoverflow.com/a/25564421
type: Comment

http://stackoverflow.com/comment/40166771
score: 0
comment on: http://stackoverflow.com/q/25697729
has text: @Jesper "it is not working" means it is throwing null pointer exception at the place where I have used "demo.clear()".So only I have mentioned that
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25708417
accepted answer of: http://stackoverflow.com/q/25708173
has comment: http://stackoverflow.com/comment/40189654
has body: Java Vector is not commonly used anymore. You could use a combination of lists and maps, as explained in this post, but maybe you could just make Person objects with name and address and add them to an ArrayList in stead? import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args){ List&lt;Person&gt; persons = new ArrayList&lt;&gt;(); persons.add( new Person("John", "Canada") ); persons.add( new Person("John", "USA") ); persons.add( new Person("John", "Mexico") ); //java 8 persons.stream().forEach((p) -&gt; { System.out.println("Name: " + p.getName() +", Address: "+ p.getAddress()); }); //java 7 for(Person p : persons){ System.out.println("Name: " + p.getName() +", Address: "+ p.getAddress()); } } } class Person { private final String name; private final String address; public Person(String name, String address){ this.name = name; this.address = address; } public String getName() { return name; } public String getAddress() { return address; } }
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40190306
has comment: http://stackoverflow.com/comment/40191185
answers question: http://stackoverflow.com/q/25708173
has comment: http://stackoverflow.com/comment/40191859
type: AcceptedAnswer

http://stackoverflow.com/comment/39990486
type: QuestionComment
has text: You application isn't deployed successfully. Try to redeploy the application in see if you get any exceptions in the system logs.
comment on: http://stackoverflow.com/q/25600953
score: 0
type: Comment

http://stackoverflow.com/q/25598867
has comment: http://stackoverflow.com/comment/39989702
type: UnansweredQuestion
has body: I'm new to SpeechRecognizer. I'm wondering is there any way to know SpeechRecognizer is using offline recognize or online recognizer? If so, is there any way to controll SpeechRecognizer to use offline recognize? I read the document and there is no api that can give me the internet usage of SpeechRecognizer. Can anybody help me? Thanks!
tagged with: java
tagged with: speech-to-text
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39988004
has title: How to control SpeechRecognizer to use offline recognize instead of online recognize?
has comment: http://stackoverflow.com/comment/39986768
tagged with: speech-recognition
favorite count: 0
tagged with: google-voice
type: Question
tagged with: android
linked to: http://stackoverflow.com/q/17616994
answer count: 0

http://stackoverflow.com/a/25646498
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25646122
has comment: http://stackoverflow.com/comment/40073547
answers question: http://stackoverflow.com/q/25646122
type: Answer
has body: try this House id Sell Rent Surface Type of Building Public Costs Year of Build/Renovation Type of Heat <% //int i = 0; do you need i? I don't understand original structure if(Souli.hoho()!=null){ String[] lines = Souli.hoho().split("\\$"); for(String line: lines){ String[] kati = line.split("#"); %> <%=kati[0]%> <%=kati[2]%> <%=kati[1]%> <%=kati[4]%> <%=kati[3]%> <%=kati[9]%> <%=kati[5]%> <%=kati[6]%> <%}}%> But I am not sure about indexes of kati[] array. Can you post original string example from database (before splits). Also (if you still using this version) it's good idea to check how many elements in the kati[] array after splitting line. Is there exacly 10 elements?
score: 1
has comment: http://stackoverflow.com/comment/40073255
type: AcceptedAnswer
downvote count: 0

jframe
tags question: http://stackoverflow.com/q/25608839
tags question: http://stackoverflow.com/q/25556020
tags question: http://stackoverflow.com/q/25647052
tags question: http://stackoverflow.com/q/25581631
tags question: http://stackoverflow.com/q/25557381
tags question: http://stackoverflow.com/q/25557774
tags question: http://stackoverflow.com/q/25627810
tags question: http://stackoverflow.com/q/25662658
tags question: http://stackoverflow.com/q/25628778
tag name: jframe
tags question: http://stackoverflow.com/q/25702351
tags question: http://stackoverflow.com/q/25700414
tags question: http://stackoverflow.com/q/25584562
tags question: http://stackoverflow.com/q/25698479
tags question: http://stackoverflow.com/q/25708775
tags question: http://stackoverflow.com/q/25615366
tags question: http://stackoverflow.com/q/25687660
tags question: http://stackoverflow.com/q/25635601
tags question: http://stackoverflow.com/q/25657330
type: Tag
tags question: http://stackoverflow.com/q/25609286
tags question: http://stackoverflow.com/q/25624435
tags question: http://stackoverflow.com/q/25622268
tags question: http://stackoverflow.com/q/25678969
tags question: http://stackoverflow.com/q/25620975
tags question: http://stackoverflow.com/q/25676392
tags question: http://stackoverflow.com/q/25689404

http://stackoverflow.com/q/25600672
has comment: http://stackoverflow.com/comment/39989951
tagged with: checkbox
possible better answer: http://stackoverflow.com/a/25600795
has answer: http://stackoverflow.com/a/25600734
answer count: 3
has answer: http://stackoverflow.com/a/25600795
accepted answer: http://stackoverflow.com/a/25600919
upvote count: 2
has answer: http://stackoverflow.com/a/25600919
has body: How to maintain CheckBox state across the activities I checked a CheckBox in FirstActivity.java but when i move back to FirstActivity.java from any other activity, say from SecondActivity.java.. Then, I am not getting my CheckBox as check which i checked earlier. Using onSaveInstanceState &amp; onRestoreInstanceState, see complete code below:- public class FirstActivity extends Activity { CheckBox cb1; Button btnNext; private boolean boolCheck1 = false; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); cb_cb1 = (CheckBox) findViewById(R.id.cb1); btnNext = (Button) findViewById(R.id.btnNext); // control status of body frame checkboxes cb1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if(isChecked){ } } }); btnNext.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent intent = new Intent(FirstActivity.this, SecondActivity.class); startActivity(intent); } }); } @Override public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); savedInstanceState.putBoolean("Enable", cb1.isChecked()); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); boolCheck1 = savedInstanceState.getBoolean("Enable"); } }
downvote count: 1
favorite count: 0
type: Question
type: AnsweredQuestion
has title: How to maintain CheckBox state across the activities
score: 1
tagged with: android
tagged with: java

http://stackoverflow.com/q/25629897
answer count: 1
accepted answer: http://stackoverflow.com/a/25630323
has comment: http://stackoverflow.com/comment/40043632
tagged with: swing
has answer: http://stackoverflow.com/a/25630323
type: Question
has comment: http://stackoverflow.com/comment/40043719
tagged with: jcombobox
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/9554636
has title: JCombobox unexpected behaviour
linked to: http://stackoverflow.com/q/7229226
score: 0
has body: I have designed a JFrame in Netbeans as shown in the image below: When I run the program, the combo box goes all white as shown in the image below: And.. When I click the "white" space it shows the Item(s) inside the combo box which can be selected.. but even after selecting, it is still the same white space not showing the layout properly and the selected item. My code is as following: public class LoginWindow extends javax.swing.JFrame { /** * Creates new form LoginWindow */ public LoginWindow() { initComponents(); setLocationRelativeTo(null); new MyWorker().execute(); } .......... And the Worker class is as following: class MyWorker extends javax.swing.SwingWorker&lt;String, Void&gt; { protected String doInBackground() { databaseCheck(); return "done"; } protected void done() { progressPanel.setVisible(false); loginPasswordField.setEnabled(true); locationComboBox.setEnabled(true); loginButton.setEnabled(true); loginPasswordField.requestFocusInWindow(); } } It must be noted that this behaviour is mostly experienced, although sometimes it is working just fine (very rarely)... Any help would be appreciated.
tagged with: java

http://stackoverflow.com/q/25583355
upvote count: 31
has body: Which is the default scope of a Spring 4 @Service? Does it make sense designing a Service implementation to store info about the current logged user (according to the current HTTP session), through class attributes (also by using the final modifier)?
tagged with: java
has answer: http://stackoverflow.com/a/25583493
favorite count: 0
type: Question
answer count: 1
downvote count: 0
tagged with: spring
has title: Spring Service default scope
tagged with: scope
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25583493
score: 31

http://stackoverflow.com/comment/39970428
comment on: http://stackoverflow.com/q/25586828
type: Comment
type: QuestionComment
score: 0
has text: @pbabcdefp That's right!

http://stackoverflow.com/comment/40171078
type: AnswerComment
has text: Thanks. I can cat the report if there is a failed test. However, format of the ```TEST-Summary.xml``` is not a human friendly ... Are there any commands for parsing that XML ? Or, is it possible to get the failed test so that I can run another ```junit``` with ```printsummary``` off to dump those errors?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25698915

http://stackoverflow.com/comment/40175897
type: AnswerComment
comment on: http://stackoverflow.com/a/25702766
type: Comment
has text: Yeah I did try to put that trigger in the while loop,
score: 0

http://stackoverflow.com/q/25599138
has comment: http://stackoverflow.com/comment/39987128
score: 0
answer count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/39986992
has answer: http://stackoverflow.com/a/43482834
has body: How can i load a text file with a runnable .jar file, It works fine when it's not jarred but after i jar the application it can't locate the file. Here's what i'm using to load the text file. import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; import java.util.Map; public class PriceManager { private static Map&lt;Integer, Double&gt; itemPrices = new HashMap&lt;Integer, Double&gt;(); public static void init() throws IOException { final BufferedReader file = new BufferedReader(new FileReader("prices.txt")); try { while (true) { final String line = file.readLine(); if (line == null) { break; } if (line.startsWith("//")) { continue; } final String[] valuesArray = line.split(" - "); itemPrices.put(Integer.valueOf(valuesArray[0]), Double.valueOf(valuesArray[1])); } System.out.println("Successfully loaded "+itemPrices.size()+" item prices."); } catch (final IOException e) { e.printStackTrace(); } finally { if (file != null) { file.close(); } } } public static double getPrice(final int itemId) { try { return itemPrices.get(itemId); } catch (final Exception e) { return 1; } } } Thanks for any and all help.
has comment: http://stackoverflow.com/comment/39987161
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25599168
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/39987352
has title: How to access and read a .txt file from a runnable jar
tagged with: filereader
has comment: http://stackoverflow.com/comment/39987070

http://stackoverflow.com/a/25588703
score: 0
has body: As you guessed it is absolutely fine to call ExecutorService shutdown() and awaitTermination(..) on the ExecutorService from Thread B. Infact in the usual usage of ExecutorService, one thread takes care of adding all the thread tasks to the executorservice and then the same thread initiates a graceful shutdown() and then awaitTermination(..). So in your case you are just creating ThreadB to do your shutdown tasks. Ideally it would be better to not submit your ThreadB to the same ExecutorService which it would try to shutdown() which I believe you would have taken into consideration.
answers question: http://stackoverflow.com/q/25587793
type: Answer

http://stackoverflow.com/a/25595866
has comment: http://stackoverflow.com/comment/39981128
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25595834
score: 4
has comment: http://stackoverflow.com/comment/39981078
type: Answer
has comment: http://stackoverflow.com/comment/39981162
accepted answer of: http://stackoverflow.com/q/25595834
has body: First make loan visible outside its' assignment block. Second, use an else. That should be something like - String second = keyboard.next(); int loan = 0 if (second.equalsIgnoreCase("yes")) { loan = 8000; } else { System.out.println ("how much do you get"); loan = keyboard.nextInt(); } System.out.println(loan);

http://stackoverflow.com/a/25581425
answers question: http://stackoverflow.com/q/25574209
type: Answer
score: 0
has body: I had a similar question a few years ago and I used OpenFrameworks with the osxOpenNI addon. The advantage is that this addon uses both OpenNI and libfreenect. Libfreenect however is simply used for accessing the hardware OpenNI can't: accelerometer, tilt/motor and the LED I suggest giving that a go and bare in mind you should run the app as sudo if you're controlling hardware(LED,etc.). This addon is old now and doesn't support OpenNI2 so I suggest installing OpenNI 1.5 This might a bit more effort than what it's worth. Perhaps if video output isn't enough, some sort of sound feedback would help ?

http://stackoverflow.com/q/25689983
downvote count: 0
has body: I tried to convert the new today's date object to UTC. But no luck since new date object is always in local time zone. I have been trying to verify two dates using 'before' method. date1 is in UTC format. date2 is today. The below code always prints the today's date object in local time zone. import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class test { /** * @param args */ public static void main(String[] args) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); String todayStr = sdf.format(new Date());// This string is in UTC. But I need date object in UTC. try { System.out.println(sdf.parse(todayStr));// This is still printing in local time zone. } catch (ParseException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }
has answer: http://stackoverflow.com/a/25690076
score: 1
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25692029
possible better answer: http://stackoverflow.com/a/25692029
linked to: http://stackoverflow.com/q/3006150
favorite count: 0
type: Question
duplicate of: http://stackoverflow.com/q/3006150
accepted answer: http://stackoverflow.com/a/25690076
has title: How to check a date (in UTC format) is 48 hours before today date
has comment: http://stackoverflow.com/comment/40151979
tagged with: date
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40152024
answer count: 2

http://stackoverflow.com/a/25658128
score: 0
has body: create a class for example ArrayClass public class ArrayClass{ private String firstItem,secondItem,thirdItem; public ArrayClass(String[] param){ firstItem = param[0]; secondItem = param[1]; thirdItem = param[2]; } //getters and setters } then override the equals and hashCode method @Override public boolean equals(Object obj) { // TODO Auto-generated method stub if (this == obj) return true; if (obj == null || (this.getClass() != obj.getClass())) { return false; } ArrayClass aC = (ArrayClass) obj; return (this.firstItem.equals(aC.getFirstItem()) &amp;&amp; this.secondItem.equals(aC.getSecondItem())) || (this.firstItem.equals(aC.getFirstItem()) &amp;&amp; this.thirdItem.equals(aC.getThirdItem())); } @Override public int hashCode() { // TODO Auto-generated method stub // up to you how you compute your hashcode to be unique return thirdItem != null ? thirdItem.hashCode() : 0; } then in your main class use Set instead of List Set&lt;ArrayClass&gt; testSet = new HashSet&lt;ArrayClass&gt;(); then modify your while loop while (reader.ready()) { ArrayClass aC = new ArrayClass(reader.readLine().split(",")); testSet.add(aC); } to show the output for(ArrayClass aC : testSet){ System.out.println(aC.getFirstItem()+" "+aC.getSecondItem()+" "+aC.getThirdItem()); } output: 1,a,gh 1,b,cd 2,a,xy 3,a,pq
has comment: http://stackoverflow.com/comment/40094832
has comment: http://stackoverflow.com/comment/40097553
has comment: http://stackoverflow.com/comment/40094813
has comment: http://stackoverflow.com/comment/40098097
type: Answer
answers question: http://stackoverflow.com/q/25657524

http://stackoverflow.com/comment/40176972
type: Comment
type: AnswerComment
has text: thanks for posting your full solution! you seem to write good code, keep up that great work!
score: 0
comment on: http://stackoverflow.com/a/25622687

http://stackoverflow.com/q/25626796
has title: How to create a Certificate sign request using native Java
accepted answer: http://stackoverflow.com/a/25627308
has body: Is there a way to create a pkcs10 CSR using native java library? Hello there, i am looking for a way to generate a PKCS10 CSR within an java application. I prefer native java librarys. Absolutely obsolet are commandline tools. I know it is possible by using BouncyCastle, but currently i am looking for a alternative way to do that. The library itself should be free to use for commertial belongings.
has answer: http://stackoverflow.com/a/25627308
tagged with: csr
type: AnsweredQuestion
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
tagged with: pki
favorite count: 0
type: Question

http://stackoverflow.com/a/25707969
score: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/40194463
answers question: http://stackoverflow.com/q/25704527
has body: Try these dependencies org.slf4j slf4j-api 1.7.5 org.slf4j jcl-over-slf4j 1.7.5 runtime org.slf4j slf4j-log4j12 1.7.5 runtime
has comment: http://stackoverflow.com/comment/40191636
type: Answer
upvote count: 4

http://stackoverflow.com/comment/40199141
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25706544
has text: I think for now we are going to go with the application on the client side. I also forgot about just using FTP itself so I will probably do that instead of streaming. I Also need to delete files, so I figure this might be the best approach. Thanks for your suggestion though I really appreciate it!
score: 0

http://stackoverflow.com/a/25566316
has body: You can provide additional members in the client configuration. If one of the servers goes down, it will select another member. PS: If you have a smart client (default), it will connect to one of the members in its configuration and then continuously be updated with the newest member information.
accepted answer of: http://stackoverflow.com/q/25558312
type: Answer
answers question: http://stackoverflow.com/q/25558312
has comment: http://stackoverflow.com/comment/40171014
score: 2
upvote count: 2
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40184670

http://stackoverflow.com/a/25627694
has body: The main difference is that flatMap is an intermediate operation. while collect is a terminal operation. So flatMap is the only way to process the flattened stream items if you want to do other operations than collecting immediately. Further collect(ArrayList::new, ArrayList::addAll, ArrayList::addAll) is very hard to read given the fact that you have two identical method references ArrayList::addAll with completely different semantics. Regarding parallel processing, your guess is wrong. The first one has lesser capabilities of parallel processing as it relies on ArrayList.addAll applied to the stream items (sub-lists) which can’t be broken into parallel sub-steps. In contrast, Collectors.toList() applied to a flatMap can do parallel processing of sub-list items if the particular Lists encountered in the stream support it. But this will be relevant only if you have a rather small stream of rather big sub-lists. The only drawback of flatMap is the intermediate stream creation which adds an overhead in the case that you have a lot of very small sub-lists. But in your example, the stream is empty so it doesn’t matter (scnr).
accepted answer of: http://stackoverflow.com/q/25626348
downvote count: 0
score: 9
has comment: http://stackoverflow.com/comment/40045669
upvote count: 9
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25626348
has comment: http://stackoverflow.com/comment/40045334
has comment: http://stackoverflow.com/comment/40044739

http://stackoverflow.com/comment/40050047
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25633231
score: 0
has text: And where does this message come from?

http://stackoverflow.com/a/25595969
has body: Just use a FlowLayout for the content pane. BorderLayout won't respect preferred size and will stretch the component to fit. See more about layout managers at Laying out Components Withing a Container If you want to set an initial size for the editor pane, just like with any other component that is Scollable, you can override getPreferredScrollableViewportSize() to set the size for the scroll pane view (when the component is added) Also you should be adding the editor to the scroll pane, not the panel. Doing the latter, the editor will not be scrollable in the scroll pane. import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JScrollPane; @SuppressWarnings("serial") public class ScrollPaneDemo extends JFrame { public static void main(String[] args) { new ScrollPaneDemo(); } public ScrollPaneDemo() { super("ScrollPaneExample"); setSize(400, 400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); JEditorPane editorPane = new JEditorPane("text/plain", "") { @Override public Dimension getPreferredScrollableViewportSize() { return new Dimension(200, 200); } }; editorPane.setBackground(Color.YELLOW); for (int i = 0; i &lt; 50; i++) { editorPane.setText(editorPane.getText() + "Hello World Hello World\n"); } JScrollPane scrollPane = new JScrollPane(editorPane); add(scrollPane); setVisible(true); } } UPDATE In my working program, there is more than just an editor pane in the contentPane. This is why I am using a BoxLayout instead of a FlowLayout for the contentPane; because the vertical page-flow layout is desired. The BoxLayout is the problem. You need to set a maximum size for the editor pane. Or just get rid of the BoxLayout all together. FlowLayout or GridBagLayout will respect the preferred size UPDATE 2 Here is an example using GridBagLayout that may more suitable for your "expanding" editor. import java.awt.BorderLayout; import java.awt.Colo…
answers question: http://stackoverflow.com/q/25595693
has comment: http://stackoverflow.com/comment/39981537
score: 3
has comment: http://stackoverflow.com/comment/39981484
has comment: http://stackoverflow.com/comment/39981339
has comment: http://stackoverflow.com/comment/39982512
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/25595693
has comment: http://stackoverflow.com/comment/39981432
has comment: http://stackoverflow.com/comment/39981747
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25702893
has body: Random rand = new Random(); int min = 97; // ascii for 'a' int randomNum = rand.nextInt(3) + min; char myVariable = (char)randomNum;
type: Answer
answers question: http://stackoverflow.com/q/25702850
score: 0

http://stackoverflow.com/comment/40302246
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25669539
has text: When i run your code or use your code and this: JFrame j = new JFrame(""); j.setSize(); j.setVisible(true); Code doesnt work. Is there something that i doing wrong ?

http://stackoverflow.com/a/25697413
has body: Should this be the example: int a=20; main(){ sysout(a); if(true){ int a = 30; // now this will shadow the class variable a sysout(a); } sysout(a); } Now output should be: 20 30 20
upvote count: 3
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25697388
downvote count: 0
answers question: http://stackoverflow.com/q/25697388
type: Answer
has comment: http://stackoverflow.com/comment/40166217

http://stackoverflow.com/comment/40035750
score: 0
type: Comment
has text: Alright, seems likely. When I added a fifth loop, it started appearing in the result of the fourth at the same time as the second. Thanks for the reply!
type: AnswerComment
comment on: http://stackoverflow.com/a/25625733

http://stackoverflow.com/comment/39933438
type: Comment
has text: No prob. I have the solution now. Sometimes it is good to post here and be pointed in the right direction.
type: QuestionComment
comment on: http://stackoverflow.com/q/25566734
score: 1

http://stackoverflow.com/a/25566328
type: Answer
has comment: http://stackoverflow.com/comment/39926438
score: 8
has comment: http://stackoverflow.com/comment/39925982
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39927560
has body: Your code is equivalent to: int x = 5; int originalX = x; int a = x++; int b = x++; int c = x++; x = originalX + a * b * c; System.out.println("x = " + x); //215
has comment: http://stackoverflow.com/comment/39926003
answers question: http://stackoverflow.com/q/25566230
upvote count: 8
accepted answer of: http://stackoverflow.com/q/25566230

http://stackoverflow.com/a/25667680
has body: This is the O(1) solution, which passed the test int solution(int A, int B, int K) { int b = B/K; int a = (A &gt; 0 ? (A - 1)/K: 0); if(A == 0){ b++; } return b - a; } Explanation: Number of integer in the range [1 .. X] that divisible by K is X/K. So, within the range [A .. B], the result is B/K - (A - 1)/K In case A is 0, as 0 is divisible by any positive number, we need to count it in.
has comment: http://stackoverflow.com/comment/91025674
score: 31
has comment: http://stackoverflow.com/comment/86486261
has comment: http://stackoverflow.com/comment/77030529
upvote count: 31
has comment: http://stackoverflow.com/comment/77025716
has comment: http://stackoverflow.com/comment/48383503
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25661519
has comment: http://stackoverflow.com/comment/91023392

http://stackoverflow.com/q/25670368
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25670430
downvote count: 0
tagged with: java
has title: Java String encoding
answer count: 1
tagged with: string
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25670430
tagged with: encoding
has body: What´s the difference between "hello world".getBytes("UTF-8"); and Charset.forName("UTF-8").encode("hello world").array(); ? The second code produces a byte array with 0-bytes at the end in most cases.
score: 2
upvote count: 2

http://stackoverflow.com/comment/40084973
has text: Thanks! Not exactly what I was hoping for, but sounds like the only way to do it at this point.
comment on: http://stackoverflow.com/a/25574587
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/25584262
has comment: http://stackoverflow.com/comment/39960424
has comment: http://stackoverflow.com/comment/39960295
has comment: http://stackoverflow.com/comment/39960154
answers question: http://stackoverflow.com/q/25583596
has comment: http://stackoverflow.com/comment/39960047
type: Answer
has body: Most probably the problem is within the Downloader class in download() method. You need to load the content of the stream before moving the execution to another thread (which is the main thread in this case)
score: 0

http://stackoverflow.com/comment/40022826
score: 0
type: Comment
type: QuestionComment
has text: What's happening inside ClientConn.receive(message) ?
comment on: http://stackoverflow.com/q/25609251

http://stackoverflow.com/comment/40353378
type: Comment
comment on: http://stackoverflow.com/a/25701013
has text: @user2938 Import `java.util.List`
type: AnswerComment
score: 0

http://stackoverflow.com/comment/118237129
score: 0
type: AnswerComment
has text: I'm glad you liked it.
type: Comment
comment on: http://stackoverflow.com/a/53293897

http://stackoverflow.com/a/25701480
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25701403
answers question: http://stackoverflow.com/q/25701403
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40173230
has comment: http://stackoverflow.com/comment/40173268
score: 3
upvote count: 3
has body: Implicit compilation in Java mean that, for example, when compiling a single class Foo.java, the compiler will implicitly compile it dependencies. You can control the implicit compilation with -implicit parameter associated to the javac command as stated from documentation : -implicit:{class,none} Controls the generation of class files for implicitly loaded source files. To automatically generate class files, use -implicit:class. To suppress class file generation, use -implicit:none. If this option is not specified, the default is to automatically generate class files. In this case, the compiler will issue a warning if any such class files are generated when also doing annotation processing. The warning will not be issued if this option is set explicitly. See Searching For Types. See http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javac.html for more information on java compiler.

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

http://stackoverflow.com/a/27422972
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/25657823
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/96932896
answers question: http://stackoverflow.com/q/25657823
has body: Always Pass the URL class loader for creating knowledge base. because drools load the URL class loader classes to its working memory. public KnowledgeBase newKBase(URLClassLoader loader) { KnowledgeBuilderConfiguration kbuilderConfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null, loader); // Create the agent using the builder configuration KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration(); KnowledgeBaseConfiguration kbaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null, loader); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig); KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(knowledgeAgentName, kbase, aconf, kbuilderConfig); kbase = kagent.getKnowledgeBase(); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbuilderConfig); addRules(kbuilder); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() &gt; 0) { for (KnowledgeBuilderError error : errors) System.err.println(error); throw new IllegalArgumentException("Could not parse knowledge."); } kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); return kbase; } Above method will load the rules without throwing error.

http://stackoverflow.com/comment/40031756
has text: all the best for your endeavour!
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25623697

http://stackoverflow.com/comment/40098660
comment on: http://stackoverflow.com/a/25654810
type: AnswerComment
has text: It seems to be working fine now. Originally, I downloaded the STS, downloaded the Grails IDE and run time, changed Grails to a lower version I manually downloaded, then downloaded Groovy. By downloading Groovy *before* downgrading the Grails version, everything seems to run fine. Quite peculiar, but there you go - thanks for your help.
score: 0
type: Comment

http://stackoverflow.com/q/25610868
type: Question
has answer: http://stackoverflow.com/a/25612321
tagged with: java
tagged with: bukkit
has comment: http://stackoverflow.com/comment/40008550
has title: Add things to lists to make each lists even size
has body: I am creating a Minecraft Bukkit Plugin called UHC (Ultra Hard Core) and I am planning on adding teams. I want it so you can choose what team you are on, but if you don't, it would automatically put you on a team. Min players for a team is 2, max is 4. So for example there is team Red, Blue, and Green. Red has 2, Blue has 1, Green has 4, it would add them to blue. Anyway of doing this?
has comment: http://stackoverflow.com/comment/40008547
upvote count: 0
type: UnansweredQuestion
downvote count: 3
score: -3
answer count: 1
tagged with: minecraft
linked to: http://stackoverflow.com/q/383947
favorite count: 0

http://stackoverflow.com/comment/40097411
score: 0
comment on: http://stackoverflow.com/a/25659339
type: Comment
has text: if i wanted to handled multiple version of Excel version file which one do i need to use it?
type: AnswerComment

http://stackoverflow.com/a/46562547
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25648020
has body: probably it's late... lastModified() and getDate() return the number of milliseconds since the 00:00:00 GMT, January 1, 1970 as a long value You can convert these values to LocalDateTime for example: public static LocalDateTime longToDate(long msec){ LocalDateTime date = LocalDateTime.ofInstant(Instant.ofEpochMilli(msec), ZoneId.systemDefault()); return date; }

http://stackoverflow.com/q/25656502
tagged with: arrays
type: Question
accepted answer: http://stackoverflow.com/a/25656529
has answer: http://stackoverflow.com/a/25656529
tagged with: java
has title: Calculate size of array
type: AnsweredQuestion
tagged with: for-loop
has body: I want to create an array of size n, where n is defined by the variables of a loop, but I don't know how to pre-calculate the size of the array. We can assume that start &lt; end and step > 0. int start; // Initialized by user int end; // Initialized by user int step; // Initialized by user int size = ? // What is the formula for the size ? Object[] array = new Object[size]; int index=0; for(int i=start; i&lt;=end; i+=step){ array[index++]=new Object(); } I could just use a List and then copy the elements to an array, but that seems like a detour. It's not: (end - start) / size
score: 0
answer count: 1

http://stackoverflow.com/a/25673943
type: Answer
has body: public String getAuthCodeResponse(String message) throws SAXException, IOException, ParserConfigurationException { factory = SAXParserFactory.newInstance(); handler = new SAXParserUsage(); // &lt;--- You create local instance here parser = factory.newSAXParser(); parser.parse(new InputSource(new StringReader(message)), handler); // ^^ parser writes to local instance here but ... return authorizationCode; // you return authCode field of the instance that this method is invoked on, // which has not been changed by this method. // So if it was null before, it still is null. } So you either have to return handler.authorizationCode or parser.parse(..., this);
answers question: http://stackoverflow.com/q/25673604
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25673604
upvote count: 1

http://stackoverflow.com/comment/40044736
comment on: http://stackoverflow.com/q/25630492
score: 0
type: QuestionComment
has text: I already mentioned. There are several of them like c++, c, java, .net
type: Comment

http://stackoverflow.com/comment/40191966
has text: Thank you. I guess i will go with screen shots then :)
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25699358

http://stackoverflow.com/comment/39951411
comment on: http://stackoverflow.com/a/25579411
has text: Since you have only 256 characters in ASCII, it basically detects if any of them are readily encountered - if yes remove the current character; else set the counter corresponding to the character to be true means it's encountered already. I assume you must know that char can be casted into int.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39947170
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25577115
has text: A custom one given to me. It has the ability to accept files and the service part works

http://stackoverflow.com/a/25652541
score: 5
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/25652451
has body: The behavior of a set is not specified if the value of an object is changed in a manner that affects equals comparisons while the object is an element in the set. -- the Set Javadoc
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25652451
type: AcceptedAnswer

http://stackoverflow.com/comment/40099940
comment on: http://stackoverflow.com/a/25660974
type: AnswerComment
score: 0
has text: @user1516873 I'm not sure I can understand what `negative digit count` even means, or even a number with `0 digits`. I could just add an assert to prevent that from happening, if you're so inclined. As I said, if you want, you can keep it as a `BigInteger` though if you want to handle large numbers.
type: Comment

http://stackoverflow.com/comment/40145092
has text: How is it different? Did you try writing a Comparator like the answers suggested? What did you try?
score: 2
comment on: http://stackoverflow.com/q/25686404
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40051462
has text: Instead of finding where the problem comes from, you just disable all of the ` ` on the page?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25634128
type: Comment

http://stackoverflow.com/comment/40000052
type: QuestionComment
comment on: http://stackoverflow.com/q/25606170
has text: Is java on the path?
score: 0
type: Comment

http://stackoverflow.com/comment/39917282
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25561558
type: AnswerComment
has text: How can I do this @Maddy?

http://stackoverflow.com/comment/50635423
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25634234
has text: Thanks, @sasha_trn, from `HttpServlet`, `HttpServletRequest` and `HttpServletResponse` [source codes](http://grepcode.com/), I see no mention to connection, and also I get no `Exception`. Best,

http://stackoverflow.com/q/25600729
tagged with: observer-pattern
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25608087
has body: I have an Event Login. I plan to populate that event with information such as this: // Class A. Login login = new Login(); login.setUsername(userName); observer.notifyEvent(login); The idea is for class B to get this information. Is this bad practice? If so why? The only forseable problem is that some other part of the software will be listening to this for no reason. When in reality only one class should be getting the information. The only advantage is that all my classes are connected to the Observer object, but not connected to each other. In other words, if I wanted to pass the username I would need to connect A and B. Which I would only do in extreme circumstances.
has answer: http://stackoverflow.com/a/25600793
downvote count: 0
accepted answer: http://stackoverflow.com/a/25600793
has title: Should I pass information inside Observer Events
tagged with: design-patterns
has answer: http://stackoverflow.com/a/25601986
possible better answer: http://stackoverflow.com/a/25601986
type: AnsweredQuestion
answer count: 3
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/25658718
has comment: http://stackoverflow.com/comment/40098452
has answer: http://stackoverflow.com/a/25661074
favorite count: 0
has comment: http://stackoverflow.com/comment/40098569
type: Question
has comment: http://stackoverflow.com/comment/40095920
tagged with: android
has body: I want to receive a jpeg image in android from a hardware via Bluetooth . I want to read the inputstream and show the actual data from byte array. my actual data looks like: ff d8 ff e1 63 70 45 78 69 66 00 00 49 49 2a 00 08 00 00 00 0b 00 0f 01 02 00 06 00 00 00 92 00 .........................ff d9 I used this code: void openBT() throws IOException { UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); //Standard SerialPortService ID mmSocket = mmDevice.createRfcommSocketToServiceRecord(uuid); mmSocket.connect(); mmOutputStream = mmSocket.getOutputStream(); mmInputStream = mmSocket.getInputStream(); beginListenForData(); //ConnectedThread(mmSocket); myLabel.setText("Bluetooth Opened"); } void beginListenForData() { final Handler handler = new Handler(); final byte delimiter = 10; //This is the ASCII code for a newline character stopWorker = false; readBufferPosition = 0; readBuffer = new byte[1024]; workerThread = new Thread(new Runnable() { public void run() { while(!Thread.currentThread().isInterrupted() &amp;&amp; !stopWorker) { try { int bytesAvailable = mmInputStream.available(); if(bytesAvailable &gt; 0) { final byte[] packetBytes = new byte[bytesAvailable]; mmInputStream.read(packetBytes); StringBuilder sb = new StringBuilder(); for (byte b : packetBytes) { sb.append(String.format("%02X ", b)).append(" ");//there's no need to mask it with 0xFF. Don't forget to leave a " " between bytes so you may distinguish them. } Log.d("data","data"+sb.toString()); handler.post(new Runnable() { public void run() { //ByteArrayInputStream imageStream = new ByteArrayInputStream( packetBytes); // Bitmap bitmap = BitmapFactory.decodeStream(imageStream); // image.setImageBitmap(bitmap); } }); } } catch (IOException ex) { stopWorker = true; } } } }); workerThread.start(); } What i am getting is that: 6163206339203564203264203138203........... 463206620666620643920 How to show the actual result(hex values) in logcat and then show the jpg image from the hex value??…
has title: get byte array of image from inputstream of Bluetooth
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40097627
tagged with: bluetooth
has comment: http://stackoverflow.com/comment/40097488
tagged with: java
linked to: http://stackoverflow.com/q/1580038
downvote count: 0
score: 1
upvote count: 1
answer count: 1

dynamic-class-loaders
tags question: http://stackoverflow.com/q/25657823
tag name: dynamic-class-loaders
type: Tag

http://stackoverflow.com/q/25672533
upvote count: 3
tagged with: android
tagged with: java
answer count: 3
linked to: http://stackoverflow.com/q/18735790
has answer: http://stackoverflow.com/a/25672802
downvote count: 1
has comment: http://stackoverflow.com/comment/40131918
favorite count: 0
has body: So, I'm trying to create an app which have a function like an alarm clock for Android phones, it will alert the user at their chosen time. When the alert screen show up, the user has an option to push a notification or snooze, and the app will push a notification and then close. However, when I click the snooze or the notification button, the app did not close. Instead, the app stop the alarm sound and minimized (just as when the user touch the home button). If I touch the recent app, I then can open the alert screen again. Edit: I know that there're some codes such as System.exit() or killProcess, since those code are not recommended, I prefer avoid using them. The reason I ask is because I tested the real clock app that come with my phone (4.3), and the it's alert screen will close after the I press the snooze or dismiss button. So there must be a way for me to do the same, right ? Answer Okay, so as Sagar Pilkhwal explained below, and after reading others related problems, I found out that there's no "good" method to close you app by codes, you have to leave that option to the users or OS. Unless you want to use System.exit or killProcess, but they're bad ways to force your app to close. Sagar Pilkhwal also have a alternatively method to this problem, if you don't want your alert screen show up in recent app, you bring up another activity. However, as for this case and Alarm Manager in general, open MainActivity will lead to nasty stuffs, since MainActivity is when we handle Alarm events. Then I found out another solution, if you don't want your alert screen show up in recent app, simply add android:excludeFromRecents="true" to your Alert.class Activity in the Manifest, or add Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTSto the intent used to start Alert.class. This will lead to other problem, as when the user press the Home button, the alarm won't turn off, and the user can't open recent app to access the alert screen (he'll has to open the app to do so). I fix this…
tagged with: broadcastreceiver
type: Question
score: 2
has answer: http://stackoverflow.com/a/25673697
has comment: http://stackoverflow.com/comment/40120282
has answer: http://stackoverflow.com/a/25685030
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3226495
has title: App won't close after finish()
tagged with: alarmmanager
duplicate of: http://stackoverflow.com/q/3226495

http://stackoverflow.com/comment/40131991
score: 1
type: Comment
has text: Add the whole stactrace please! Which jar is needed for `MessageEncoder`? And give us the line where the `excption occurs.
type: QuestionComment
comment on: http://stackoverflow.com/q/25678955

http://stackoverflow.com/q/25696772
favorite count: 0
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25696920
has comment: http://stackoverflow.com/comment/40165933
has comment: http://stackoverflow.com/comment/40165484
has answer: http://stackoverflow.com/a/25696890
possible better answer: http://stackoverflow.com/a/25696890
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25696920
score: 1
upvote count: 1
has title: Finding "opposite" or closing character
tagged with: java
tagged with: string
has body: I have a method strip() and here is the context of its use: public String strip(String data, String tag) { ... } @param data a string where all open symbols such as [({ have a matching close somewhere after them. @param tag an opening symbol(such as "[" @return a substring of the contents between the first given opening and the last corresponding closing character- with both characters removed. example: strip("caca blah blah [ hb {} ((stuff){okay} vv]","[") should return "hb {}((stuff)(okay) vv" My question - I have a solution in mind but I am trying to find a way to find the "opposite" or closing character of the one that is given, without coding all the possible combinations by hand. Is there some kind of trick or pattern with character coding, or possibly a utility method somewhere that does this?

java
tags question: http://stackoverflow.com/q/25591991
tags question: http://stackoverflow.com/q/25704291
tags question: http://stackoverflow.com/q/25610137
tags question: http://stackoverflow.com/q/25627935
tags question: http://stackoverflow.com/q/25624124
tags question: http://stackoverflow.com/q/25610043
tags question: http://stackoverflow.com/q/25652009
tags question: http://stackoverflow.com/q/25601669
tags question: http://stackoverflow.com/q/25704677
tags question: http://stackoverflow.com/q/25631591
tags question: http://stackoverflow.com/q/25571309
tags question: http://stackoverflow.com/q/25696205
tags question: http://stackoverflow.com/q/25558228
tags question: http://stackoverflow.com/q/25628601
tags question: http://stackoverflow.com/q/25664083
tags question: http://stackoverflow.com/q/25582226
tags question: http://stackoverflow.com/q/25681436
tags question: http://stackoverflow.com/q/25660240
tags question: http://stackoverflow.com/q/25614925
tags question: http://stackoverflow.com/q/25597470
tags question: http://stackoverflow.com/q/25684424
tags question: http://stackoverflow.com/q/25703593
tags question: http://stackoverflow.com/q/25593719
tags question: http://stackoverflow.com/q/25651530
tags question: http://stackoverflow.com/q/25554137
tags question: http://stackoverflow.com/q/25586370
tags question: http://stackoverflow.com/q/25648020
tags question: http://stackoverflow.com/q/25599047
tags question: http://stackoverflow.com/q/25639429
tags question: http://stackoverflow.com/q/25651605
tags question: http://stackoverflow.com/q/25652495
tags question: http://stackoverflow.com/q/25671857
tags question: http://stackoverflow.com/q/25705266
tags question: http://stackoverflow.com/q/25598256
tags question: http://stackoverflow.com/q/25688665
tags question: http://stackoverflow.com/q/25612984
tags question: http://stackoverflow.com/q/25701303
tags question: http://stackoverflow.com/q/25559614
tags question: http://stackoverflow.com/q/25674582
tags question: http://stackoverflow.com/q/25556165
tags question: http://stackoverflow.com/q/25666228
tags question: http://stackoverflow.com/q/25582514
tags question: http://stackoverflow.com/q/25652140
tags question: http://stackoverflow.com/q/25702088
tags question: http://stackoverflow.com/q/25702651
tags question: http://stackoverflow.com/q/25588555
tags question: http://stackoverflow.com/q/25607282
tags question: http://stackoverflow.com/q/25632412
tags question: http://stackoverflow.com/q/25695205
tags question: http://stackoverflow.com/q/25710855
tags question: http://stackoverflow.com/q/25687649
tags question: http://stackoverflow.com/q/25646891
tags question: http://stackoverflow.com/q/25624161
tags question: http://stackoverflow.com/q/25680668
tags question: http://stackoverflow.com/q/25605298
tags question: http://stackoverflow.com/q/25671827
tags question: http://stackoverflow.com/q/25592268
tags question: http://stackoverflow.com/q/25556004
tags question: http://stackoverflow.com/q/25556721
tags question: http://stackoverflow.com/q/25642847
tags question: http://stackoverflow.com/q/25626757
tags question: http://stackoverflow.com/q/25653204
tags question: http://stackoverflow.com/q/25584656
tags question: http://stackoverflow.com/q/25681670
tags question: http://stackoverflow.com/q/25708775
tags question: http://stackoverflow.com/q/25569770
tags question: http://stackoverflow.com/q/25701176
tags question: http://stackoverflow.com/q/25673899
tags question: http://stackoverflow.com/q/25560701
tags question: http://stackoverflow.com/q/25697506
tags question: http://stackoverflow.com/q/25712373
tags question: http://stackoverflow.com/q/25579987
tags question: http://stackoverflow.com/q/25577005
tags question: http://stackoverflow.com/q/25635385
tags question: http://stackoverflow.com/q/25661897
tags question: http://stackoverflow.com/q/25699834
tags question: http://stackoverflow.com/q/25553673
tags question: http://stackoverflow.com/q/25625548
tags question: http://stackoverflow.com/q/25669693
tags question: http://stackoverflow.com/q/25615366

http://stackoverflow.com/comment/40187343
type: AnswerComment
comment on: http://stackoverflow.com/a/25709137
score: 0
has text: sir, i just try but nothing happens, it cannot print the iInputSlot1P1, i need to take that number so i can use it to my next code, i know that i initialized that code inside the loop, my code is working and its fine, my only problem is can't get the nnumber i inserted on iInputSlot1P1, is there any way I can get it?
type: Comment

http://stackoverflow.com/q/25706655
possible better answer: http://stackoverflow.com/a/25706851
has comment: http://stackoverflow.com/comment/40183077
has comment: http://stackoverflow.com/comment/40183010
has answer: http://stackoverflow.com/a/25706725
has answer: http://stackoverflow.com/a/25706851
has title: contains method in java
has body: i know this is simple but im going crazy public class CadastroPessoas { Collection&lt;Pessoa&gt; lista; Pessoa p; public static void main(String[] args) { CadastroPessoas p = new CadastroPessoas(); } public CadastroPessoas() { lista = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; 10; i++) { p = new PessoaFisica(); p.setNome(String.format("name %02d", i)); p.setEmail(String.format("mail%02d@mail.com", i)); p.setTelefone(String.format("122312%02d", i)); if (!lista.contains(p)) { lista.add(p); } } for (Pessoa pessoa : lista) { System.out.println(pessoa.toString()); } } } i want add various "PessoaFisica" to my collection but i need to check if this person exists, and with this code i just add the 1st one, what is wrong in my code
accepted answer: http://stackoverflow.com/a/25706740
tagged with: arraylist
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 3
tagged with: collections
has answer: http://stackoverflow.com/a/25706740
type: Question

http://stackoverflow.com/comment/40057426
type: Comment
has text: I thought it would help people using other IDE's. @SotiriosDelimanolis
comment on: http://stackoverflow.com/a/25637109
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39994016
has text: Can you post where filelist come from? Why are you using to initialize the array?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25602612
type: QuestionComment

http://stackoverflow.com/q/25604477
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/39997189
answer count: 0
tagged with: spring-3
has comment: http://stackoverflow.com/comment/39996977
score: 1
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/40000367
has comment: http://stackoverflow.com/comment/40024124
favorite count: 0
type: Question
has title: @ResponseBody annotated method do not return Model as JSON Spring 3.2.10
linked to: http://stackoverflow.com/q/20828834
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39998114
upvote count: 1
has comment: http://stackoverflow.com/comment/39997879
tagged with: spring
has body: My method is annotated as @RequestMapping(value = "/keepAlive", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE,consumes = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody ModelMap test(HttpServletRequest req, final ModelMap model) { model.addAttribute("keepAlive", true); return model; } when I call is using ajax using JQuery it returns 500 server error and at server log I can see that it is looking for KeepAlive.jsp, I am using spring 3.2.10 and have jackson 2 at class path. When I debugged source code request is passed to ModelAndViewMethodReturnValueHandler rather than RequestResponseBodyMethodProcessor , It seems Model and view handler is registered before req res handler. How to solve this. Same code worked for spring 3.1.2. Thanks

http://stackoverflow.com/q/25700181
score: 0
tagged with: libgdx
tagged with: android
tagged with: java
answer count: 1
type: Question
has title: Implement gallery in libgdx for android
has answer: http://stackoverflow.com/a/25700247
has body: I need your help i want to implement menu like gallery in android. I want implement like this http://prntscr.com/4k6vze But i have no expiriance with libgdx. Give me suggest pleas or give me good tutorial. Thanks and have a nice day
accepted answer: http://stackoverflow.com/a/25700247
type: AnsweredQuestion

http://stackoverflow.com/q/25587106
has answer: http://stackoverflow.com/a/25587966
answer count: 4
score: 3
has body: I am doing some fancy stuff, where I really need to allocate about 1 GB. My Computer has 8GB 64 bit System, so that's not a problem. I use -Xmx 4g to increase my heap space, but sadly enough that doesn't work at all. I use: Runtime rt = Runtime.getRuntime(); long totalMem = rt.totalMemory(); long maxMem = rt.maxMemory(); long freeMem = rt.freeMemory(); double megs = 1048576.0; System.out.println ("Total Memory: " + totalMem + " (" + (totalMem/megs) + " MiB)"); System.out.println ("Max Memory: " + maxMem + " (" + (maxMem/megs) + " MiB)"); System.out.println ("Free Memory: " + freeMem + " (" + (freeMem/megs) + " MiB)"); Which shows me: Total Memory: 259522560 (247.5 MiB Max Memory: 259522560 (247.5 MiB) Free Memory: 0 (0 MiB) I really don't know what I am doing wrong. Does anyone of you have an idea? Thanks a lot!
upvote count: 3
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25587126
favorite count: 0
has title: Java heap space does not get increased using -Xmx 1g
type: Question
has answer: http://stackoverflow.com/a/25588080
tagged with: heap-memory
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25588664

http://stackoverflow.com/comment/39924573
comment on: http://stackoverflow.com/a/25564464
score: 0
type: AnswerComment
has text: Problem solved with the below answer. I had tried to persist Admin first but got the same exception when I got to persisting User. This wasn't needed because when persisting a User object, it first persists any Role objects because of the Cascade option.
type: Comment

powermock
type: Tag
tags question: http://stackoverflow.com/q/25669410
tag name: powermock
tags question: http://stackoverflow.com/q/25562865
tags question: http://stackoverflow.com/q/25642391
tags question: http://stackoverflow.com/q/25558228

http://stackoverflow.com/q/25657315
tagged with: web
tagged with: eclipse
favorite count: 0
score: 5
downvote count: 0
has body: What is the difference between Web Fragment Project and Dynamic Web Project on Eclipse? Which one would you recommend to use for building a clean structural website?
answer count: 1
type: Question
has title: What is the difference between Web Fragment Project and Dynamic Web Project?
accepted answer: http://stackoverflow.com/a/25657750
type: AnsweredQuestion
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/25657750

http://stackoverflow.com/comment/45634994
type: QuestionComment
has text: Did you find a solution for this, I am facing the same problem.
score: 0
comment on: http://stackoverflow.com/q/25711409
type: Comment

http://stackoverflow.com/comment/39980310
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25595414
has text: What should happen instead of hiding keyboard?
score: 0

http://stackoverflow.com/a/25646536
has comment: http://stackoverflow.com/comment/40073175
answers question: http://stackoverflow.com/q/25646437
type: Answer
has comment: http://stackoverflow.com/comment/40109361
has comment: http://stackoverflow.com/comment/40074591
has comment: http://stackoverflow.com/comment/40108773
has comment: http://stackoverflow.com/comment/40073294
has body: Got it from here and modified it according to your needs. Credit goes fully to the original owner of this code. import java.text.DecimalFormat; public class EnglishNumberToWords { private static final String[] tensNames = { "", " ten", " twenty", " thirty", " forty", " fifty", " sixty", " seventy", " eighty", " ninety" }; private static final String[] numNames = { "", " one", " two", " three", " four", " five", " six", " seven", " eight", " nine", " ten", " eleven", " twelve", " thirteen", " fourteen", " fifteen", " sixteen", " seventeen", " eighteen", " nineteen" }; private EnglishNumberToWords() {} private static String convertLessThanOneThousand(int number) { String soFar; if (number % 100 &lt; 20){ soFar = numNames[number % 100]; number /= 100; } else { soFar = numNames[number % 10]; number /= 10; soFar = tensNames[number % 10] + soFar; number /= 10; } if (number == 0) return soFar; return numNames[number] + " hundred" + soFar; } public static String convert(long number) { // 0 to 999 999 999 999 if (number == 0) { return "zero"; } String snumber = Long.toString(number); // pad with "0" String mask = "000000000000"; DecimalFormat df = new DecimalFormat(mask); snumber = df.format(number); // XXXnnnnnnnnn int billions = Integer.parseInt(snumber.substring(0,3)); // nnnXXXnnnnnn int millions = Integer.parseInt(snumber.substring(3,6)); // nnnnnnXXXnnn int hundredThousands = Integer.parseInt(snumber.substring(6,9)); // nnnnnnnnnXXX int thousands = Integer.parseInt(snumber.substring(9,12)); String tradBillions; switch (billions) { case 0: tradBillions = ""; break; case 1 : tradBillions = convertLessThanOneThousand(billions) + " billion "; break; default : tradBillions = convertLessThanOneThousand(billions) + " billion "; } String result = tradBillions; String tradMillions; switch (millions) { case 0: tradMillions = ""; break; case 1 : tradMillions = convertLessThanOneThousand(millions) + " million "; break; default : tradMillions = convertLessThanOneThousand(millions) …
has comment: http://stackoverflow.com/comment/40108988
score: 0
has comment: http://stackoverflow.com/comment/40073250
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40109160
has comment: http://stackoverflow.com/comment/40073249
has comment: http://stackoverflow.com/comment/40108017
has comment: http://stackoverflow.com/comment/40074238

http://stackoverflow.com/comment/40012732
comment on: http://stackoverflow.com/q/25613028
type: Comment
type: QuestionComment
score: 0
has text: Yes, you are right, wondered why SimpleDateFormat did not throw an exception. Even updating the format for JodaTime, the same error message appears

http://stackoverflow.com/comment/40193996
type: Comment
type: AnswerComment
has text: @Eran Damn! Stupid typo... Thank you for pointing that out !
score: 1
comment on: http://stackoverflow.com/a/25712440

http://stackoverflow.com/comment/69590430
type: QuestionComment
comment on: http://stackoverflow.com/q/25560745
has text: Check this question for a solution: http://stackoverflow.com/questions/25359099/passing-list-of-boxed-primitives-to-google-cloud-endpoint
score: 0
type: Comment

http://stackoverflow.com/comment/40000465
comment on: http://stackoverflow.com/q/25606355
type: Comment
type: QuestionComment
has text: just return a Cursor
score: 0

http://stackoverflow.com/q/25658912
has comment: http://stackoverflow.com/comment/40096658
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/40096201
tagged with: eclipse
linked to: http://stackoverflow.com/q/24886557
has title: maven project in eclipse: different maven version issue
score: 0
answer count: 0
has body: I have java project which builds fine via: mvn clean install -DskipTests In my previous eclipse version (with m2e installed), when I used to import it as "mvn project", it used to work fine. But because of some problems i re-installed my OS. Now when I try to import it as "mvn project", it gives me following error: Issues with Eclipse setup on Ubuntu 12.04 Then I tried some more and built project as: mvn clean install -DskipTests eclipse:eclipse And tried importing it as mvn project. Now it imports fine, but I have some issues: The import still have some problem. Earlier it is showing all modules as different projects. But I wanted to import it as one project (earlier it used to get import as 1 project, which helps in navigation and putting breakpoints) Reason of this behavior?: Is this because of different version of two maven (command line and eclipse). If yes, how can i handle that. I anyway don't need to built project from eclipse.
tagged with: java
has comment: http://stackoverflow.com/comment/40097095
tagged with: import
type: Question

http://stackoverflow.com/q/25703243
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/40176502
tagged with: java
answer count: 1
has title: Problems with scanning
favorite count: 0
tagged with: excel
type: Question
has comment: http://stackoverflow.com/comment/40176603
has body: I'm studying Biomedical Informatics and I'm now doing my clinical practice, where I have to check that the charges made to hospitalized patients were performed correctly on supplies that are of unique charging (every procedure and supplies used have a codification). I can import the Excel file on the software I'm doing but, I don't know now how to do the scan. Here is the code (I'm doing it on NetBeans), public class Portal extends javax.swing.JFrame { private DefaultTableModel model; public static int con = 0; public ArrayList listas = new ArrayList(); public ArrayList listasr = new ArrayList(); public Portal() { initComponents(); model = new DefaultTableModel(); jTable1.setModel(model); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser examinar = new JFileChooser(); examinar.setFileFilter(new FileNameExtensionFilter("Archivos Excel", "xls", "xlsx")); int opcion = examinar.showOpenDialog(this); File archivoExcel = null; if(opcion == JFileChooser.APPROVE_OPTION){ archivoExcel = examinar.getSelectedFile().getAbsoluteFile(); try{ Workbook leerExcel = Workbook.getWorkbook(archivoExcel); for (int hoja=0; hoja&lt;leerExcel.getNumberOfSheets(); hoja++) { Sheet hojaP = leerExcel.getSheet(hoja); int columnas = hojaP.getColumns(); int filas = hojaP.getRows(); Object data[]= new Object[columnas]; for (int fila=0; fila &lt; filas; fila++) { for(int columna=0; columna &lt; columnas; columna++) { if(fila==0) { model.addColumn(hojaP.getCell(columna, fila).getContents()); } System.out.println(hojaP.getCell(columna, fila).getContents()); if(fila&gt;=1) data[columna] = hojaP.getCell(columna, fila).getContents(); }model.addRow(data); } } model.removeRow(0); JOptionPane.showMessageDialog(null, "Excel cargado exitosamente"); } } }
tagged with: netbeans
downvote count: 0
has answer: http://stackoverflow.com/a/25703578
upvote count: 1

http://stackoverflow.com/q/25581319
tagged with: database
has comment: http://stackoverflow.com/comment/39955116
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25581661
accepted answer: http://stackoverflow.com/a/25581661
has title: How To get All Rows in Mysql Database (Java)
has comment: http://stackoverflow.com/comment/39955221
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/39955085
has comment: http://stackoverflow.com/comment/39954746
type: Question
has body: So Sorry if this Looks newbie Question, Im not Skilled in Mysql, I need to Get Entries of All Rows in My Mysql Database like We Do with Sqlite in Android : Cursor mCursor = mDb.query("MyTable",new String[]{"My Column"},null,null.null,null); ArrayList&lt;&gt; mylist = new ArrayList&lt;&gt;(); do{ mylist.add(mCursor.getString(mCursor.getColumnIndex("_id"))); while(mCursor.moveToNext()); How does This Work in Mysql Guys?
has comment: http://stackoverflow.com/comment/39954710
answer count: 1

http://stackoverflow.com/q/25612277
has comment: http://stackoverflow.com/comment/40012269
tagged with: sockets
tagged with: java
accepted answer: http://stackoverflow.com/a/25612592
score: 4
has answer: http://stackoverflow.com/a/25612592
upvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40011070
answer count: 2
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40011248
has comment: http://stackoverflow.com/comment/40011398
downvote count: 0
has body: This is the first time I've ever created a multi-threaded application in Java that that will run continuously until canceled and I'm having trouble shutting down/interrupting my threads. I have some threads that communicate with a Mediator which encapsulates a TransferQueue, an ExecutorService, and facilitates communication between producing and consuming threads. I'm using this Mediator instead of Future because TransferQueue is a lot more block-friendly when it comes to a single consumer handling multiple producers (producer threads can mediator.put(E e) any time they want, and consumer threads can just wait on E e = mediator.take() for something to be available) and I do not want to waste CPU cycles polling. The design is very clean, fast, and effective, but I'm having trouble interrupting blocking on queue.take(), serverSocket.accept(), and interrupting the threads as a whole. The producers: public class SocketProducer implements Colleague<Socket> { private Mediator<Socket> mediator; private ServerSocket serverSocket; private Integer listeningPort; private volatile boolean runnable = true; public SocketProducer(Mediator<Socket> mediator) { this.mediator = mediator; } public Colleague<Socket> setListeningPort(Integer listeningPort) { this.listeningPort = listeningPort; return this; } public Void call() throws Exception { serverSocket = new ServerSocket(listeningPort, 10); while (runnable) { Socket socket = serverSocket.accept(); // blocks until connection mediator.putIntoQueue(socket); } return null; } public void interrupt() { // ? runnable = false; serverSocket.close(); // ? } } and the consumer: private class SocketConsumer implements Colleague<Socket> { private Mediator<Socket> mediator; private volatile boolean runnable = true; public SomeConsumer(Mediator<Socket> mediator) { this.mediator = mediator; } public Void call() throws Exception { while (runnable) { Socket socket = mediator.takeFromQueue(); // blocks until element is in queue } return null; } publi…
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/2983835
has title: How to interrupt Callable threads that are blocked inside a loop?
possible better answer: http://stackoverflow.com/a/25612572
has answer: http://stackoverflow.com/a/25612572

http://stackoverflow.com/comment/40050058
comment on: http://stackoverflow.com/q/25633231
type: Comment
type: QuestionComment
has text: The logs of the spring app when it tries to connect to the active mq broker
score: 0

http://stackoverflow.com/q/25649288
tagged with: scala
tagged with: thrift-protocol
has answer: http://stackoverflow.com/a/25656212
upvote count: 5
possible better answer: http://stackoverflow.com/a/25652973
tagged with: thrift
has title: Can generate .thrift files from existing java/scala interfaces and data types?
type: AnsweredQuestion
answer count: 3
tagged with: java
downvote count: 0
has body: Is there an easy way to take existing Java/scala datatypes and API interfaces and produce corresponding .thrift files? Having Thrift generate server data structures is excessively invasive as it has the consequences: I cannot annotate my data structures (e.g. for, XML, JSON, hibernate persistence, ...) this pattern conflicts with other serialization frameworks that want to own, or require modification of my source files. As a result, its seems like thrift forces itself into being the exclusive persistence format for my server -- unless, that is, I create a data-marshalling wrapper around Thrift or the other my persistence formats that deal with these data structures (hibernate, Jackson, scala BeanProperty, ...). However, this defeats the purpose of an automated data-marshalling tool such as thrift and leads straight to the error-prone world of having to maintain identical-but-separate interfaces and data-structures (= waste of talented engineer time and energy). I'm totally happy with Thrift auto-generating client code. However, I (strongly) feel that I need the freedom to edit the data structures my server deals with in the APIs.
has answer: http://stackoverflow.com/a/25652973
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25651535
score: 5
accepted answer: http://stackoverflow.com/a/25656212

http://stackoverflow.com/a/25667700
answers question: http://stackoverflow.com/q/25667491
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25667491
downvote count: 0
has body: If you create EmployeeDAO employeeDAO=new EmployeeDAO(); in this way the attribute HibernateTemplate is null. try to change EmployeeDAO employeeDAO=new EmployeeDAO(); in EmployeeDAO employeeDAO= (EmployeeDAO) context.getBean("employeeDAO");
score: 1
type: Answer

http://stackoverflow.com/comment/39913326
comment on: http://stackoverflow.com/a/25559318
score: 0
type: Comment
type: AnswerComment
has text: I'm not using a tomcat instance on my pc, I'm installed it to another projects, but for this im using a rented server with BlueHost

http://stackoverflow.com/a/25603254
accepted answer of: http://stackoverflow.com/q/25603090
upvote count: 1
has comment: http://stackoverflow.com/comment/40000731
has comment: http://stackoverflow.com/comment/40002554
answers question: http://stackoverflow.com/q/25603090
type: Answer
has body: You're attempting to add your RadioGroup to a new layout that you create dynamically before removing it from its existing layout... ll.addView(rg); The above line takes the RRG RadioGroup and adds it to the dynamically created LinearLayout, but it already exists within the LinearLayout defined in your xml layout. Either create your RadioGroup dynamically (e.g. in code) or remove it from its parent before attempting to add it to your new layout e.g. try the following... ((LinearLayout)rg.getParent()).removeView(rg); ll.addView(rg);
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25704860
has answer: http://stackoverflow.com/a/25704993
has comment: http://stackoverflow.com/comment/40179826
tagged with: android
tagged with: java
answer count: 1
has title: Add new Button to LinearLayout at Runtime in Android
has comment: http://stackoverflow.com/comment/40179810
type: Question
has comment: http://stackoverflow.com/comment/40179598
upvote count: 0
has body: I want to add new Button at runtime with all properties as in following. &lt;LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:orientation="horizontal" &gt; &lt;Button android:id="@+id/btnMM" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/android_btn_md" android:gravity="center" android:onClick="btnMMClick" android:text="M-" android:textColor="#000000" android:textSize="25sp" android:textStyle="bold" /&gt; ...... more buttons at design time are here ..... Thanks, Ashok
has comment: http://stackoverflow.com/comment/40180047
accepted answer: http://stackoverflow.com/a/25704993
downvote count: 5
favorite count: 0
type: AnsweredQuestion
score: -5

http://stackoverflow.com/q/25597831
has body: The following Radix sort does four passes of counting sort (256 buckets, 32-bit integers, starting from lowest significant digits), taken from Sedgewick's Algorithms textbook. public class LSD { private final static int BITS_PER_BYTE = 8; // LSD sort an array of integers, treating each int as 4 bytes // assumes integers are nonnegative // [ 2-3x faster than Arrays.sort() ] public static void sort(int[] a) { int BITS = 32; // each int is 32 bits int W = BITS / BITS_PER_BYTE; // each int is 4 bytes int R = 1 &lt;&lt; BITS_PER_BYTE; // each bytes is between 0 and 255 int MASK = R - 1; // 0xFF int N = a.length; int[] aux = new int[N]; for (int d = 0; d &lt; W; d++) { // compute frequency counts int[] count = new int[R+1]; for (int i = 0; i &lt; N; i++) { int c = (a[i] &gt;&gt; BITS_PER_BYTE*d) &amp; MASK; count[c + 1]++; } // compute cumulates for (int r = 0; r &lt; R; r++) count[r+1] += count[r]; // for most significant byte, 0x80-0xFF comes before 0x00-0x7F if (d == W-1) { int shift1 = count[R] - count[R/2]; int shift2 = count[R/2]; for (int r = 0; r &lt; R/2; r++) count[r] += shift1; for (int r = R/2; r &lt; R; r++) count[r] -= shift2; } // move data for (int i = 0; i &lt; N; i++) { int c = (a[i] &gt;&gt; BITS_PER_BYTE*d) &amp; MASK; aux[count[c]++] = a[i]; } // copy back for (int i = 0; i &lt; N; i++) a[i] = aux[i]; } } I understand most of the code except for this part: if (d == W-1) { int shift1 = count[R] - count[R/2]; int shift2 = count[R/2]; for (int r = 0; r &lt; R/2; r++) count[r] += shift1; for (int r = R/2; r &lt; R; r++) count[r] -= shift2; } What's the purpose of this segment of code? Thanks!
favorite count: 0
type: Question
tagged with: bit-manipulation
answer count: 1
downvote count: 0
tagged with: sorting
score: 4
has answer: http://stackoverflow.com/a/25598112
accepted answer: http://stackoverflow.com/a/25598112
type: AnsweredQuestion
tagged with: algorithm
tagged with: radix-sort
tagged with: java
upvote count: 4
has title: Questions on an implementation of Radix sort in Java

http://stackoverflow.com/q/25560883
possible better answer: http://stackoverflow.com/a/25564953
has comment: http://stackoverflow.com/comment/39916191
has body: I was trying to refactor a code snippet I found online for a picture program, and I was just wondering if anyone could help me out. The author of the original code chose to use nested for loops, which I know isn't correct. Any ideas to help me work it out? for (int x = 0; x &lt; this.width(); x++) { for (int y = 0; y &lt; this.height(); y++) { if (!this.getColor(x, y).equals(typeCastedPicture.getColor(x, y))) { return false; } } } I initially just tried using private methods as the solution; however, the problem I'm running into is because it's of type boolean. I'm just not certain how to refactor properly without skewing the semantics. Any help would be greatly appreciated. The code works 100% correctly as is; however I'm currently using eclipse and the checkstyle flags any time you code in nested blocks. I just wanted to see if any of you guys could help me figure out how to get the same effect without using nested loops.
type: AnsweredQuestion
answer count: 3
has comment: http://stackoverflow.com/comment/39916207
tagged with: refactoring
tagged with: java
downvote count: 3
tagged with: boolean-logic
has answer: http://stackoverflow.com/a/25560974
favorite count: 0
type: Question
tagged with: for-loop
score: -2
has comment: http://stackoverflow.com/comment/39916568
has answer: http://stackoverflow.com/a/25561613
accepted answer: http://stackoverflow.com/a/25561613
upvote count: 1
has answer: http://stackoverflow.com/a/25564953
has title: Refactoring nested For-Loops

http://stackoverflow.com/comment/40022232
comment on: http://stackoverflow.com/a/25617702
type: AnswerComment
has text: I would be happy if you use the getter instead the field `children`.
score: 0
type: Comment

http://stackoverflow.com/a/25611583
type: Answer
accepted answer of: http://stackoverflow.com/q/25597916
score: 0
type: AcceptedAnswer
has body: Call formatMessage from the Formatter class (or copy and adjust it for your needs), e.g.: public class LogFormatter extends Formatter { @Override public String format(LogRecord record) { return new Date(record.getMillis()) + " " + record.getLevel() + ": " + super.formatMessage(record) + "\n"; } } See comment for format method on http://docs.oracle.com/javase/7/docs/api/java/util/logging/Formatter.html: public abstract String format(LogRecord record) Format the given log record and return the formatted string. The resulting formatted String will normally include a localized and formatted version of the LogRecord's message field. It is recommended to use the formatMessage(java.util.logging.LogRecord) convenience method to localize and format the message field.
answers question: http://stackoverflow.com/q/25597916

http://stackoverflow.com/a/25584497
downvote count: 0
has body: Since you asked for other environment as well and If you are willing to leave Java, clustering is pretty easy using scipy package in python. Eg, you can look at scipy.cluster.hierarchy
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25581445
score: 1

http://stackoverflow.com/q/25626189
has title: How to make master detail relation (sub-report) in Birt designer with POJO data set?
has body: My birt report uses POJO data source. Here is my POJOs, getters and setters have been omitted for simplicity sake: public class Author{ String name; String email; List&lt;Book&gt; books; } public class Book{ String title; String genre; Date publishDate; } My POJO data set is based on Author class. Now I want to make one table which will list all Authors and all his books. I've reviewed included to BIRT example report under the Sub Report folder. It does what I want but with JDBC data set. I can't figure out how to do the same but with POJO data set. Any help much appreciated!
score: 1
tagged with: birt
tagged with: java
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/46907610
upvote count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27648784
tagged with: pojo

http://stackoverflow.com/q/25597902
tagged with: java
has comment: http://stackoverflow.com/comment/40005707
has comment: http://stackoverflow.com/comment/40004535
type: Question
tagged with: google-maps-android-api-2
has comment: http://stackoverflow.com/comment/40006117
has comment: http://stackoverflow.com/comment/39985636
type: UnansweredQuestion
tagged with: autocomplete
tagged with: android
has title: Place Auto-complete implementation
has comment: http://stackoverflow.com/comment/39994738
has comment: http://stackoverflow.com/comment/39985906
score: 0
has comment: http://stackoverflow.com/comment/40007080
answer count: 0
has comment: http://stackoverflow.com/comment/40005367
has body: I've got this code for one of my activities that is supposed to give the option to autocomplete with an address as the user starts typing, but it crashes when trying to start the activity. package com.reachmenow; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.Filter; import android.widget.Filterable; import android.widget.ListView; import android.widget.TabHost; import android.widget.TabHost.TabSpec; public class JoinMeNow extends Activity { private static final String LOG_TAG = "ExampleApp"; private static final String PLACES_API_BASE = "https://maps.googleapis.com/maps/api/place"; private static final String TYPE_AUTOCOMPLETE = "/autocomplete"; private static final String OUT_JSON = "/json"; private static final String API_KEY = "AIzaSyAZQpyuuupl4aRHAzfxkaV4jlAmM9nRwxA"; ListView listView1, listView2; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_now); String[] contacts = { "ex1", "ex2" }; String[] recent = { "first", "second" }; TabHost th = (TabHost) findViewById(R.id.tab_host); th.setup(); // tab1 TabSpec recentLocationsTab = th.newTabSpec("tab1"); recentLocationsTab.setContent(R.id.recent_locations_tab); recentLocationsTab.setIndicator("Recent"); th.addTab(recentLocationsTab); // tab2 TabSpec allFriendsTab = th.newTabSpec("tab2"); allFriendsTab.setContent(R.id.all_friends_tab); allFriendsTab.setIndicator("All Friends"); th.addTab(allFriendsTab); ArrayAdapter&lt;String&gt; adapter1 = new ArrayAdapter&lt;String&gt;(this, android.…

http://stackoverflow.com/a/25561933
answers question: http://stackoverflow.com/q/25561865
type: Answer
has body: u want to launch a new activity and pass the label value to that ? if yes then just create an Intent and add the value to it , and use this intent to launch other acitivty. for example if your value is "5" then :- Intent intent = new Intent(context) ; intent.putExtra("key","5"); (refer here) startActivity(intent); and at onCreate() method of newly launched activity :- String value= getIntent.getStringExtra("key"); (Refer here )
score: 0

http://stackoverflow.com/a/25589099
answers question: http://stackoverflow.com/q/25589031
score: 1
type: Answer
downvote count: 0
upvote count: 1
has body: As you are using a select query replace this state.executeUpdate(); with ResultSet rs = state.executeQuery() then check if records exists with the specified username and password like this if (!rs.next() ) { System.out.println("Not valid username and password"); } else { do { System.out.println(rs.getString(1)+" "+ rs.getString(2); } while (resultSet.next()); }

http://stackoverflow.com/a/61769442
has body: I have install chromedriver throw mac terminal, then add this code to java class; it work for me. WebDriver driver; @Test public void test() throws MalformedURLException { WebDriver driver = new RemoteWebDriver(new java.net.URL("http://localhost:9515"), DesiredCapabilities.chrome()); driver.get("https://www.facebook.com"); driver.findElement(By.name("email")).sendKeys("hello world"); }
upvote count: 1
answers question: http://stackoverflow.com/q/25616227
has comment: http://stackoverflow.com/comment/109258451
type: Answer
score: 1
downvote count: 0

http://stackoverflow.com/comment/40106954
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25665052
type: AnswerComment
has text: But where? I only have vfs2 libraries. As you can see in the above StackTrace - it is the vfs2 Loader that automatically tries to load a vfs class...

http://stackoverflow.com/a/25655259
has comment: http://stackoverflow.com/comment/40113329
score: 0
has comment: http://stackoverflow.com/comment/40126328
has comment: http://stackoverflow.com/comment/40091081
answers question: http://stackoverflow.com/q/25650629
has body: Judging by the example refactoring that you posted, your problem is that you are attempting to redefine an existing method, without correctly overloading it. This is evident in the error message The method assertEquals(String) in the type LoginPageTests is not applicable for the arguments (String, String) You can see that the refactored assertEquals(String) method which you are defining is in conflict with the existing assertEquals(String, String) method that you call within it. You can remedy this by defining your method with a different name, or overloading it, which will allow two methods with the same name, but different signatures: @Overload public void assertEquals(String textValue) { assertEquals(textValue, textError); }
type: Answer
has comment: http://stackoverflow.com/comment/40091175

http://stackoverflow.com/comment/40137435
comment on: http://stackoverflow.com/q/25679963
type: QuestionComment
has text: You are using a local cluster as a jar exec? When you use "storm jar ..." you are using the cluster mode. So did you check the file storm.log.properties on your storm install dir / log4j in your server ? When you submit a topology in cluster mode, storm is already running and writing logs, maybe you can't overwrite log4j at runtime, so modifying the storm log4j file before should work in all cases.
score: 0
type: Comment

http://stackoverflow.com/comment/40139592
comment on: http://stackoverflow.com/q/25683055
has text: http://thinkandroid.wordpress.com/2010/01/09/simplecursoradapters-and-listviews/
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40148874
type: Comment
comment on: http://stackoverflow.com/a/25687272
has text: I'm not convinced that this is *required*, but I believe it was used by accident in lack of a `Pair` class.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40129246
type: QuestionComment
comment on: http://stackoverflow.com/q/25677386
has text: That doesn't look like the full stack trace. Please post the rest of it.
score: 2
type: Comment

http://stackoverflow.com/comment/39996860
has text: I have Linux OS (Backtrack) and x86 JVM with x86 system
comment on: http://stackoverflow.com/a/25604289
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/25646236
answer count: 2
has body: Here is a little a example: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { int x = 0; while (jProgressBar1.getValue() &lt; 100) { try { Thread.sleep(50); x++; jProgressBar1.setValue(x); jProgressBar1.repaint(); } catch (InterruptedException ex) { Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); } System.out.println(jProgressBar1.getValue()); } } System.out.println(jProgressBar1.getValue()); returns digits to IDE output, but jProgressBar1 doesn't draw this value. What's wrong with this code? Please help.
downvote count: 0
upvote count: 1
tagged with: swing
favorite count: 0
has comment: http://stackoverflow.com/comment/40073093
possible better answer: http://stackoverflow.com/a/25646425
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40073444
accepted answer: http://stackoverflow.com/a/25646450
tagged with: thread-sleep
has comment: http://stackoverflow.com/comment/40073114
has answer: http://stackoverflow.com/a/25646425
score: 1
has title: Progress Bar with Thread (Java Swing)
has answer: http://stackoverflow.com/a/25646450
tagged with: java
type: Question

http://stackoverflow.com/q/25587425
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25587444
accepted answer: http://stackoverflow.com/a/25587444
has title: Turning printing out by using contains() as oppose to matches() using the same print format
type: Question
has body: The code below prints out "Yes" if it finds the words "hello" and "goodbye" in the String variable text in that order. My question is, is it possible to replace the matches method with the contains method in the same system.out.println format? Or, at least something similar like that? System.out.println(text.matches("(?i)^.*\\bhello\\b.*\\bgoodbye\\b.*$") ? "Yes" : "No"));
answer count: 2
possible better answer: http://stackoverflow.com/a/25587460
has answer: http://stackoverflow.com/a/25587460
type: AnsweredQuestion

http://stackoverflow.com/a/60748448
has body: Static Abstract All Other InstanceM N Y Y ConcreteM Y N Y All Y Y Y
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25586990
score: 1
type: Answer

http://stackoverflow.com/comment/50624805
type: Comment
type: AnswerComment
has text: Hi @Ricardo, It was a long time ago. AFAIR, I didn't find a way to determine connection closing by client. I changed my code without the infinite loop.
score: 1
comment on: http://stackoverflow.com/a/25634234

http://stackoverflow.com/comment/70708005
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/41757999
score: 0
has text: The question is 2 years old.

http://stackoverflow.com/comment/39983351
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25597006
score: 0
has text: have you read this? http://stackoverflow.com/questions/2417485/file-separator-vs-slash-in-paths

http://stackoverflow.com/q/25600758
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25601298
tagged with: java
tagged with: io
has comment: http://stackoverflow.com/comment/39993481
has comment: http://stackoverflow.com/comment/39990069
has comment: http://stackoverflow.com/comment/39990084
score: -1
has comment: http://stackoverflow.com/comment/39990066
has comment: http://stackoverflow.com/comment/39990384
has comment: http://stackoverflow.com/comment/39990382
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39990143
upvote count: 0
has answer: http://stackoverflow.com/a/25601298
answer count: 2
has body: I am new to SO, I have designed a form in java, I added three buttons Submit, Clear and Show Record. I need to get data on submit event and pass it to txt file, and i want to show whole record on show record button click event. I need quick fix by you people, I am running out of time. Here is my Code: import java.awt.*; //import older gui library for content pane import javax.swing.*; //import newer gui library for labels, textfields, and button import java.awt.event.*; //import gui event action library import javax.swing.JRadioButton; public class CustomerRecord extends JFrame implements ActionListener { // declare labels used on GUI screen private JLabel labelId, labelName, labelGender,labelcategory, labelPItem, labeldiscount; private JLabel labelError, labelRegistration; private JTextField textId, textName, textGender, textState, textcategory, textPItem, textdiscount; // declare button used on GUI screen private JButton submitButton, clearButton, readButton; final JRadioButton jRadioMale = new JRadioButton("Male"); final JRadioButton jRadioFemale = new JRadioButton("Female"); // declare content pane private Container contentPane; public CustomerRecord() { createGUI(); } // ends constructor private void createGUI() { try { // get content pane and set the layout to null contentPane = getContentPane(); contentPane.setLayout(null); //free-form layout setFont(new Font("TimesRoman", Font.ITALIC, 14)); // create the name label labelId = new JLabel(); //instantiate new JLabel labelId.setText("C.ID"); //set label text to name labelId.setLocation(38, 10); //set location of JLabel labelId.setSize(200, 25); //set size of JLabel labelId.setForeground(Color.BLACK);//set initial background color contentPane.add(labelId); //add JLabel to content pane // create the name text box textName = new JTextField(); //instantiate new JTextField textName.setText(""); //clear JTextField textName.setToolTipText("Please enter ID"); textName.setLocation(75, 10); //set location of JTextFfield t…
downvote count: 1
has comment: http://stackoverflow.com/comment/39993512
tagged with: swing
has comment: http://stackoverflow.com/comment/39990153
has comment: http://stackoverflow.com/comment/39990217
has answer: http://stackoverflow.com/a/25603436
has title: How to write and read data in txt file in java
accepted answer: http://stackoverflow.com/a/25603436

http://stackoverflow.com/q/25650911
answer count: 1
type: Question
has title: libgdx double tap or other gesture
tagged with: libgdx
type: UnansweredQuestion
tagged with: android
has body: I'm working on a game, and I would want the player to be able to increase the speed by double tapping the screen, my problem: Since the player moves by pressing the screen once (you press to the left to move left, and right to move right) will there be a delay for the program to see if the screen was pressed once or twice, or will the player first start by going normal speed, then speed up if it detects another tap? This is how my movement looks atm: touchPos.set(Gdx.input.getX() - 42, Gdx.input.getY() + 19, 0); camera.unproject(touchPos); if (Gdx.input.isTouched()) { if (player.getX() &gt; touchPos.x + 16) { player.setPosition(player.getX() - (speed * Gdx.graphics.getDeltaTime()), player.getY() + (130 * Gdx.graphics.getDeltaTime())); } else if (player.getX() &lt; touchPos.x - 16) { player.setPosition(player.getX() + (speed * Gdx.graphics.getDeltaTime()), player.getY() + (130 * Gdx.graphics.getDeltaTime())); } And this works just fine, but how should I implement so the player can speed up with a simple gesture? Thoughts? (let me know if I need to elaborate, or post more code)
has comment: http://stackoverflow.com/comment/40081433
has comment: http://stackoverflow.com/comment/40112208
has comment: http://stackoverflow.com/comment/40094873
linked to: http://stackoverflow.com/q/937313
has comment: http://stackoverflow.com/comment/40086043
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/28766947

http://stackoverflow.com/q/25600061
has comment: http://stackoverflow.com/comment/39988905
has comment: http://stackoverflow.com/comment/39988814
type: UnansweredQuestion
has body: I know that Java wouldn't allow us to define a top-level class as private, I saw answers in other questions claiming that it would be useless, but why useless? lets say I want a class which manages the employees' wage, and I don't want anyone to access this class and I don't need any other helper class, what is the problem defining it as private?
score: -3
has comment: http://stackoverflow.com/comment/39988685
has comment: http://stackoverflow.com/comment/39988954
has comment: http://stackoverflow.com/comment/40258789
has comment: http://stackoverflow.com/comment/39988755
downvote count: 3
has answer: http://stackoverflow.com/a/25600350
has comment: http://stackoverflow.com/comment/39988808
has answer: http://stackoverflow.com/a/25600123
has comment: http://stackoverflow.com/comment/40260619
has comment: http://stackoverflow.com/comment/39988691
has title: Private class usage
tagged with: java
has comment: http://stackoverflow.com/comment/40240924
has comment: http://stackoverflow.com/comment/39988868
has comment: http://stackoverflow.com/comment/39988893
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40260486
upvote count: 0
has comment: http://stackoverflow.com/comment/40276881
answer count: 2

http://stackoverflow.com/comment/40133416
type: Comment
comment on: http://stackoverflow.com/a/25679384
score: 0
type: AnswerComment
has text: I will suggest Mysql database, because its much easier to learn, widely used and can does everything that you need.

http://stackoverflow.com/a/25579970
upvote count: 5
type: Answer
has body: Open 'Window > Preferences > Java > Installed JREs' and check that the JRE/JDK you want to use is listed - add it if it is missing. Open 'Window > Preferences > Java > Installed JREs > Execution Environments' and look at the entry for 'JavaSE-1.6'. Change the 'Compatible JRE' to the one you want to use.
answers question: http://stackoverflow.com/q/25577900
accepted answer of: http://stackoverflow.com/q/25577900
type: AcceptedAnswer
downvote count: 0
score: 5
has comment: http://stackoverflow.com/comment/39959955

http://stackoverflow.com/comment/39990675
score: 0
type: Comment
type: AnswerComment
has text: Ok I've done that, however the system is now stating that `The import org.springframework.context cannot be resolved`.
comment on: http://stackoverflow.com/a/25587320

http://stackoverflow.com/comment/39971661
type: Comment
comment on: http://stackoverflow.com/q/25590129
type: QuestionComment
score: 0
has text: You need to stop when `delta == 0` even if the transfer isn't complete.

http://stackoverflow.com/a/25642511
answers question: http://stackoverflow.com/q/25641985
has comment: http://stackoverflow.com/comment/40069166
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/25641985
has comment: http://stackoverflow.com/comment/40066523
type: AcceptedAnswer
has body: Handle it on client side using Json.parse(). Pass above Java String as JavaScript String then parse that String on client side var str="{\"languageID\":0,\"test1\":14,\"loginID\":\"LKS280\",\"errorCategory\":0,\"replyTopic\":null,\"errorCode\":0,\"sessionType\":null,\"sessionKey\":\"LKS2801409739957847\",\"creationTime\":\"Wed Sep 03 15:55:57 IST 2014\",\"messageType\":3,\"version\":\"1.0.0\"}"; var obj=JSON.parse(str); //parse string to json Here's the demo fiddle http://jsfiddle.net/vikrant47/e26t6LjL/ or Replace all \ whith "" new JSONObject(responseDTO.getDTOHeader()).toString().replaceAll("\\","");

http://stackoverflow.com/q/25675138
has answer: http://stackoverflow.com/a/25675211
answer count: 1
tagged with: jar
has title: Issues with imports/library?
has comment: http://stackoverflow.com/comment/40125256
tagged with: queue
has body: I am working on an assignment for class: Josephus problem. In the Josephus problem from antiquity, N people are in dire straits and agree to the following strategy to reduce the population. They arrange themselves in a circle (at positions numbered from 0 to N???1) and proceed around the circle, eliminating every Mth person until only one person is left. Legend has it that Josephus figured out where to sit to avoid being eliminated. Write a Queue client Josephus.java that takes M and N from the command line and prints out the order in which people are eliminated (and thus would show Josephus where to sit in the circle). My code is as follows : package josephus; import java.util.Queue; public class Josephus { public static void main(String[] args) { int n = Integer.parseInt(args[0]), m = Integer.parseInt(args[1]); Queue&lt;Integer&gt; q = new Queue&lt;Integer&gt;(); for (int i = 0; i &lt; n; i++) q.enqueue(new Integer(i)); int k = 0; while (!q.isEmpty()) { int x = q.dequeue(); if (++k % m == 0) StdOut.print(x + " "); else q.enqueue(x); } StdOut.println(); } } When I run it in NetBeans it gives me errors stating that: Queue is abstract; cannot be instantiated enqueue: Cannot find symbol dequeue: Cannot find symbol StdOut: Cannot find symbol I thought that by importing the java.util.Queue would make the Queue work and for the StdOut I did download a stdlib.jar to add to the projects library which inculdes StdOut and I thought that would work. If there is a problem with my code or anything else I need to do, I would really appreciate the help. Also, for reference and to see where I got the stdlib.jar, here is the link for the textbooks website from where this problem comes from : http://algs4.cs.princeton.edu/13stacks/ (The Josephus problem is #37 under the "Creative problems section" towards the end.
type: Question
tagged with: josephus
has comment: http://stackoverflow.com/comment/40125232
tagged with: stdout
has comment: http://stackoverflow.com/comment/40125170
has comment: http://stackoverflow.com/comment/40125355
has comment: http://stackoverflow.com/comment/40126309
linked to: http://stackoverflow.com/q/4626812
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25675211
tagged with: java

http://stackoverflow.com/comment/40034171
comment on: http://stackoverflow.com/q/25622515
type: Comment
type: QuestionComment
has text: I already did the debugging. The newValue contains exactly the same value as the constant. Also I inserted a newValue.equals(constant) and its true.
score: 0

http://stackoverflow.com/q/25591291
has body: I found this code for playing mp3 in java and I want to stream this in a network using UDP so I want to convert the mp3 file to byte so I can send it using DatagramPacket. What should I convert to do this? I will be needing to send 60Kbyte of buffer to the datagrampacket. import javazoom.jl.player.advanced.*; public class JLayerTest { public static void main(String[] args) { SoundJLayer soundToPlay = new SoundJLayer("Test.mp3"); soundToPlay.play(); } } class SoundJLayer extends PlaybackListener implements Runnable { private String filePath; private AdvancedPlayer player; private Thread playerThread; public SoundJLayer(String filePath) { this.filePath = filePath; } public void play() { try { String urlAsString = "file:\\C:\\Users\\Lorenz Kyle\\Desktop\\CODES by Lo\\Case 4\\Server\\Mp3MulticastServer\\src\\test.mp3"; this.player = new AdvancedPlayer ( new java.net.URL(urlAsString).openStream(), javazoom.jl.player.FactoryRegistry.systemRegistry().createAudioDevice() ); this.player.setPlayBackListener(this); this.playerThread = new Thread(this, "AudioPlayerThread"); this.playerThread.start(); } catch (Exception ex) { } } // PlaybackListener members public void playbackStarted(PlaybackEvent playbackEvent) { System.out.println("playbackStarted"); } public void playbackFinished(PlaybackEvent playbackEvent) { System.out.println("playbackEnded"); } // Runnable members public void run() { try { this.player.play(); } catch (javazoom.jl.decoder.JavaLayerException ex) { ex.printStackTrace(); } } }
type: Question
tagged with: jlayer
score: 2
has title: converting mp3 to byte in java
answer count: 0
upvote count: 2
type: UnansweredQuestion
downvote count: 0
favorite count: 0
tagged with: java

http://stackoverflow.com/a/53368521
upvote count: 12
answers question: http://stackoverflow.com/q/25592084
downvote count: 0
has comment: http://stackoverflow.com/comment/129001104
has body: Use this for any binary string length: String hexString = new BigInteger(binaryString, 2).toString(16);
type: Answer
score: 12

http://stackoverflow.com/comment/40047535
type: QuestionComment
has text: possible duplicate of [Why emma doesn't give full coverage to finally blocks?](http://stackoverflow.com/questions/4841882/why-emma-doesnt-give-full-coverage-to-finally-blocks)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25631912

http://stackoverflow.com/comment/40173776
comment on: http://stackoverflow.com/a/25701586
score: 0
type: Comment
type: AnswerComment
has text: That worked! Thought that might have been the issue but was worried about having to declare everything as static in order for it to work. Ended up not being a problem. Thanks again

http://stackoverflow.com/comment/39906542
comment on: http://stackoverflow.com/a/25555813
score: 1
type: Comment
type: AnswerComment
has text: I've already tried that and maven is already installed, it gives the same error

http://stackoverflow.com/q/25577452
has answer: http://stackoverflow.com/a/25577536
score: 1
tagged with: java
tagged with: jax-rs
has title: JAX-RS "Faked" headers in local development
has body: This question has two questions: Can I set a flag for local development versus production? Can I alter/add headers before they get to the request handler? For context, in production there will be a proxy which sets certain request headers before they make it to the JAX-RS request handler. For local development, I would like a to modify the request before it makes it to the request handler and add the headers that we will have in production. With Django, we would just set DEBUG = True and then have a "middleware" that would modify the request headers based on the flag. Is there similar facility in the Java/JAX-RS world? Any suggestion about how this sort of thing is done is welcome.
accepted answer: http://stackoverflow.com/a/25577536
type: Question
tagged with: jersey
downvote count: 0
answer count: 1
upvote count: 1
tagged with: web-services
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/q/25627206
upvote count: 2
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40039125
has body: I use NDK in eclipse. This is my NativeLib in java: public class NativeLib { public native String enCode(String src); static { System.loadLibrary("HelloWorld"); } public native String deCode(String src); } This is C source: #include &lt;string.h&gt; #include &lt;jni.h&gt; #include &lt;stdio.h&gt; jstring Java_com_example_helloworld_NativeLib_enCode(JNIEnv* env, jobject thiz, jstring src) { ... return (*env)-&gt;NewStringUTF(env, result); } jstring Java_com_example_helloworld_NativeLib_deCode(JNIEnv* env, jobject thiz, jstring src) { ... return (*env)-&gt;NewStringUTF(env, result); } My project run normally in android 4.2 but in android 4.3(Tablet ASUS K012) It get error like below java.lang.UnsatisfiedLinkError: Couldn't load HelloWorld from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.helloworld-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.helloworld-2, /vendor/lib, /system/lib, /system/lib/arm]]]: findLibrary returned null Can anyone help me?
type: UnansweredQuestion
tagged with: java
answer count: 1
has title: java.lang.UnsatisfiedLinkError: Couldn't load from loader findLibrary returned null
favorite count: 0
tagged with: android-ndk
type: Question
has comment: http://stackoverflow.com/comment/57636061
has answer: http://stackoverflow.com/a/25650290
tagged with: android
has comment: http://stackoverflow.com/comment/40130200

http://stackoverflow.com/comment/40100602
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25660816
has text: @amit I had to think of the same problem anyway. Of course, there was no constraint on alphabetical order there but I am pretty sure that solutions to that post can be used here.

http://stackoverflow.com/comment/40161657
has text: Yes I am, it all worked fine when I was using one spritebatch per texture, but then I read that it could all be done with one so that I could use the camera, so I switched it to use just one batch, and thats how it broke, if that helps?
type: AnswerComment
comment on: http://stackoverflow.com/a/25689867
score: 0
type: Comment

http://stackoverflow.com/comment/40170050
type: Comment
has text: umm... It makes error -> (java.lang.IllegalArgumentException: y must be >= 0)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25699365

http://stackoverflow.com/comment/40081019
comment on: http://stackoverflow.com/a/25650507
type: Comment
score: 0
type: AnswerComment
has text: org.apache.maven.plugins maven-surefire-report-plugin 2.17 false

http://stackoverflow.com/comment/39989827
type: Comment
type: QuestionComment
has text: is your ftp server running?
comment on: http://stackoverflow.com/q/25600633
score: 0

http://stackoverflow.com/comment/39977402
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25590303
has text: yes I have done a maven build and got build success.I followed the normal deployment procedure in JBoss7.By adding the project to the server my project got deployed.
score: 0

http://stackoverflow.com/comment/40028847
comment on: http://stackoverflow.com/q/25621691
score: 0
type: Comment
type: QuestionComment
has text: Hi! Yes, I know Java (it's beautiful!) but I see some tutorial but I can't create a correct class to link at JSON result. Can you help me? Is there a tutorial to know how connect to Yahoo-JSON result? Thanks!

http://stackoverflow.com/a/25654321
answers question: http://stackoverflow.com/q/25654232
accepted answer of: http://stackoverflow.com/q/25654232
has body: There is a getParameterMap() method you can get from your request that gives you what you want, you could then switch on the values. Here is a quick tutorial on said method: http://www.javatutorials.co.in/servlet-getparametermap-example/ for (Map.Entry&lt;String, String[]&gt; entry : request.getParameterMap().entrySet()) { switch(entry.getKey()) { // do stuff } } That being said, is there a reason you're accessing the request directly, and not using some variety of MVC? This type of use case is quite trivial inside most MVC frameworks.
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/40175339
has comment: http://stackoverflow.com/comment/40224943
type: AcceptedAnswer

http://stackoverflow.com/q/25675542
downvote count: 0
tagged with: eclipse
tagged with: entitymanager
has body: I have spring application everytime I run and I try to login I got the following excpetion after login java.lang.IllegalStateException: Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?) at com.emc.fleet.domain.User_Roo_Jpa_ActiveRecord.ajc$interMethod$com_emc_fleet_domain_User_Roo_Jpa_ActiveRecord$com_emc_fleet_domain_User$entityManager(User_Roo_Jpa_ActiveRecord.aj:19) at com.emc.fleet.domain.User.entityManager(User.java:1) at com.emc.fleet.domain.User_Roo_Jpa_ActiveRecord.ajc$interMethodDispatch1$com_emc_fleet_domain_User_Roo_Jpa_ActiveRecord$com_emc_fleet_domain_User$entityManager(User_Roo_Jpa_ActiveRecord.aj) at com.emc.fleet.domain.User_Roo_Finder.ajc$interMethod$com_emc_fleet_domain_User_Roo_Finder$com_emc_fleet_domain_User$findUsersByUserIdEquals(User_Roo_Finder.aj:47) at com.emc.fleet.domain.User.findUsersByUserIdEquals(User.java:1) I have read many STO questions and checked all answers none of them succeded this is my user class package com.emc.fleet.domain import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Transient; import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.NotEmpty; import org.springframework.roo.addon.javabean.RooJavaBean; import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord; import org.springframework.roo.addon.tostring.RooToString; @RooJavaBean @RooToString @RooJpaActiveRecord(finders = { "findUsersByEmailLike", "findUsersByUserIdEquals", "findUsersByCostCenter", "findUsersByDepartmet" }) public class User { @Id @GeneratedValue private Long id; @NotEmpty @NotNull private String firstName; @NotEmpty @NotNull private String lastName; @NotNull private Long userId; @Email @NotNull private String email…
favorite count: 0
type: Question
has title: Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)
answer count: 0
type: UnansweredQuestion
tagged with: maven
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/47310618
score: 1
tagged with: java

http://stackoverflow.com/a/25599708
downvote count: 0
has body: Your first link is talking about the size when serialized, you're talking about the size in memory. That's why the sizes are different. Serialized, as per your link, 9 bytes for the saved long. In memory, as per your second link, 32 bytes for the long and other objects that allow you to work with the date.
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25599655

http://stackoverflow.com/q/25644310
has title: HTMLUnit Wait For JS Issue
favorite count: 0
type: Question
tagged with: htmlunit
type: UnansweredQuestion
tagged with: javascript
upvote count: 2
score: 2
has answer: http://stackoverflow.com/a/25785804
has body: I'm using HTMLUnit in order to put text in a input box and then clicking on a link which is actually a JS call. The problem comes up when I put text in an input , using inputBox.setValueAttribute("example input"); . In this case , after clicking the button the page does not change at all. On the other hand , once I delete inputBox.setValueAttribute("example input"); and then click the button, the page content does change and includes an error for empty input. Below is the code i've used in order to put text in the relevant input and then click the button. public void addressToBlockPlot(){ WebClient client = new WebClient(BrowserVersion.FIREFOX_24); client.getOptions().setThrowExceptionOnScriptError(false); client.getOptions().setThrowExceptionOnScriptError(false); client.setJavaScriptTimeout(10000); client.getOptions().setJavaScriptEnabled(true); client.setAjaxController(new NicelyResynchronizingAjaxController()); client.getOptions().setTimeout(10000); try { HtmlPage page = client.getPage("http://mapi.gov.il/Pages/LotAddressLocator.aspx"); HtmlInput inputBox = (HtmlInput)page.getHtmlElementById("AddressInput"); final HtmlAnchor a = (HtmlAnchor) page.getElementById("helkaSubmit"); inputBox.setValueAttribute("example input"); a.click(); client.waitForBackgroundJavaScript(2000); HtmlPage page2= (HtmlPage) client.getCurrentWindow().getEnclosedPage(); System.out.println(page2.asXml()); } catch (Exception e) { } } Any ideas for solving this issue ? EDIT: I've tried using inputBox.setValueAttribute(""); , which resulted in receiving the same error that I got when no input text was set at all.
downvote count: 0
tagged with: java
answer count: 1

http://stackoverflow.com/q/25605726
has body: We have 3 positive integers a, b, and c where a + b + c = k, where k is any positive integer. Is there an optimal way to iterate through the possible configurations of these three integers? Any pseudocode or Java code would be much appreciated.
has comment: http://stackoverflow.com/comment/39999294
possible better answer: http://stackoverflow.com/a/25605788
favorite count: 0
has answer: http://stackoverflow.com/a/25605788
has comment: http://stackoverflow.com/comment/39999242
type: Question
has answer: http://stackoverflow.com/a/25607224
tagged with: algorithm
has answer: http://stackoverflow.com/a/25606928
tagged with: java
answer count: 5
score: -2
has title: Generating triplets of integers
has comment: http://stackoverflow.com/comment/39999268
accepted answer: http://stackoverflow.com/a/25605884
has answer: http://stackoverflow.com/a/25605884
has answer: http://stackoverflow.com/a/25607904
has comment: http://stackoverflow.com/comment/40001438
downvote count: 4
has comment: http://stackoverflow.com/comment/39999207
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/a/47350193
answers question: http://stackoverflow.com/q/25617097
score: 0
has body: It's work. I get List of objects array. StoredProcedureQuery query = em.createStoredProcedureQuery(GET_GOODS_PROCEDURE) .registerStoredProcedureParameter(1, GoodTest.class, ParameterMode.REF_CURSOR) .registerStoredProcedureParameter(2, String.class, ParameterMode.OUT) .registerStoredProcedureParameter(3, Integer.class, ParameterMode.OUT); query.execute(); List&lt;Object[]&gt; goods = query.getResultList(); for (Object[] good : goods) { System.out.println(Arrays.toString(good)); }
type: Answer

knapsack-problem
type: Tag
tags question: http://stackoverflow.com/q/25705488
tag name: knapsack-problem

http://stackoverflow.com/q/25700557
tagged with: char
has comment: http://stackoverflow.com/comment/40171494
has answer: http://stackoverflow.com/a/25701008
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25700944
tagged with: arrays
tagged with: sorting
score: 0
has body: I'm supposed to sort a char array and print it in descending order. Should be simple, however, I'm not getting the output I want. All solutions around the internet tells me Arrays.sort is okay to use, but am I supposed to use another method? Or am I overlooking something? public class mainClassTextFile { public static void main(String[] args) throws IOException { FileReader fileReader = new FileReader("file.txt"); String fileContents = ""; int i; int loopcount = 0; int count = 0; while((i = fileReader.read())!=-1){ char ch = (char)i; fileContents = fileContents + ch; } char[] ch=fileContents.toCharArray(); for(int n = 0; n &lt; ch.length; n++) { boolean addCharacter=true; for(int t = 0; t &lt; n; t++) { if (ch[n] == (fileContents.charAt(t))) addCharacter=false; } if (addCharacter) { for(int j = 0; j &lt; fileContents.length(); j++) { if(ch[n]==fileContents.charAt(j)) count=count+1; } Arrays.sort(ch); System.out.print(ch[n] + ": "+(count)); System.out.println(); count=0; loopcount++; } } } } The output is supposed to be all the characters in the text, counted and sorted, however this is the result: : 3339 X: 4 X: 4 X: 4 X: 4 [: 2 ]: 2 If I // Arrays.sort() then I get all the characters in the text file counted correctly, however they are neither sorted or in descending order!
tagged with: java
has title: Arrays.sort is not working as intended
type: Question
has comment: http://stackoverflow.com/comment/40171552
has comment: http://stackoverflow.com/comment/40171908
answer count: 2

http://stackoverflow.com/comment/40185636
has text: all i want to know is how to put 2 user input into a vector and how to search them ... plz dont mind if my question is not clear i am new to java.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25708173

http://stackoverflow.com/a/25639488
has comment: http://stackoverflow.com/comment/40061128
has body: Type in.nextLine() after s[i].setMarks(in.nextDouble()); What is happening : for(i=0;i&lt;3;i++){ s[i]=new Student(); System.out.println("Enter name of student "+(i+1)+" :"); s[i].setName(in.nextLine()); // second time around, you read the newline character System.out.println("Enter Reg. No. of student "+(i+1)+" :"); s[i].setRegNo(in.nextInt());// once you press "enter" here, the newline System.out.println("Enter marks of student "+(i+1)+" :"); s[i].setMarks(in.nextDouble());// once you press "enter" here, the newline character is added to the input stream }
answers question: http://stackoverflow.com/q/25639429
has comment: http://stackoverflow.com/comment/40061218
type: Answer
score: 0

http://stackoverflow.com/q/25625669
has body: I'm new to Java and I'm making a program that can take a number of names and put them into an ArrayList and then print out the names. I would like the user to press ctrl-Z to indicate the end of the list. So far I have this: ArrayList&lt;String&gt; name = new ArrayList&lt;&gt;(); System.out.print("Enter a name: "); Scanner in = new Scanner(System.in); name.add(in.next()); in.nextLine().equals(""); for(String naam: name){ System.out.println(naam); } But I think I need to do more with the for loop. If anyone can give me a solution that would be great! But what would be even better if you could also explain what you have modified to get it working
has comment: http://stackoverflow.com/comment/40039157
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25626437
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40035510
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40036464
has title: JAVA: How to enter an undefined number of values to a stringarray using a scanner?
upvote count: 3
has answer: http://stackoverflow.com/a/25626791
score: 3
tagged with: java
favorite count: 0

android-notifications
type: Tag
tags question: http://stackoverflow.com/q/25706917
tags question: http://stackoverflow.com/q/25611427
tags question: http://stackoverflow.com/q/25683038
tags question: http://stackoverflow.com/q/25565617
tag name: android-notifications

http://stackoverflow.com/comment/39909456
type: QuestionComment
has text: I'd also get used to reading the error. It seems overwhelming at first, but it *should* tell you exactly what you need to do. The phrase `Main.Java:16` tells you the line the error is on, and the name of the exception, `ArrayIndexOutOfBounds` tells you that the number in the array that you're trying to access doesn't exist.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25557183

http://stackoverflow.com/q/25584563
has body: I have to do a program in Java that compares 3 different asymmetric cipher algorithms. I want to choose the key size and the message size (that will be generated randomly), and I'd like to show the different time that every algorithm will be take for encrypt the same text with a key with the same dimension. I want to compare RSA, DSA and ECIES. The first two don't pose any problems but for the last one I don't know what to do. The main problems are : Which elliptic curve is safe to use? Can I use the same curve for different key sizes? How can I create a Cipher in Java that uses "ECIES", it doesn't seem to exist?
type: AnsweredQuestion
tagged with: elliptic-curve
tagged with: java
has title: Elliptic Curve Java
has answer: http://stackoverflow.com/a/25584982
type: Question
downvote count: 4
tagged with: encryption
score: -3
answer count: 1
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25584982

http://stackoverflow.com/q/25662508
upvote count: 3
has body: I want to retrieve the server's response as is, with all headers. The first thing that comes to mind is to use raw sockets. As I have learned from the search, there are 3 ways to indicate the end of response: (1) closing the connection; (2) examining Content-Length; (3) getting all chunks in the case of Transfer-Encoding: Chunked. There is also (4) the timeout method: assume that the timeout means end of data, but the latter is not really reliable. I want a general-case solution and do not want to add a Connection: close line to the request itself. In addition, it is recommended to use an existing library rather than re-invent the wheel. Question: How do I use an existing package, preferably, something already present in Android, to detect the end of HTTP response while having access (without interference) to the raw data stream? UPD: forgot to mention that the HTTP request is given to me as a sequence of bytes. Yes, it is for testing. PS relevant reading: End of an HTTP Response Detect the end of an HTTP Request in Java Detect end of HTTP request body How HTTP Server inform its clients that the response has ended Proper handling of chuncked Http Response within Socket Detect the end of a HTTP packet Android socket &amp; HTTP response headers Java HTTP GET response waits until timeout
tagged with: java
has answer: http://stackoverflow.com/a/25662979
linked to: http://stackoverflow.com/q/4824451
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40104242
has comment: http://stackoverflow.com/comment/40103019
has comment: http://stackoverflow.com/comment/40102981
linked to: http://stackoverflow.com/q/22456303
has comment: http://stackoverflow.com/comment/40103210
linked to: http://stackoverflow.com/q/17515565
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/24384508
has comment: http://stackoverflow.com/comment/40103100
score: 3
has title: An easy way to detect the end of http response (raw socket, java)?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12648551
tagged with: sockets
tagged with: android
linked to: http://stackoverflow.com/q/7689684
linked to: http://stackoverflow.com/q/3718158
linked to: http://stackoverflow.com/q/8527291
has comment: http://stackoverflow.com/comment/40102727

http://stackoverflow.com/a/25631651
answers question: http://stackoverflow.com/q/25631382
has comment: http://stackoverflow.com/comment/40049898
has comment: http://stackoverflow.com/comment/40050064
has comment: http://stackoverflow.com/comment/40050040
has comment: http://stackoverflow.com/comment/40047594
score: 2
has comment: http://stackoverflow.com/comment/40047068
has comment: http://stackoverflow.com/comment/40049865
has comment: http://stackoverflow.com/comment/40049920
type: Answer
has comment: http://stackoverflow.com/comment/40048516
has comment: http://stackoverflow.com/comment/41071013
has comment: http://stackoverflow.com/comment/40048596
has comment: http://stackoverflow.com/comment/40048063
has comment: http://stackoverflow.com/comment/40050067
upvote count: 2
has comment: http://stackoverflow.com/comment/40046868
has comment: http://stackoverflow.com/comment/40057589
has body: -- EDIT: I've developed a component which lets you filter custom ListViews and change filters dynamically etc. I think it has an easy implementation and you. Give it a try! I hope this would be nicer for all of you. https://github.com/matessoftwaresolutions/AndroidFilterableList -- The easiest way for me: Define custom generic filter Define listeners required to make it generic Link all items to the view Example: My extends baseAdapter implements the two interfaces (IFilteredItem and IFilteredListListener. Its content is: public class MenuListAdapter extends BaseAdapter implements IFilteredListListener&lt;PointOfInterest&gt;, IFilterableItem&lt;PointOfInterest&gt; { public MenuListAdapter(Context context,List&lt;PointsOfInterest&gt; points) { this.context = context; //Elements for the list this.points = points; } .... BaseAdapter methods, and the other implementations: @Override public int getCount() { return points.size(); } @Override public Object getItem(int position) { return points.get(position); } @Override public long getItemId(int position) { return position; } @Override public Filter getFilter() { if (filter == null) { filter = new ListFilter&lt;PointOfInterest&gt;(points, this, this,this); } return filter; } @Override public void onSearchResult(List&lt;PointOfInterest&gt; objects) { if (objects.size() == 0) { points = objects; objects.add(mockedPointForEmptyList); } else { points = objects; } } @Override public String getStringForFilter(PointOfInterest item) { return item.getTitle(); } .... In my activity, I have a list view. I set my custom adapter, and it will compare an filter by the title of the point of interest: In your activity, get the edit text which will be used to filter the list, and add the watcher: filterText = (EditText) customActionBar.findViewById(R.id.searchText); filterText.addTextChangedListener(filterTextWatcher); In your activity (attribute zone), define your watcher: private TextWatcher filterTextWatcher = new TextWatcher() { public …
downvote count: 0
has comment: http://stackoverflow.com/comment/40048204

http://stackoverflow.com/q/25575814
has answer: http://stackoverflow.com/a/25576228
has title: How to check if a value in an Array is contained in the same array as its following one
has body: In my Java program I have a String array of String arrays containing 3 values each. String[][] actions = { new String[]{"R", "R'", "R2"}, new String[]{"L", "L'", "L2"}, new String[]{"D", "D'", "D2"}, new String[]{"U", "U'", "U2"}, new String[]{"F", "F'", "F2"}, new String[]{"B", "B'", "B2"} }; Now I'm letting a randomizer pick 25 values out of these arrays by random and saving the results in a normal String array (let's call it results). Now I want to check if value 0 in results is contained in the same Array as value 1, meaning if value 0 is "U" and value 1 is "U'" it should re-roll the randomizer for value 1, ignoring the array value 0 is in. In the end I'd like to have an array of Strings where no String is in the same array as its following one.
type: Question
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/39944851
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/39945608
has comment: http://stackoverflow.com/comment/39946288
tagged with: string
score: -4
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39944615
tagged with: java
accepted answer: http://stackoverflow.com/a/25576228
has comment: http://stackoverflow.com/comment/39944649

http://stackoverflow.com/q/25647545
tagged with: java
answer count: 1
type: Question
tagged with: jakarta-ee
has body: I have a variable in jspf file. I want to access it from another java class file.is it possible to access the variable from java class file?If it is possible how i can do it ?
accepted answer: http://stackoverflow.com/a/25647660
tagged with: jsp
has title: JSPF file variable access from java class file
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25647660

http://stackoverflow.com/a/58468010
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/104785512
has comment: http://stackoverflow.com/comment/119527491
has comment: http://stackoverflow.com/comment/112438825
has comment: http://stackoverflow.com/comment/126754044
has body: Here's the Java code using registerDefaultNetworkCallback (and registerNetworkCallback for API &lt; 24): ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() { @Override public void onAvailable(Network network) { // network available } @Override public void onLost(Network network) { // network unavailable } }; ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.N) { connectivityManager.registerDefaultNetworkCallback(networkCallback); } else { NetworkRequest request = new NetworkRequest.Builder() .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build(); connectivityManager.registerNetworkCallback(request, networkCallback); }
upvote count: 51
score: 51
has comment: http://stackoverflow.com/comment/117501263
answers question: http://stackoverflow.com/q/25678216

http://stackoverflow.com/a/25709544
score: 0
accepted answer of: http://stackoverflow.com/q/25709506
has body: Math.random() generates a value between 0.0 to 0.99 Multiplying it with a no. increases it's range For ex: System.out.println(Math.random()*100); multiplying it with 100 will give a value between 0.000.. to 99.999.. Similarly: System.out.println((char)('A'+ Math.random()*27)); Will first generate a no. between 0.0 to 26.99.. then add it to the ASCII value to 'A' and then typecast it to char displaying a char value which has the ASCII value equal to the result. The output will lie from A-Z and [ i.e. characters having ASCII values from 65-91 After replacing 27 with 100 you get special characters because the range of ASCII value has now increased to 65-165 you may see the ASCII codes for symbols you are getting here.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25709506
type: Answer
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/25629761
type: Answer
has body: Why Log.d("makeQuery", "out"); is un reachable? try{ NetTask a = new NetTask(server_url); }catch(IOException e){ Log.d("makeQuery", "exception"); } The reason is that NetTask class throws other kind of exception. you will change to }catch(Exception e){ Log.d("makeQuery", "exception"); } but the good practice says catch the correct Exception, comment the exception handling and look into your LogCat for the type of Exception.
answers question: http://stackoverflow.com/q/25629385
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/q/25674159
tagged with: jai
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40123776
has comment: http://stackoverflow.com/comment/40123422
type: Question
has comment: http://stackoverflow.com/comment/40123688
has comment: http://stackoverflow.com/comment/40123550
has comment: http://stackoverflow.com/comment/40123395
has comment: http://stackoverflow.com/comment/40124233
type: UnansweredQuestion
tagged with: android
has body: I am really stuck at this exception from 3 days. It was working fine but suddenly it is throwing this exception. I am trying to upload an image for cleaning from my android device to JAVA servlet in jboss which is like this : Class Servlet extends HttpServlet{ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("You need to post an image."); PrintWriter out = response.getWriter(); out.println("Please post an image.."); out.flush(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { long time = System.currentTimeMillis(); // check the time, for file-naming and such System.out.println("Got a post - " + time); try{ // get the image from the app ObjectInputStream ois = new ObjectInputStream(request.getInputStream()); byte[] imageBytes = (byte[]) ois.readObject(); PlanarImage image = ImageUtil.getAsImage(imageBytes); ois.close(); System.out.println("Read image from stream..."); // save a copy for inspection ImageUtil.saveImage(image, time + "_y"); ....... And the ImageUtil.getasimage is like : public static PlanarImage getAsImage(byte[] imageBytes){ BufferedImage bi = null; InputStream in = null; try { in = new ByteArrayInputStream(imageBytes); bi = ImageIO.read(in); in.close(); } catch (IOException e) { e.printStackTrace(); } return PlanarImage.wrapRenderedImage(bi); } I am getting the following error on the line PlanarImage image = ImageUtil.getAsImage(imageBytes); Error : [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/VINCServer].[vinc]] (http--0.0.0.0-8080-2) Servlet.service() for servlet vinc threw exception: java.lang.ClassNotFoundException: javax.media.jai.ParameterBlockJAI from [Module "deployment.VINCServer.war:main" from Service Module Loader] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(…
tagged with: jboss
has comment: http://stackoverflow.com/comment/40123585
tagged with: servlets
has title: Getting java.lang.ClassNotFoundException: javax.media.jai.ParameterBlockJAI exception
has comment: http://stackoverflow.com/comment/40123725
score: 0
has comment: http://stackoverflow.com/comment/40123882

http://stackoverflow.com/q/25617935
linked to: http://stackoverflow.com/q/14038331
accepted answer: http://stackoverflow.com/a/25618302
tagged with: android
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40021842
tagged with: baseadapter
has comment: http://stackoverflow.com/comment/40021727
has comment: http://stackoverflow.com/comment/40032071
type: Question
has comment: http://stackoverflow.com/comment/40021764
has comment: http://stackoverflow.com/comment/40021617
has body: I have a listview of installed apps with a custom baseadapter class. I am attempting to add the searchview function when I press the search icon so an edittext pops up to filter which apps I want to search for. I am aiming for something like this: I keep on producing a nullpointer exception for my searchview; however, I believe my xml and java implementation is correct. I have done much research on the subject and still no luck. NullPointer Exception While Doing Search Feature for ListView With BaseAdapter How to add a SearchWidget to the ActionBar? Android SearchView Filter ListView No matter what I do I produce a nullpointer exception in some way or another. This is where it is produced. SearchView searchView; //this is what is null. This is in my blockactivity fragment class. searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); Here is my full baseadapter class: package com.ibc.android.demo.appslist.app; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.Filterable; import android.widget.TextView; import android.widget.Toast; import android.widget.Filter; import com.spicycurryman.getdisciplined10.app.R; import java.util.ArrayList; import java.util.HashSet; import java.util.List; // public class ApkAdapter extends BaseAdapter implements Filterable { //Pastebin link: http://pastebin.com/LGRicg4U , http://pastebin.com/c4WfmhMK , http://pastebin.com/gFuuM4dY, http://pastebin.com/4Q7EP9G4 // http://pastebin.com/Te2g072w, http://pastebin.com/NLT5iUiA , SharedPreferences sharedPrefs; SharedPreferences sharedPrefsap…
tagged with: android-searchmanager
linked to: http://stackoverflow.com/q/19455418
linked to: http://stackoverflow.com/q/11276043
type: AnsweredQuestion
score: 0
has title: NullPointer Exception implementing SearchView for Custom BaseAdapter
has comment: http://stackoverflow.com/comment/40021564
tagged with: android-listview
has answer: http://stackoverflow.com/a/25618302

http://stackoverflow.com/a/25559264
upvote count: 1
answers question: http://stackoverflow.com/q/25559190
score: 1
type: Answer
has body: You're creating a new GSM but you never call run. I assume you're trying to start a thread but that requires that you use a Runnable and a Thread object. If that is what you want to do Oracle has a tutorial on it.
downvote count: 0

http://stackoverflow.com/comment/40168325
type: QuestionComment
comment on: http://stackoverflow.com/q/25690923
score: 0
has text: It's the same question but the answer is a hack, and that means it's not the "normal way" intended by spring. Since spring-mvc 1 we have to post and then show the result. How can it still be so complicated to do it ?
type: Comment

http://stackoverflow.com/comment/64723910
score: 0
comment on: http://stackoverflow.com/q/25711409
has text: Hi, did you found any solution?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40192223
score: 0
has text: You can jump (seek) to the midpoint of the file, read/ignore the fractional line (let the first thread read the line that spans the midpoint). That isn't the problem. You can generalize this by dividing the file into N parts easily. ...
type: QuestionComment
comment on: http://stackoverflow.com/q/25711616
type: Comment

http://stackoverflow.com/a/25649229
has body: You cannot use -classpath with -jar option However you can use maven to have the dependencies for you jar like this org.apache.maven.plugins maven-jar-plugin 2.4 true lib/ well.defined.path.of.the.mainClass
answers question: http://stackoverflow.com/q/25648984
score: 0
has comment: http://stackoverflow.com/comment/40107658
type: Answer
accepted answer of: http://stackoverflow.com/q/25648984
type: AcceptedAnswer

http://stackoverflow.com/a/25668292
has body: Gradle build snippet in the question could be useful, but if I have to blindly guess, I bet that you don't have maven or maven-publish plugin applied (or you applied the wrong one).
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/52358792
answers question: http://stackoverflow.com/q/25668020
has comment: http://stackoverflow.com/comment/52357950
downvote count: 0
has comment: http://stackoverflow.com/comment/52359355
has comment: http://stackoverflow.com/comment/46839698
type: Answer

http://stackoverflow.com/comment/39931873
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25569055
has text: Yes, "txtUsario is null", how can I fix that?
score: 0

http://stackoverflow.com/comment/40136499
type: AnswerComment
comment on: http://stackoverflow.com/a/25671032
type: Comment
has text: Thats the idea I had in mind before posting the question but it is repetitive and has a problem; `flush()` will persist the data but you need to `close()` the cache to release the system resources.
score: 0

http://stackoverflow.com/q/25615416
type: AnsweredQuestion
tagged with: windows-7
upvote count: 2
linked to: http://stackoverflow.com/q/21473308
has comment: http://stackoverflow.com/comment/40843423
answer count: 1
downvote count: 0
has body: I am kinda new to cloning GitHub repository using Eclipse. One can open the GitHub Project repository from Eclipse using Git view (Window->ShowView->Others...->Git). After cloning the GitHub project on my local working set folder, I am not able to find any Java Code file or project files under Package Explorer pane. Here are the steps I am following: Step 1: I created a local git repository which has working copy of my Eclipse Java Project. Step 2: Then I synced it up to GitHub. I can see my repository in GitHub Step 3: Next I tried to clone it on to my working set folder in Eclipse using Git View by using GitHub repository URI ( working set is a different local folder for my java project. It is not the same folder as my local master repository. Essentially I kind of downloaded my project files from GitHub in to working set folder on local drive) Step 4: I clicked on "Git Repositories" pane Step 5: Now I was expecting to see the Java Project loaded in the upper left top of the Eclipse Luna in the Package Explorer area. I see on the top section in the Package Explorer. However I do not see any Java project in the Package Explorer area.I only see empty "Other projects" Working set. What must be going wrong ?
tagged with: github
tagged with: git
favorite count: 0
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/26221765
has answer: http://stackoverflow.com/a/26221765
tagged with: eclipse
has title: Clone a GitHub Repository in Eclipse Luna Release (4.4.0) on Windows 7
score: 2

http://stackoverflow.com/a/25553530
answers question: http://stackoverflow.com/q/25553470
has body: See this related question on Stack Overflow. You shouldn't try to write such a regular expression since most languages don't support the complement of regular expressions. Instead you should write a regex that matches only those three things: ^(1|2|25)$ - and then in your code you should check to see if this regex matches \d+ and fails to match this other one, e.g.: `if($myStr =~ m/\d+/ &amp;&amp; !($myStr =~ m/^(1|2|25)$/))`
type: Answer
score: 0

http://stackoverflow.com/q/25693099
has answer: http://stackoverflow.com/a/25714778
has comment: http://stackoverflow.com/comment/40160378
type: UnansweredQuestion
tagged with: java
answer count: 1
tagged with: web-services
type: Question
has title: How to handle large payload attacks?
tagged with: soap
has comment: http://stackoverflow.com/comment/40161333
score: 0
has body: I have soap based large payload (bytes) data on webservice call. How do i ensure that application will be proof from: Malicious client generating fake requests with large payload keeping server busy handling fake requests? How to reject extremely large payload before encountering OME to protect server crash?

http://stackoverflow.com/comment/40077632
type: QuestionComment
has text: You might like [Objects.deepEquals](http://docs.oracle.com/javase/7/docs/api/java/util/Objects.html#deepEquals(java.lang.Object,%20java.lang.Object))
score: 0
comment on: http://stackoverflow.com/q/25648783
type: Comment

http://stackoverflow.com/q/25620774
has comment: http://stackoverflow.com/comment/40026602
score: 0
tagged with: libgdx
has comment: http://stackoverflow.com/comment/40028796
tagged with: java
has comment: http://stackoverflow.com/comment/40026451
has comment: http://stackoverflow.com/comment/40030246
type: Question
has title: Mouse coordinate conversion Libgdx
has comment: http://stackoverflow.com/comment/40030096
answer count: 0
has body: I have a camera: //Map is a my object that wrapper of TiledMap class In the create method: this.renderer=new OrthogonalTiledMapRenderer(this.map.getMap(); this.camera=new OrthographicCamera(); this.camera.translate(map.getMapPixelWidth()/2, map.getMapPixelHeight()/2); this.camera.update(); view=new StretchViewport(map.getMapPixelWidth(),map.getMapPixelHeight(), camera); batch=new SpriteBatch(); In the update method: this.renderer.setView(this.camera); this.renderer.render(); this.camera.update(); batch.setProjectionMatrix(camera.combined); ArrayList&lt;RectangleMapObject&gt; layer=this.getObjectsFromLayer("collision");//find collision layers //Mouse coordinates int x=Gdx.input.getX(); int y=Gdx.input.getY(); Vector3 coordinateScreen=new Vector3(x,y,0); Vector3 coordinateWorld=camera.unproject(coordinateScreen); Rectangle rectMouse=new Rectangle(coordinateWorld.x,coordinateWorld.y,20,20); for(RectangleMapObject rect: layer) if(Intersector.intersectRectangles(rectMouse, rect.getRectangle(), rectMouse)){ System.out.println("COLLISION MOUSE-MAPOBJECT ");} public ArrayList&lt;RectangleMapObject&gt; getObjectsFromLayer(String layerName){ ArrayList&lt;RectangleMapObject&gt; array=new ArrayList&lt;RectangleMapObject&gt;(); MapObjects og=this.map.getMap().getLayers().get(layerName).getObjects(); for(MapObject object : og) if (object instanceof RectangleMapObject) array.add(((RectangleMapObject) object)); return array; } My problem is that the collision between mouse and mapobject never occurs Also if I click on the area where stands the MapObject. I think it is a problem of conversion of the coordinates of the mouse. Thank you for your time.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40029450
has comment: http://stackoverflow.com/comment/40029968

http://stackoverflow.com/q/25603773
accepted answer: http://stackoverflow.com/a/25604181
has title: Java FX control for enter date in timestamp format
tagged with: java
has answer: http://stackoverflow.com/a/27847255
possible better answer: http://stackoverflow.com/a/27847255
type: Question
score: 0
answer count: 2
tagged with: javafx-8
has answer: http://stackoverflow.com/a/25604181
tagged with: javafx
type: AnsweredQuestion
has body: Tell me please, is there any visual component for enter date in timestamp format, DatePicker supports date only, as I understood.

http://stackoverflow.com/a/33912439
downvote count: 0
has body: with the itext version 5.5 we can merge pdf more easly using the method PdfCopy.addDocument : package tn.com.sf.za.rd.controller; import java.io.FileOutputStream; import java.io.IOException; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.pdf.PdfCopy; import com.itextpdf.text.pdf.PdfReader; public class ReportMerging { public static void main(String[] args) throws DocumentException, IOException { String DOC_ONE_PATH = "D:/s.zaghdoudi/tmp/one.pdf"; String DOC_TWO_PATH = "D:/s.zaghdoudi/tmp/two.pdf"; String DOC_THREE_PATH = "D:/s.zaghdoudi/tmp/three.pdf"; Document document = new Document(); PdfCopy copy = new PdfCopy(document, new FileOutputStream(DOC_THREE_PATH)); document.open(); PdfReader readerOne = new PdfReader(DOC_ONE_PATH); PdfReader readerTwo = new PdfReader(DOC_TWO_PATH); copy.addDocument(readerOne); copy.addDocument(readerTwo); document.close(); } }
answers question: http://stackoverflow.com/q/25604555
type: Answer
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/55587112

http://stackoverflow.com/comment/40551845
comment on: http://stackoverflow.com/a/25890810
type: Comment
has text: You could get more informations using these options. I begin to run out of ideas ^^'
type: AnswerComment
score: 0

http://stackoverflow.com/q/25676725
answer count: 2
upvote count: 3
has answer: http://stackoverflow.com/a/25676885
possible better answer: http://stackoverflow.com/a/25676885
tagged with: java
has comment: http://stackoverflow.com/comment/40128060
has comment: http://stackoverflow.com/comment/40128114
linked to: http://stackoverflow.com/q/2386867
tagged with: android-activity
downvote count: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/2251714
has answer: http://stackoverflow.com/a/25677092
accepted answer: http://stackoverflow.com/a/25677092
tagged with: android-layout
has comment: http://stackoverflow.com/comment/40128093
tagged with: android
tagged with: android-actionbar
has body: Is it possible to change the colour of the title text within the action bar to a colour of a hex value? I'm only aware of the following and have no idea if this can be achieved: setTitleColor(Color.Green);
linked to: http://stackoverflow.com/q/9920277
has comment: http://stackoverflow.com/comment/40128217
type: AnsweredQuestion
score: 2
has title: How to programmatically change title bar colour to hex value?

http://stackoverflow.com/comment/40169240
has text: But you are clueless as to which line of your Java callback actually throws the exception? Why don't you try eliminating all possible suspects by commenting them out?
comment on: http://stackoverflow.com/q/25698620
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25563699
has comment: http://stackoverflow.com/comment/39921270
accepted answer of: http://stackoverflow.com/q/25563477
type: Answer
upvote count: 1
has body: UPDATE: Added full implementation UPDATE 2: If you want you can use RangeMap for internal theMap as suggested in the comments. If you key ranges don't overlap, you can create a custom container which internally stores data in TreeMap with a custom key which implements Comparable: class MyStorage&lt;T&gt; { private static final class Range implements Comparable&lt;Range&gt; { private int first; private int last; public Range(int first_, int last_) { first = first_; last = last_; } // This heavily relies on that the ranges don't overlap @Override public int compareTo(Range other) { if (last &lt; other.first) return -1; if (first &gt; other.last) return 1; return 0; } } private Map&lt;Range, T&gt; theMap = new TreeMap&lt;Range, T&gt;(); public void put(String key, T obj) { String[] ranges = key.split(";"); for (String range : ranges) { //System.out.println("Adding " + range); String[] bounds = range.split("-"); //System.out.println("Bounds " + bounds.length); int first = Integer.parseInt(bounds[0]); if (bounds.length == 1) theMap.put(new Range(first, first), obj); else theMap.put(new Range(first, Integer.parseInt(bounds[1])), obj); } } public T get(String key) { return get(Integer.parseInt(key)); } public T get(int key) { return theMap.get(new Range(key, key)); } } class Main { public static void main (String[] args) throws java.lang.Exception { MyStorage&lt;Integer&gt; storage = new MyStorage&lt;Integer&gt;(); storage.put("10;20-30", 123); storage.put("15;31-50", 456); System.out.println(storage.get("42")); } }
answers question: http://stackoverflow.com/q/25563477
has comment: http://stackoverflow.com/comment/39921382
has comment: http://stackoverflow.com/comment/39922217
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39922090
has comment: http://stackoverflow.com/comment/39922103

hiveql
tag name: hiveql
tags question: http://stackoverflow.com/q/25550939
type: Tag

http://stackoverflow.com/comment/39998244
comment on: http://stackoverflow.com/q/25605206
score: 0
type: Comment
has text: cdn.travelpartnerweb.com/DesiyaImages/Image/1/nxd/maw/qyj/ibt/HO_TN.jpg
type: QuestionComment

http://stackoverflow.com/comment/40107736
comment on: http://stackoverflow.com/q/25658700
score: 0
type: Comment
has text: Can you show the whole stack trace? And perhaps also what `targetDiv` is?
type: QuestionComment

http://stackoverflow.com/q/25635569
tagged with: math
has title: Check if point is in circular sector
has body: I found this question that deals with the same issue. The provided answers work, but I need to change it slightly for my case. Below is the answer I went with: double theta = Math.atan2(pointerY - height / 2, pointerX - width / 2); if(theta&lt;0) theta = Math.PI - theta; int whichSlice = 0; double sliceSize = Math.PI*2 / 4; double sliceStart; for(int i=1; i&lt;=4; i++) { sliceStart = i*sliceSize; if(theta &lt; sliceStart) { whichSlice = i; break; } } In my case, I need to rotate the quadrants by 45 degrees. Below is an example; red is what this code does, while green is what I want: I've tried various code alterations, but still can't figure it out.
accepted answer: http://stackoverflow.com/a/25635677
score: 1
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40053982
upvote count: 1
linked to: http://stackoverflow.com/q/15164240
favorite count: 0
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25635677

http://stackoverflow.com/comment/40204185
type: QuestionComment
has text: To answer your new question, yes. This is what's known as a garbage collector. There are many different types of garbage collection algorithms, but compaction is very commonly implemented. You can write code in C to do this as well. But you cannot use raw pointers, because like you said, their address would change. You have to use indirect references. The garbage collector would maintain a mapping table to map those references into pointers to actual memory locations.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25679546

http://stackoverflow.com/q/25614925
linked to: http://stackoverflow.com/q/5585779
has comment: http://stackoverflow.com/comment/40016297
score: 0
tagged with: java
has body: I have been able to retrieve strings and files in Parse. However, I have difficulty retrieving number from the number column. In particular, I want to retrieve number from Parse and cast it into a TextView that will display the number. Below is the code I have to retrieve a string: @Override public void done(List&lt;ParseUser&gt; objects,ParseException e) { for(int i=0;i&lt;objects.size();i++){ // Do whatever you need to extract object from "users" ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("User"); query.whereNotEqualTo("objectId", ParseUser.getCurrentUser() .getObjectId()); // users with Gender = currentUser.Looking_Gender query.whereEqualTo("Gender", userLookingGender); // users with Looking_Gender = currentUser.Gende r query.whereEqualTo("Looking_Gender", userGender); query.setLimit(1); query.whereEqualTo("ActivityName", activityName); // query.whereGreaterThanOrEqualTo("Age", minimumAge); // query.whereLessThanOrEqualTo("Age", maximumAge); mUserAgeRetrieved = (TextView) getActivity().findViewById(R.id.userlistage); mUserAgeRetrieved.setText(objects.get(i).get("Age").toString()); }//for loop } In particular, I would like the following line to be converted into a number instead of a string mUserAgeRetrieved.setText(objects.get(i).get("Age").toString()); What do I have to do?
type: Question
linked to: http://stackoverflow.com/q/3994315
tagged with: parse-platform
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40024835
tagged with: android
has comment: http://stackoverflow.com/comment/40025837
has title: Retrieving numbers in Parse
has comment: http://stackoverflow.com/comment/40025181
answer count: 0

http://stackoverflow.com/comment/40161329
type: Comment
type: QuestionComment
has text: paste code snippet responsible for this functionality
comment on: http://stackoverflow.com/q/25694736
score: 0

http://stackoverflow.com/q/25571600
favorite count: 0
type: Question
has title: Cast list of interfaces to list of concrete type
upvote count: 1
accepted answer: http://stackoverflow.com/a/25571640
has answer: http://stackoverflow.com/a/25571702
possible better answer: http://stackoverflow.com/a/25571677
answer count: 4
has answer: http://stackoverflow.com/a/25571640
has body: I have a method that get's some objects from a db: public &lt;T extends Persistable&gt; List&lt;T&gt; getAllEntitiesEager( Class clazz, String sortField, SortOrder sortOrder, Map&lt;String, Object&gt; filters, boolean invalidate); This method returns a list of objects from type clazz. All objects returned implement the Interface Persistable. Now I need a List of concrete types. Is this even possible? Example: The Class UserEntity implements Persistable and I want to do something like that: List&lt;UserEntity&gt; userList = (List&lt;UserEntity) someObject.getAllEntitiesEager(UserEntity.class,...)
has answer: http://stackoverflow.com/a/25571677
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25571634
score: 1
tagged with: java
downvote count: 0
tagged with: generics

http://stackoverflow.com/a/25567047
has body: Implementing a so-called functional interface in Java 8 (with lambdas) or in Groovy (with closures) looks quite the same, but underlying mechanisms are pretty different. Let's take the java.util.function.Consumer functional interface as an example. We use it to call the new Java 8 forEach() method on a hypothetic java.util.List instance called myList. In Java it looks like this: myList.forEach ((s) -&gt; System.out.println(s)); The same in Groovy: myList.forEach { s -&gt; println s } Both compilers generate new Classes from the lambda / closure code. The class generated by Java 8 implements the target interface (Consumer in this case), not derived from anything, similar to an embedded anonymous class like this: myList.forEach(new Consumer&lt;Object&gt;() { @Override public void accept (Object s) { System.out.println(s); } }); In contrast, what Groovy generates looks a little bit like the following: myList.forEach (new Closure(this) { void doCall(Object s) { println s } } This creates an anonymous class derived from groovy.lang.Closure that does not implement any specific interface. Nevertheless, it can be used as parameter here. This is possible because Groovy generates a dynamic proxy object at runtime, implementing the ´Consumer´ interface and forwarding any calls to the generated Closure instance. As a consequence, in Groovy, you can replace Java 8 lambdas by Groovy closures, but not the other way round. When you want to use a Groovy API in Java 8 code, you cannot call a method expecting a Closure with a lambda expression. Closure isn't a functional interface but an abstract class, and that can simply not be implemented by a lambda expression.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/50328303
score: 34
has comment: http://stackoverflow.com/comment/107148290
answers question: http://stackoverflow.com/q/25565020
upvote count: 34
has comment: http://stackoverflow.com/comment/50328074
has comment: http://stackoverflow.com/comment/50328484
accepted answer of: http://stackoverflow.com/q/25565020
type: Answer
has comment: http://stackoverflow.com/comment/50329475
has comment: http://stackoverflow.com/comment/39927502
has comment: http://stackoverflow.com/comment/50328807
has comment: http://stackoverflow.com/comment/99656802

http://stackoverflow.com/q/25708011
has comment: http://stackoverflow.com/comment/40185162
score: 0
answer count: 0
tagged with: java
has body: I am making a java applet using awt. I know it's old but our professor is requiring us to use it so please bear with it. My problem is with the layering of images. As of right now, to layer images on top of another, I have to display each Image I have that I want to be on top of another first before displaying the others. This makes things quite complicated and messy. Is there a way (media tracker or something) to make it so that an image image 1 always is on top of another image image 2? Also, the program I'm making is a dungeon-crawler type game. The screen is filled up by a 5x5 area block of images of 32 px each. Something like: [W][W][ ][ ][W] [W][ ][ ][ ][W] [W][W][W][ ][ ] [ ][W][ ][ ][ ] [ ][ ][ ][ ][ ] Where [W] are wall images and [ ] are path images. The thing is, I want this set of images to always display, and only repaint the character as he moves through the images. Is there a way so that these images will not be cleared when repaint is called? Here's my code: public class GUI extends Applet implements KeyListener { int imageSize = 32; int dimensions = imageSize*5; //makes the display 5x5 Image pathImage, wallImage, playerImage; MediaTracker mt; public void init() { this.setSize(dimensions, dimensions); mt = new MediaTracker(); pathImage = getImage(getCodeBase(), "path.gif"); //all the images are stills wallImage = getImage(getCodeBase(), "wall.gif"); playerImage = getImage(getCodeBase(), "player.gif"); mt.addImage(pathImage, 0); mt.addImage(wallImage, 1); mt.addImage(playerImage, 2); addKeyListener(this); } public void paint(Graphics g) { try { tracker.waitForAll(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } //this first one prints the first three layers from the top of the 5x5 display int x = 0; int y = 0; for(int i = 0; i &lt; 3; i++) { for(int j = 0; j &lt; 5; j++) { switch(Global.currentMap.getTileMap(player.getXCoordinate() + j - 2, player.getYCoordinate() + i - 2).getImageID()) { case "path": g.d…
has title: z-index of some sorts and keeping things painted in Applet
tagged with: applet
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40185227
has comment: http://stackoverflow.com/comment/40185219

http://stackoverflow.com/comment/40057173
has text: wow! wow! wow! Excellent tool. I love it. Thanks. Did I mention wow?
type: Comment
comment on: http://stackoverflow.com/a/25637236
score: 0
type: AnswerComment

http://stackoverflow.com/q/25692256
type: Question
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26864499
tagged with: inheritance
has title: Getting around "Table per Concrete Class" in Hibernate inheritance mapping strategy
score: 0
has answer: http://stackoverflow.com/a/25692570
tagged with: java
tagged with: hibernate
has body: In my java I have a generic class (could be abstract or non-abstract either way, but does NOT map to a table in the database). It has one or more variables that are common to every class. Example: public class GenericThing { private Date createDate; public Date getCreateDate() { return createDate; } public void setCreateDate(Date dt) { createDate = dt; } } This is useful because literally every table in the database has the column CREATE_DATE. In this case the right inheritance strategy to use in Hibernate is "table per concrete class". But, this is "bad", they say, because each table requires that identical column and if you change that column name (CREATE_DATE) you have to change every table's column name. Well, obviously this is true, but what is the alternative? Obviously I do want every table in the database to store the Create Date, but I don't want every object in the entire database to be in one table, so that precludes (as far as I know) all the other mapping strategies, right?

http://stackoverflow.com/comment/40029255
comment on: http://stackoverflow.com/a/25621336
type: Comment
type: AnswerComment
has text: You might want to try index file reader https://github.com/jramoyo/indexed-file-reader there is method for that readLines
score: 0

http://stackoverflow.com/a/25698123
has comment: http://stackoverflow.com/comment/40167721
has body: Well, if this represents n and other represents m, to calculate n + m is equivant to calculating n+1 + m-1, which is exactly what succ().plus(other.pre) returns. At the end of the recurssion, the first number reaches n+m and the second number reaches 0. That's why you return this when other.isZero() is true.
type: Answer
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/25697996
has comment: http://stackoverflow.com/comment/40167576
downvote count: 0
has comment: http://stackoverflow.com/comment/40167598
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25697996
has comment: http://stackoverflow.com/comment/40167636
has comment: http://stackoverflow.com/comment/40167620

http://stackoverflow.com/a/25708853
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/40186903
score: 1
upvote count: 1
downvote count: 0
has body: Use the isInstance or isAssignableFrom method of Class depending on your needs. isInstance docs excerpt: Determines if the specified Object is assignment-compatible with the object represented by this Class. This method is the dynamic equivalent of the Java language instanceof operator. The method returns true if the specified Object argument is non-null and can be cast to the reference type represented by this Class object without raising a ClassCastException. It returns false otherwise. isAssignableFrom docs excerpt: Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter. It returns true if so; otherwise it returns false. If this Class object represents a primitive type, this method returns true if the specified Class parameter is exactly this Class object; otherwise it returns false.
accepted answer of: http://stackoverflow.com/q/25708843
answers question: http://stackoverflow.com/q/25708843

http://stackoverflow.com/comment/40141046
type: Comment
comment on: http://stackoverflow.com/a/25683918
has text: @Callum You get the same error like without locale?
score: 0
type: AnswerComment

http://stackoverflow.com/a/25644979
accepted answer of: http://stackoverflow.com/q/25644218
type: Answer
answers question: http://stackoverflow.com/q/25644218
has body: these properties are stored in %userprofile%\AppData\LocalLow\Sun\Java\Deployment\security\deployment.properties to disable CRLs you need to add deployment.security.validation.crl=false . So here's the solution @echo deployment.security.validation.crl=false&gt;&gt;"%userprofile%\AppData\LocalLow\Sun\Java\Deployment\security\deployment.properties" to restore these settings you need to delete this line.And probably you'll need admin permissions.
score: 2
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40070537
upvote count: 2

http://stackoverflow.com/q/25642536
tagged with: http://stackoverflow.com/tag/xhtml
tagged with: saxon
tagged with: xslt-2.0
score: -1
has body: I'm trying to get a simple XSLT 2.0 transformation running using perl and XML::Saxon::XSLT2. Here's what i've tried so far: test.xhtml: <?xml version="1.0" encoding="UTF-8"?> My Title My Content test.xslt: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0"> <xsl:template match="/"> <xsl:apply-templates /> </xsl:template> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> </xsl:stylesheet> xslttest.pl: use strictures; use diagnostics; use XML::Saxon::XSLT2; use XML::LibXML; my $parser = XML::LibXML->new; my $xsl = 'test.xslt'; my $xslt = $parser->load_xml( location => $xsl ); my $dom = $parser->load_xml( location => 'test.xhtml' ); my $trans = XML::Saxon::XSLT2->new($xslt); my $output = $trans->transform( $dom, 'xhtml' ); print $output; Output of locate saxon9he.jar: /usr/local/share/java/saxon9he.jar /usr/share/java/saxon9he.jar Now, if i run perl xslttest.pl, i get: Uncaught exception from user code: A problem was encountered while attempting to compile and install your Inline Java code. The command that failed was: "/usr/lib/jvm/default-java/bin/javac" -deprecation -d "/tmp/perltest/_Inline/lib/auto/XML/Saxon/XSLT2_dbc0" Transformer.java > cmd.out 2>&1 The build directory was: /tmp/perltest/_Inline/build/XML/Saxon/XSLT2_dbc0 The error message was: Transformer.java:1: error: package net.sf.saxon.s9api does not exist import net.sf.saxon.s9api.*; ^ Transformer.java:29: error: cannot find symbol private XsltExecutable xslt; ^ symbol: class XsltExecutable location: class Transformer Transformer.java:30: error: cannot find symbol private Processor proc; ^ symbol: class Processor location: class Transformer Transformer.java:31: error: cannot find symbol private HashMap<String, XdmAtomicValue> params; ^ (...) Perl version (result of perl -v): This is perl 5, version 18, subversion 2 (v5.18.2) built fo…
has comment: http://stackoverflow.com/comment/40065765
has answer: http://stackoverflow.com/a/25645145
has title: Transform XHTML with XML::Saxon::XSLT2
has comment: http://stackoverflow.com/comment/40066318
has comment: http://stackoverflow.com/comment/40065866
tagged with: perl
upvote count: 0
accepted answer: http://stackoverflow.com/a/25645145
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40066119
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/25674707
has comment: http://stackoverflow.com/comment/72909363
has comment: http://stackoverflow.com/comment/72859820
type: Answer
score: 11
upvote count: 11
accepted answer of: http://stackoverflow.com/q/25674206
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25674206
has body: Updated - Aug 2021 This process has changed starting in Jetty 10.0.0 (this includes Jetty 11.0.0) The existence of the jetty-annotations-&lt;ver&gt;.jar on the classpath is enough to enable the annotation and bytecode scanning for your servlets and websocket layers. The WebAppContext.setConfiguration(...) method should no longer be used. The old example project has been archived and replaced with https://github.com/jetty-project/embedded-servlet-server There are examples for ... Servlet API Version Jetty Version New Branch 3.1 Jetty 9.4.x embedded-servlet-server : jetty-9.4.x 4.0 Jetty 10.x embedded-servlet-server : jetty-10.0.x 5.0 Jetty 11.x embedded-servlet-server : jetty-11.0.x Original Answer - Sept 2014 You need to define the WebAppContext configurations appropriately (and in the correct order). wacHandler.setConfigurations(new Configuration[] { new AnnotationConfiguration(), new WebInfConfiguration(), new WebXmlConfiguration(), new MetaInfConfiguration(), new FragmentConfiguration(), new EnvConfiguration(), new PlusConfiguration(), new JettyWebXmlConfiguration() }); Don't forget to add the jetty-annotations.jar. This is from the EmbedMe.java example for embedded-jetty use with Servlet 3.1 found at https://github.com/jetty-project/embedded-servlet-3.1/
has comment: http://stackoverflow.com/comment/45937581

http://stackoverflow.com/comment/39899839
comment on: http://stackoverflow.com/q/25551057
type: QuestionComment
score: 0
has text: possible duplicate of [Daylight saving time and time zone best practices](http://stackoverflow.com/questions/2532729/daylight-saving-time-and-time-zone-best-practices)
type: Comment

http://stackoverflow.com/q/25640483
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25640529
answer count: 1
has title: java waiting for output command to finish in ProcessBuilder("sh")
score: 0
tagged with: java
has body: How to wait for "cmd1" exit then run "cmd2" without using shell script. void exec(CharSequence ch) throws IOException { String string = ch.toString(); out.write(string); out.newLine(); out.flush(); //Fix here. } ProcessBuilder builder = new ProcessBuilder("sh"); builder.redirectErrorStream(true); process = builder.start(); out = new BufferedWriter(new OutputStreamWriter(process.getOutputStream())); exec("sleep 5"); // cmd1 exec("ls -al"); // cmd2
type: Question

http://stackoverflow.com/q/25651695
has answer: http://stackoverflow.com/a/25652638
score: -2
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40082785
has title: How to make loop for many same type components?
has body: I'm using Eclipse (Android + Java) and I have 20 components on the Form (20x ImageView). The names of the ImageViews (I mean @id) looks like: button1, button2, button3 etc and now I want to use the loop to change graphics on them. for (int i = 0; i &lt; 20; i++) { button (and what here?).setImageResource(R.drawable.grafika); } but I don't know how to do this in the loop. Without loop I can do this: button1.setImageResource(R.drawable.grafika); button2.setImageResource(R.drawable.grafika); button3.setImageResource(R.drawable.grafika); button4.setImageResource(R.drawable.grafika); //etc but I would like to use one loop that looks like: for (int i = 1; i &lt; 21; i++) { ("button" + i).setImageResource(R.drawable.grafika); //i as string } How do I do that? If you can, please help me, I will be very happy.
tagged with: eclipse
type: Question
upvote count: 0
downvote count: 2
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25652638
type: AnsweredQuestion

http://stackoverflow.com/a/25707069
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: for(int m = 0; m &lt; 11; m++){ for(int d = 0; d &lt; 30; d++){ int randomNum = rand.nextInt((max - min) + 1) + min; calendariosEnf[d][m] = randomNum; } } d cannot be larger than 11, otherwise out of bound. And the m can from 0 to 11 (inclusive), and d can from 0 to 30 (inclusive). for(int m = 0; m &lt; 12; m++){ for(int d = 0; d &lt; 31; d++){ int randomNum = rand.nextInt((max - min) + 1) + min; calendariosEnf[m][d] = randomNum; } }
answers question: http://stackoverflow.com/q/25707035

http://stackoverflow.com/q/25669990
answer count: 2
has comment: http://stackoverflow.com/comment/40116466
tagged with: java
has answer: http://stackoverflow.com/a/25937425
has comment: http://stackoverflow.com/comment/40116014
has comment: http://stackoverflow.com/comment/40115891
upvote count: 10
has title: How to connect to MQ using Java
has body: I want to make a connection &amp; send a string to MQ using JAVA. Following are the MQ details. JNDI Name: ABCDEFH Queue Manager: ABCDEFH Host Name or IP Address: ABCDEFH Port: ABCDEFH Channel: ABCDEFH Transport Type: ABCDEFH I am new to this, so can you please help me with sample code for this. Thanks!
favorite count: 0
type: Question
tagged with: ibm-mq
has comment: http://stackoverflow.com/comment/40115867
has comment: http://stackoverflow.com/comment/40115836
downvote count: 8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40115819
score: 2
has comment: http://stackoverflow.com/comment/96056544
has answer: http://stackoverflow.com/a/48307917

http://stackoverflow.com/comment/39935425
comment on: http://stackoverflow.com/a/25570968
has text: Thanks for the superfast reply! however in my real environment need to use a dynamic parameter that could be conditionally a string or an object ... is the only way to allow it to use a normal if instead single-line condition?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40068936
type: QuestionComment
type: Comment
has text: For some reason that code does not throw an exception.
score: 0
comment on: http://stackoverflow.com/q/25642712

http://stackoverflow.com/a/26831691
answers question: http://stackoverflow.com/q/25708992
type: Answer
has body: I've updated jdk version to 1.7.71 and now everything worked. Thanks :)
score: 0
accepted answer of: http://stackoverflow.com/q/25708992
type: AcceptedAnswer

http://stackoverflow.com/q/25609405
has answer: http://stackoverflow.com/a/53802938
type: Question
type: AnsweredQuestion
upvote count: 167
tagged with: java
has answer: http://stackoverflow.com/a/51208780
downvote count: 1
has answer: http://stackoverflow.com/a/28085757
answer count: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/40005857
tagged with: terminal
accepted answer: http://stackoverflow.com/a/25609477
has body: I just installed the latest Java SDK 7-67 from Oracle on the Mac 10.9.4. I then ran the command java -v in Terminal and I get this message: Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
has answer: http://stackoverflow.com/a/25609477
possible better answer: http://stackoverflow.com/a/53461513
has answer: http://stackoverflow.com/a/35287299
has answer: http://stackoverflow.com/a/68281548
has title: Error: Could not create the Java Virtual Machine Mac OSX Mavericks
score: 166
has answer: http://stackoverflow.com/a/53461513

actionlistener
tags question: http://stackoverflow.com/q/25672632
tags question: http://stackoverflow.com/q/25591476
tags question: http://stackoverflow.com/q/25691914
tags question: http://stackoverflow.com/q/25613781
tags question: http://stackoverflow.com/q/25674068
tags question: http://stackoverflow.com/q/25628191
tags question: http://stackoverflow.com/q/25573953
tags question: http://stackoverflow.com/q/25627023
type: Tag
tags question: http://stackoverflow.com/q/25573307
tags question: http://stackoverflow.com/q/25690473
tag name: actionlistener
tags question: http://stackoverflow.com/q/25644778
tags question: http://stackoverflow.com/q/25711088
tags question: http://stackoverflow.com/q/25641027

http://stackoverflow.com/a/25670529
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25670051
score: 21
has body: Try this method: private void createAndShowAlertDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle("My Title"); builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //TODO dialog.dismiss(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //TODO dialog.dismiss(); } }); AlertDialog dialog = builder.create(); dialog.show(); }
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/40117065
upvote count: 22
has comment: http://stackoverflow.com/comment/41454729
answers question: http://stackoverflow.com/q/25670051

http://stackoverflow.com/q/25659438
answer count: 1
has answer: http://stackoverflow.com/a/25659626
has title: How to use <composite-map-key> in hibernate
has body: As per Hibernate documentation, we can use components as key of a map using tag. So I tried to create a program to understand how it works but got stuck on how to create the mapping file. I have declared a pojo classes for: Person.java public class Person { private java.util.Date birthday; private Map<Name, String> someNames = new HashMap<Name,String>(); private int id; // Setters & Getters } Component class Name.java: public class Name { String first; String last; // Setters & Getters } I tried to create the mapping file but I am not sure how it should look like, here is the file which is not correct: <generator class="increment" /> <property name="birthday" type="date" /> <property name="initial" column="initial1" /> When I am trying to get the session factory then i am getting an exception saying: Caused by: org.xml.sax.SAXParseException: The content of element type "map" must match "(meta*,subselect?,cache?,synchronize*,comment?,key,(map-key|composite-map-key|map-key-many-to-many|index|composite-index|index-many-to-many|index-many-to-any),(element|one-to-many|many-to-many|composite-element|many-to-any),loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,filter*)". Can someone please help me how can we use composite-map-key to use a component as a key of map?
favorite count: 0
type: Question
upvote count: 1
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/25659626
tagged with: java
tagged with: hibernate
downvote count: 0

http://stackoverflow.com/a/25876396
answers question: http://stackoverflow.com/q/25607154
upvote count: 0
downvote count: 1
type: Answer
has body: Spring security works over Spring MVC - it uses redirects. So the idea is when a user tries to reach a "secured" content, and he has not been authenticated, then HTTP 302 is return and redirect to the login page. If you are interested in pop-up window, you break the MVC model, and it can be implemented of course, but your life will be much harder ....
score: -1

http://stackoverflow.com/a/25639311
has comment: http://stackoverflow.com/comment/40103392
has comment: http://stackoverflow.com/comment/40060975
answers question: http://stackoverflow.com/q/25639075
has comment: http://stackoverflow.com/comment/40114311
has body: When you stop the service it is true it loses its information if the application is destroyed. That is because that instance of the service is tied to that particular instance of the application. In my opinion, an easy fix would be to store the information you still need in some type of persistent storage (SQLite, Internal/External Memory, Shared Preferences) Then, every time you start your service with a new application launch just be sure to reload the information you want from whichever persistent storage method you choose. Also, assuming you don't want this service to continue if the application is killed by the user, be sure to send an intent to the service to stop it like this: intent = new Intent(this, BackgroundLocationService.class); stopService(intent);
has comment: http://stackoverflow.com/comment/40060805
type: Answer
has comment: http://stackoverflow.com/comment/40078623
has comment: http://stackoverflow.com/comment/40060254
score: 0

http://stackoverflow.com/comment/40064405
score: 0
has text: Thank you, this implementation works like a charm. I have expanded `isValue(Object)` method to also include another classes which were needed in my project (see my post).
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25632340

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/25711970
tags question: http://stackoverflow.com/q/25678815
tags question: http://stackoverflow.com/q/25676062
tags question: http://stackoverflow.com/q/25616733
tags question: http://stackoverflow.com/q/25556624
tags question: http://stackoverflow.com/q/25584037
tags question: http://stackoverflow.com/q/25646802
tags question: http://stackoverflow.com/q/25643993
tags question: http://stackoverflow.com/q/25592622
tags question: http://stackoverflow.com/q/25687824
tags question: http://stackoverflow.com/q/25553881
tags question: http://stackoverflow.com/q/25679354
tags question: http://stackoverflow.com/q/25636311
tags question: http://stackoverflow.com/q/25673757
tags question: http://stackoverflow.com/q/25650857
tags question: http://stackoverflow.com/q/25605898
tag name: xml
tags question: http://stackoverflow.com/q/25572084
tags question: http://stackoverflow.com/q/25571977
tags question: http://stackoverflow.com/q/25686271
tags question: http://stackoverflow.com/q/25574987
tags question: http://stackoverflow.com/q/25661415
tags question: http://stackoverflow.com/q/25638297
tags question: http://stackoverflow.com/q/25613642
tags question: http://stackoverflow.com/q/25699417
tags question: http://stackoverflow.com/q/25661853
tags question: http://stackoverflow.com/q/25710392
tags question: http://stackoverflow.com/q/25687274
tags question: http://stackoverflow.com/q/25555313
tags question: http://stackoverflow.com/q/25574740
tags question: http://stackoverflow.com/q/25693027
tags question: http://stackoverflow.com/q/25650964
tags question: http://stackoverflow.com/q/25588555
tags question: http://stackoverflow.com/q/25646558
tags question: http://stackoverflow.com/q/25621097
tags question: http://stackoverflow.com/q/25690830
tags question: http://stackoverflow.com/q/25693106
tags question: http://stackoverflow.com/q/25711431
tags question: http://stackoverflow.com/q/25623264
tags question: http://stackoverflow.com/q/25570391
type: Tag
tags question: http://stackoverflow.com/q/25645848
tags question: http://stackoverflow.com/q/25676752
tags question: http://stackoverflow.com/q/25705860
tags question: http://stackoverflow.com/q/25554592
tags question: http://stackoverflow.com/q/25560919
tags question: http://stackoverflow.com/q/25696069
tags question: http://stackoverflow.com/q/25631506
tags question: http://stackoverflow.com/q/25698764
tags question: http://stackoverflow.com/q/25562493
tags question: http://stackoverflow.com/q/25553113
tags question: http://stackoverflow.com/q/25703288
tags question: http://stackoverflow.com/q/25609932
tags question: http://stackoverflow.com/q/25646284
tags question: http://stackoverflow.com/q/25607028
tags question: http://stackoverflow.com/q/25704853
tags question: http://stackoverflow.com/q/25657241
tags question: http://stackoverflow.com/q/25621655
tags question: http://stackoverflow.com/q/25670757
tags question: http://stackoverflow.com/q/25696794
tags question: http://stackoverflow.com/q/25626350
tags question: http://stackoverflow.com/q/25635604
tags question: http://stackoverflow.com/q/25696565
tags question: http://stackoverflow.com/q/25562818
tags question: http://stackoverflow.com/q/25603632
tags question: http://stackoverflow.com/q/25609232
tags question: http://stackoverflow.com/q/25587048
tags question: http://stackoverflow.com/q/25637462
tags question: http://stackoverflow.com/q/25564057
tags question: http://stackoverflow.com/q/25643097
tags question: http://stackoverflow.com/q/25645312
tags question: http://stackoverflow.com/q/25691455
tags question: http://stackoverflow.com/q/25592918
tags question: http://stackoverflow.com/q/25676731
tags question: http://stackoverflow.com/q/25708992
tags question: http://stackoverflow.com/q/25560774
tags question: http://stackoverflow.com/q/25702744
tags question: http://stackoverflow.com/q/25628391
tags question: http://stackoverflow.com/q/25613952
tags question: http://stackoverflow.com/q/25637093

http://stackoverflow.com/q/25626280
type: Question
has answer: http://stackoverflow.com/a/25626773
possible better answer: http://stackoverflow.com/a/25626773
tagged with: android-layout
tagged with: android
has title: How to add successive rows of Layouts one by one in Android
has comment: http://stackoverflow.com/comment/40036824
type: AnsweredQuestion
answer count: 2
score: 1
tagged with: java
has body: this is my first time asking something around here :) Let's get to the thread: I'm trying to do the typical "Tap here to add another person". The "person" is another field so I've got already 4 rows for name input, but I want to add one by one until 8 (four more, one each time you tap the "button"). The debug: When I press the Layout, it will make appear the 5th contributor, but If I tap again, it won't appear any contributor else. Any idea of how to fix this? This is my ".xml": [...] //Some Layouts <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.45" android:text="@string/Contributor_Name1_Str" android:textSize="17dip" /> <EditText android:id="@+id/inputPart_1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="5dip" android:layout_weight="0.55" android:singleLine="true" /> [...] //Just as the Contributor 1 [...] //Just as the Contributor 1 [...] //Just as the Contributor 1 <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.45" android:text="@string/Contributor_Name5_Str" android:textSize="17dip" /> <EditText android:id="@+id/inputContributor_5" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="5dip" android:layout_weight="0.55" android:singleLine="true" /> [...] //Just as the Contributor 5 // AKA Visibility = GONE [...] //Just as the Contributor 5 // AKA Visibility = GONE [...] //Just as the Contributor 5 // AKA Visibility = GONE <ImageView android:id="@+id/add_event" android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="left" android:src="@drawable/ic_add_colab" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.75" android:layout_marginLeft="20dip" android:text="@string/Add_Colab_Field" android:textSize="17dip" /> And here is my "class": // Click en el botón add_colab_field LinearLayout add_colab_field = (LinearLayout…
downvote count: 0
tagged with: android-linearlayout
upvote count: 1
has answer: http://stackoverflow.com/a/25626471
accepted answer: http://stackoverflow.com/a/25626471
favorite count: 0

http://stackoverflow.com/comment/39980845
has text: I am not aware on how to use Jacoco with Ant. The process is to build your project and use Jacoco to generate the Jacoco report. The latest version of Sonar will be able to read the report without any configuration as Jacoco is integrated with Sonar.
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25595401

http://stackoverflow.com/comment/40186406
score: 0
type: Comment
type: QuestionComment
has text: Show more code - how exactly is one `onClick` listener method accessible from another `Activity`?
comment on: http://stackoverflow.com/q/25708589

maven
tags question: http://stackoverflow.com/q/25644851
tags question: http://stackoverflow.com/q/25555711
tags question: http://stackoverflow.com/q/25626369
tags question: http://stackoverflow.com/q/25612997
tags question: http://stackoverflow.com/q/25592290
tags question: http://stackoverflow.com/q/25693966
tags question: http://stackoverflow.com/q/25613410
tags question: http://stackoverflow.com/q/25650476
tags question: http://stackoverflow.com/q/25676570
tags question: http://stackoverflow.com/q/25590294
tags question: http://stackoverflow.com/q/25661210
tags question: http://stackoverflow.com/q/25561421
tags question: http://stackoverflow.com/q/25593473
tags question: http://stackoverflow.com/q/25674839
tags question: http://stackoverflow.com/q/25703706
tags question: http://stackoverflow.com/q/25615330
tags question: http://stackoverflow.com/q/25675016
tags question: http://stackoverflow.com/q/25587603
tags question: http://stackoverflow.com/q/25684905
tags question: http://stackoverflow.com/q/25645944
tags question: http://stackoverflow.com/q/25600953
tags question: http://stackoverflow.com/q/25614272
tags question: http://stackoverflow.com/q/25587538
tags question: http://stackoverflow.com/q/25604831
tags question: http://stackoverflow.com/q/25557919
tags question: http://stackoverflow.com/q/25699568
tags question: http://stackoverflow.com/q/25639336
tags question: http://stackoverflow.com/q/25554762
type: Tag
tags question: http://stackoverflow.com/q/25668020
tags question: http://stackoverflow.com/q/25706525
tags question: http://stackoverflow.com/q/25613003
tags question: http://stackoverflow.com/q/25675542
tags question: http://stackoverflow.com/q/25570454
tags question: http://stackoverflow.com/q/25552692
tags question: http://stackoverflow.com/q/25645392
tags question: http://stackoverflow.com/q/25693013
tags question: http://stackoverflow.com/q/25563539
tags question: http://stackoverflow.com/q/25603402
tags question: http://stackoverflow.com/q/25569565
tags question: http://stackoverflow.com/q/25664494
tags question: http://stackoverflow.com/q/25615834
tags question: http://stackoverflow.com/q/25621601
tags question: http://stackoverflow.com/q/25604532
tags question: http://stackoverflow.com/q/25553668
tags question: http://stackoverflow.com/q/25673755
tags question: http://stackoverflow.com/q/25667687
tags question: http://stackoverflow.com/q/25555483
tags question: http://stackoverflow.com/q/25635887
tags question: http://stackoverflow.com/q/25600298
tags question: http://stackoverflow.com/q/25694626
tags question: http://stackoverflow.com/q/25616663
tags question: http://stackoverflow.com/q/25673532
tags question: http://stackoverflow.com/q/25576538
tags question: http://stackoverflow.com/q/25580862
tags question: http://stackoverflow.com/q/25558180
tags question: http://stackoverflow.com/q/25686132
tags question: http://stackoverflow.com/q/25589027
tags question: http://stackoverflow.com/q/25648248
tags question: http://stackoverflow.com/q/25610544
tags question: http://stackoverflow.com/q/25566681
tags question: http://stackoverflow.com/q/25630172
tags question: http://stackoverflow.com/q/25646091
tags question: http://stackoverflow.com/q/25576884
tags question: http://stackoverflow.com/q/25662161
tags question: http://stackoverflow.com/q/25587091
tags question: http://stackoverflow.com/q/25666473
tags question: http://stackoverflow.com/q/25680990
tags question: http://stackoverflow.com/q/25552499
tags question: http://stackoverflow.com/q/25662048
tags question: http://stackoverflow.com/q/25569723
tags question: http://stackoverflow.com/q/25565596
tags question: http://stackoverflow.com/q/25614139
tags question: http://stackoverflow.com/q/25610281
tags question: http://stackoverflow.com/q/25568339
tags question: http://stackoverflow.com/q/25647381
tags question: http://stackoverflow.com/q/25602313
tags question: http://stackoverflow.com/q/25639870
tags question: http://stackoverflow.com/q/25563795
tags question: http://stackoverflow.com/q/25647294

http://stackoverflow.com/a/25700481
has comment: http://stackoverflow.com/comment/40209678
has comment: http://stackoverflow.com/comment/40174064
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25700320
has body: There's a million ways you could go, but but I would personally put each of the dice in a multidimensional array. First, put each die in an array String[] die1 = new String[]{ "* * * * *", "* *", "* # *", "* *", "* * * * *" } For each line, you can print each die side by side like this System.out.println(die1[0] + " " + die2[0]); // and so on for each of the 5 lines. But instead of die1, die2, etc I'd put each of those arrays into a big dice array so you can easily reference each die by index (die[0][0], die[1][0], etc). String[][] dice = new String[][]{ { "* * * * *", // Die 1 -&gt; this line is dice[0][0] "* *", "* # *", "* *", "* * * * *" }, { "* * * * *", // Die 2 "* # *", "* *", "* # *", "* * * * *" } } Now, printing your lines side by side is as easy as: int roll1 = 2; // Two made int roll2 = 5; // up numbers /* Note that the index will be one off from the reflected number. You may want to subtract 1 from your random number or put a blank die at index 0 */ for(int x=0; x&lt;dice[roll1].length; x++){ System.out.println(dice[roll1][x] + " " + dice[roll2][x]); } This way, you only "draw" each die once instead of dice*numberOfRolls; you don't need a ton of if-elses; and it allows you to print the dice any way you want by concatenating strings.
has comment: http://stackoverflow.com/comment/40171943
downvote count: 0
has comment: http://stackoverflow.com/comment/40216452
answers question: http://stackoverflow.com/q/25700320
score: 3
has comment: http://stackoverflow.com/comment/40174377
type: Answer

http://stackoverflow.com/q/25646558
tagged with: plugins
has comment: http://stackoverflow.com/comment/139149556
has comment: http://stackoverflow.com/comment/40073471
score: 0
has title: Set inheritedByDefault to false in plugin.xml
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/40073950
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40073345
has body: I'm having trouble while developping a maven plugin to find out how to configure the inheritedByDefault property to be set to false in the generated plugin.xml file. Be careful, I don"t speak about the inheritedByDefault property of each mojo, but the general inheritedByDefault property at the root of the plugin tag. Plugin descriptor documentation isn't very loquacious about this subject and I can't find anything on Internet.
tagged with: maven

http://stackoverflow.com/comment/40248410
type: Comment
score: 0
type: AnswerComment
has text: Displaying like this... Congratulate the person on a job well done. Send birthday greetings. .. But need to remove attribute class="nonindent".I have tried to remove attribute but it is removing total front tag
comment on: http://stackoverflow.com/a/25654751

http://stackoverflow.com/comment/40034233
has text: Here: http://stackoverflow.com/questions/21742894/triangle-recursion-java - and there are lots of other answers, on the same topic. Search a little. And please attempt something before asking for our help.
comment on: http://stackoverflow.com/q/25624669
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25672596
type: Answer
accepted answer of: http://stackoverflow.com/q/25672393
has comment: http://stackoverflow.com/comment/40123660
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/40120986
answers question: http://stackoverflow.com/q/25672393
has comment: http://stackoverflow.com/comment/40120676
has comment: http://stackoverflow.com/comment/40120585
has comment: http://stackoverflow.com/comment/40120393
has comment: http://stackoverflow.com/comment/40121097
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40124485
has body: The API documentation says (my emphasis): Waits at most millis milliseconds for this thread to die. A timeout of 0 means to wait forever. This implementation uses a loop of this.wait calls conditioned on this.isAlive. As a thread terminates the this.notifyAll method is invoked. It is recommended that applications not use wait, notify, or notifyAll on Thread instances. The join method is not responsible for the notification, it's the thing doing the waiting. The notifying would be done by whatever JVM code is responsible for terminating the thread.
has comment: http://stackoverflow.com/comment/40120836

http://stackoverflow.com/q/25575605
type: UnansweredQuestion
has title: How to pass configuration object for google visualization column chart from java server?
has comment: http://stackoverflow.com/comment/39956004
has body: I want to draw a column chart on a browser using Google visualization chart. I implemented DataSourceServlet to return the DataTable from the server side. However, I also need to custom format the vAxis ticks. And I want the custom format label comes from the server as well. How can I pass the vAxis.ticks object from the server to the client? I cannot find any method to attach it to the return DataTable object.
has comment: http://stackoverflow.com/comment/39947420
tagged with: google-visualization
score: 0
answer count: 0
tagged with: javascript
has comment: http://stackoverflow.com/comment/40004435
type: Question
tagged with: java

http://stackoverflow.com/comment/39996524
type: QuestionComment
comment on: http://stackoverflow.com/q/25603949
score: 0
type: Comment
has text: What are you using as a cache mechanism? If you're just loading the entire `Valid` table into memory, I will almost guarantee you that this is a bad solution. For any problem.

http://stackoverflow.com/comment/40005092
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/60400/discussion-between-biscuit128-and-peeskillet).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25605901
type: Comment

http://stackoverflow.com/q/25664704
type: UnansweredQuestion
has body: i am new to linkedin Application... can you explain step by step for update status message on linkedin wall?.. i was tried a lot.. but it always displays "** java.lang.reflect.InvocationTargetException sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252) org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvoc…
has comment: http://stackoverflow.com/comment/40107013
has comment: http://stackoverflow.com/comment/40106703
has comment: http://stackoverflow.com/comment/40105961
has comment: http://stackoverflow.com/comment/40106244
type: Question
has comment: http://stackoverflow.com/comment/40131515
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40106208
has comment: http://stackoverflow.com/comment/40106830
has title: post status on linkedin wall usin java
linked to: http://stackoverflow.com/q/25644283
has comment: http://stackoverflow.com/comment/40107080
has comment: http://stackoverflow.com/comment/40105882
tagged with: linkedin-api
has comment: http://stackoverflow.com/comment/40134565
has comment: http://stackoverflow.com/comment/40106292
has answer: http://stackoverflow.com/a/25665442

http://stackoverflow.com/comment/39989217
type: QuestionComment
comment on: http://stackoverflow.com/q/25599648
has text: @askManiac also note that you trying to use a shell command so you need to change your code slightly `String yourShellCommand = "/sbin/hdparm -I /dev/sda | grep Serial"; String[] commandAndArgs = new String[]{ "/bin/sh", "-c", yourShellCommand }; Runtime.getRuntime().exec(commandAndArgs);`
score: 2
type: Comment

http://stackoverflow.com/comment/40118619
comment on: http://stackoverflow.com/a/25671687
has text: No absolutely not the answer
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25590367
has body: Integer.parseInt(color) cant parse the string because its not an integer string "#39add1". You have to use Color.parseColor(color) like the first function. relativeLayout.setBackgroundColor(Color.parseColor(color));
has comment: http://stackoverflow.com/comment/39971577
has comment: http://stackoverflow.com/comment/39971859
upvote count: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25590295
score: 3
accepted answer of: http://stackoverflow.com/q/25590295

http://stackoverflow.com/comment/41095220
score: 0
type: AnswerComment
has text: You are right. JPA returns instances od EntityDetails, so I guess this is the issue. I tried to use @MappedSuperclass annotation on Entity, and it makes that no table is created for that parent class, but still I am not able to retrieve instances od EntityDetails **as** Entity objects. Is it possible at all?
type: Comment
comment on: http://stackoverflow.com/a/25838608

http://stackoverflow.com/a/25633684
has comment: http://stackoverflow.com/comment/40050998
score: 0
accepted answer of: http://stackoverflow.com/q/25633652
has body: You can do that using a simple text editor. However you could also use sed, awk or perl. You can check sed examples here: http://www.brunolinux.com/02-The_Terminal/Find_and%20Replace_with_Sed.html Using sed you can do: sed -i .bak 's#http://local.host/web/test/11#http://web.server/#' yourfile.wsdl In case of java, you can do this easily with a simple string.replace: public class Test{ public static void main(String[] args) { String sentence = "&lt;definitions xmlns:tns=\"http://local.host/web/test/11/soap/testserver.php\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns=\"http://schemas.xmlsoap.org/wsdl/\" name=\"DatixInterface\" targetNamespace=\"http://local.host/web/test/11/soap/testserver.php\"&gt;"; String str = sentence.replaceAll("http://local.host/web/test/11", "http://web.server/"); System.out.println(str); } } Btw, if you want to load the content of a file and replace those strings you can use the good friend Apache commons: File file = new File("D:\\yourfile.wsdl"); String fileString = FileUtils.readFileToString(file); String finalString = fileString.replaceAll("http://local.host/web/test/11", "http://web.server/"); FileUtils.writeStringToFile(file, finalString);
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40051016
type: Answer
has comment: http://stackoverflow.com/comment/40051086
answers question: http://stackoverflow.com/q/25633652
has comment: http://stackoverflow.com/comment/40051111

http://stackoverflow.com/a/25706495
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25706370
has body: If you are using Servlet 3.0, you can use its asynchronous feature. e.g.: @WebServlet(urlPatterns={"/processFile"}, asyncSupported=true) @MultipartConfig public class CorreoServlet extends HttpServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // (2) Save client's file final Part filePart = request.getPart("file"); // &lt;input name="file" ... ... AsyncContext asyncContext = req.startAsync(); asyncContext.start(new Runnable() { @Override public void run() { // (4) Process client's file // (5) Send result to client's email. } }); // (3) Show "Your result will ... } } Maybe you want to see: Java File Upload Example with Servlet 3.0 API The Java EE 7 Tutorial : Asynchronous Processing Java - Sending Email using JavaMail API
score: 0
has comment: http://stackoverflow.com/comment/40190570
type: Answer
has comment: http://stackoverflow.com/comment/40187948
answers question: http://stackoverflow.com/q/25706370
has comment: http://stackoverflow.com/comment/40187040

http://stackoverflow.com/comment/39914765
type: QuestionComment
has text: could you also please share your implementation.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25559640

http://stackoverflow.com/q/25650568
type: AnsweredQuestion
tagged with: java
has body: I want to add the image name to my database and the image to the folder but i dont know what am i doing wrong, Both the coding for the database uploading and the form is given below: &lt;form method="get" enctype="multipart/form-data" action="imgUpload.jsp"&gt; &lt;input type="file" name="image"&gt; &lt;input type="submit" &gt; &lt;/form&gt; and for the jsp coding: try{ String ImageFile=""; String itemName = ""; boolean isMultipart = ServletFileUpload.isMultipartContent(request); if (!isMultipart){ } else{ FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List items = null; try{ items = upload.parseRequest(request); } catch (FileUploadException e){ e.getMessage(); } Iterator itr = items.iterator(); while (itr.hasNext()){ FileItem item = (FileItem) itr.next(); if (item.isFormField()){ String name = item.getFieldName(); String value = item.getString(); if(name.equals("image")){ ImageFile=value; } } else{ try{ itemName = item.getName(); File savedFile = new File(config.getServletContext().getRealPath("/")+"\\img\\gamePoster\\"+itemName); item.write(savedFile); } catch (Exception e){ out.println("Error"+e.getMessage()); } } } try{ String str="insert into test (img_name) values ('"+itemName+"')"; Statement stmt=con.createStatement(); int rs=stmt.executeUpdate(str); } catch(Exception el){ out.println("Inserting error"+el.getMessage()); } } } catch (Exception e){ out.println(e.getMessage()); }
downvote count: 3
possible better answer: http://stackoverflow.com/a/25650713
has title: Image Upload in JSP
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25662769
has comment: http://stackoverflow.com/comment/40080741
tagged with: java-server
upvote count: 0
has answer: http://stackoverflow.com/a/25662769
score: -3
tagged with: jsp
has answer: http://stackoverflow.com/a/25650713
has comment: http://stackoverflow.com/comment/40082424
favorite count: 0

http://stackoverflow.com/a/25667000
has comment: http://stackoverflow.com/comment/40110159
has body: Goto to eclipse folder and check in eclipse.ini which version is set over there. If it does not match with your JRE version change it by using this one -vmargs -Dosgi.requiredJavaVersion=1.6
type: Answer
score: -1
answers question: http://stackoverflow.com/q/25666851
upvote count: 0
downvote count: 1

http://stackoverflow.com/q/25710200
has answer: http://stackoverflow.com/a/25710218
downvote count: 1
tagged with: arrays
answer count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40189228
has body: I'm trying to create a 12x12 times table chart using a two dimensional array. I tried the below code to actually create the array: int[][] table = new int[12][12]; for (int row=0; row&lt;12; row++){ for (int col=0; col&lt;12; col++){ table[row][col] = row+1 * col+1; } } Now I can't quite figure out how to display it properly, I tried this: for(int row=0; row&lt;table.length; row++) { for(int col=0; col&lt;table[row].length; col++) System.out.print(table[row][col] + "\t"); System.out.println(); } This gives a 12x12 table but there is no multiplication going on, the 12x12 spot (12th col 12th row in grid) is 23 instead of 144, which now makes me think the actual array is wrong. Any ideas?
tagged with: foreach
score: 0
has title: Creating and printing a multiplication table using a two dimensional arrays?
tagged with: for-loop
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40189306

http://stackoverflow.com/comment/40180114
score: 1
type: Comment
has text: What about `byte[]`, `short[]` and `char[]`?
comment on: http://stackoverflow.com/a/25705074
type: AnswerComment

http://stackoverflow.com/a/25603192
upvote count: 7
answers question: http://stackoverflow.com/q/25603191
has body: These are valid workarounds: Explicitly calling the test(Integer[]) method using an array argument: var API = Java.type("nashorn.test.API"); API.test([1]); Removing the overload: public class AlternativeAPI1 { public static void test(Integer... args) { System.out.println("OK"); } } Removing the varargs: public class AlternativeAPI3 { public static void test(String string) { throw new RuntimeException("Don't call this"); } public static void test(Integer args) { System.out.println("OK"); } } Replacing String by CharSequence (or any other "similar type"): public class AlternativeAPI2 { public static void test(CharSequence string) { throw new RuntimeException("Don't call this"); } public static void test(Integer args) { System.out.println("OK"); } }
type: Answer
score: 7
downvote count: 0

http://stackoverflow.com/comment/40252747
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25686662
has text: @leonardo, after doing the static setRGB, do a getRGB on the same pixel, the returned value should be the same ... if the value does change, then you need to find out why? Maybe it has to do with the imageType being used in the constructor?

http://stackoverflow.com/q/25565590
has answer: http://stackoverflow.com/a/25884836
type: Question
type: UnansweredQuestion
has title: Missing required Permissions manifest attribute in Main JAR
tagged with: manifest
tagged with: security
score: 0
tagged with: java
answer count: 1
tagged with: applet
has body: When I want to load an Applet on the server, the browser shows: java.lang.SecurityException: Missing required Permissions manifest attribute in main jar: http://&lt;my server&gt;:9080/ram7.5.2.1/applets/lifecycle.jar at com.sun.deploy.security.DeployManifestChecker.verifyMainJar(Unknown Source) at com.sun.deploy.security.DeployManifestChecker.verifyMainJar(Unknown Source) at sun.plugin2.applet.Plugin2Manager.isAppletTrusted(Unknown Source) at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Thread.java:795) Ignored exception: java.lang.SecurityException: Missing required Permissions manifest attribute in main jar: http://&lt;my server&gt;:9080/ram7.5.2.1/applets/lifecycle.jar But the problem is I have already put the attribute in the manifest file,like this: Manifest-Version: 1.0 Created-By: 1.6.0 Permissions: all-permissions Application-Library-Allowable-Codebase: * Application-Name: SearchApplet Caller-Allowable-Codebase: * I don't want to change the Java Security Level or put the site into the Exception site list.

http://stackoverflow.com/q/25570850
upvote count: 7
downvote count: 1
favorite count: 0
type: Question
has body: I'm using Hazelcast as a shared map in my application. My map is like that: Map&lt;String, MyObject&gt; and MyObject: class MyObject implements Serializeble { // Map FieldName -&gt; FieldValue Map&lt;String, Object&gt; myMap; } So I'd like to use Hazelcast distributed query support to query in my object. I've checked that Hazelcast uses get's method to retrieve the object value, but in my case I don't have a get, instead of I'd like to implement my own getField like: Object getField(String fieldName) { return myMap[fieldName]; } And force Hazelcast to call this method. As a workaround, I've hacked Hazelcast code to use a CustomGetter in the class /hazelcast/src/main/java/com/hazelcast/query/impl/ReflectionHelper.java line 144: if (localGetter == null) { localGetter = new CustomFieldGetter(name, obj); } and here My CustomFieldGetter class: static class CustomFieldGetter extends Getter { final Object value; final Class type; final String fieldName; CustomFieldGetter(String fieldName, Object obj) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { super(null); this.fieldName = fieldName; this.value = obj.getClass().getMethod("getField", String.class).invoke(obj, fieldName); this.type = value.getClass(); } @Override Object getValue(Object obj) throws Exception { return value; } @Override Class getReturnType() { return type; } @Override boolean isCacheable() { return false; } @Override public String toString() { return "FieldGetter [parent=" + parent + ", field=" + fieldName + "]"; } } Ok cool, after recompilation of Hazelcast, and using this new jar, I could reach queries using plain sql. But for pagingQueries I got some errors. So my finally question is: I'd like to avoid hack Hazelcast code (for further updates). Does Hazelcast has some supports on this issue? Is there any other solution for this problem? PS: I'm using Hazelcast version -> hazelcast-3.3-RC3 Thanks in advance.
has comment: http://stackoverflow.com/comment/40033328
tagged with: hazelcast
has title: Hazelcast query in custom objects
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25618698
has answer: http://stackoverflow.com/a/25618698
tagged with: sql
tagged with: java
answer count: 1
score: 6
has comment: http://stackoverflow.com/comment/40017498

http://stackoverflow.com/q/25559640
tagged with: rest
has comment: http://stackoverflow.com/comment/39916056
tagged with: java
has comment: http://stackoverflow.com/comment/40309291
tagged with: ssl
has title: REST API call running fine over HTTPS for one programming language but not for others
tagged with: https
tagged with: coldfusion
type: Question
has comment: http://stackoverflow.com/comment/40388911
has comment: http://stackoverflow.com/comment/39914765
answer count: 0
has body: Well, I have been testing REST API calls recently using different programming languages like Coldfusion, PHP, Java, and ASP.NET I was using "http" initially in my URL initially for making an API call and all of the API calls were working fine in all the languages. Say for example my url was: http://www.myapi.com/webapi/roothost/xyz But now, recently, the box(IP corresponding to www.myapi.com) to which I was sending an API call has been operating on SSL so it should no longer support "http" but "https". This is also evident from the fact that when I try to send an api call in Coldfusion using the old URL which was http://www.myapi.com/webapi/roothost/xyz , it fails. However, I am observing one weird phenomenon for other programming languages(JAVA,ASP.NET,PHP) are concerned. When I try to use "https" as my URL while testing through JAVA,ASP.NET and PHP, the API call fails and it still works with "http" which I don't want. I am using WAMPSERVER, Netbeans 8 and Visual Studio 2012 to make an API call using PHP, JAVA and ASP.NET respectively. Does anybody knows what could be the problem? Please advise
has comment: http://stackoverflow.com/comment/39914240
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40331525
has comment: http://stackoverflow.com/comment/39915526
score: 0
has comment: http://stackoverflow.com/comment/40401323

http://stackoverflow.com/q/25668904
linked to: http://stackoverflow.com/q/20802649
score: 2
linked to: http://stackoverflow.com/q/18298646
answer count: 2
has answer: http://stackoverflow.com/a/25700708
upvote count: 3
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/25789278
downvote count: 1
has answer: http://stackoverflow.com/a/25975698
linked to: http://stackoverflow.com/q/25148136
favorite count: 0
type: Question
has body: I'm looking for some kind of alternative to ImageJ (http://imagej.nih.gov/ij/). For those who don't know, ImageJ is great for analyzing and creating these tif files from scripts that the user writes. However I noticed that using it in a java project (using its jar) is pretty resource intensive. I was wondering if there was some alternative to it that was perhaps better written for developers (doesn't need a GUI but is more efficient with memory).
tagged with: imagej
has title: Java: ImageJ alternative
tagged with: java
tagged with: image-processing
linked to: http://stackoverflow.com/q/20772893

http://stackoverflow.com/a/25709790
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40190660
downvote count: 0
has comment: http://stackoverflow.com/comment/40190419
has body: Okay, you have a couple of quite distinct questions there. The first question, I think, is: Why do you see ? when you output ch2 and ch3 Because you're outputting an invalid character. Java characters represent UTF-16 code points, not actual characters. Some Unicode characters, in UTF-16, require two Java chars for storage. More about UTF-16 here in the Unicode FAQ. In UTF-16, the value 0xFFFF (which is what your ch2 and ch3 contain) is not valid as a standalone value; even if it were, there is no Unicode U+FFFF character. Re the output of ch22: The reason you're seeing a little box is that you're outputting character 0 (the result of (char)65536 is 0, see below), which is a "control character" (all the characters below 32&nbsp;&mdash; the normal space character&nbsp;&mdash; are various control characters). Character 0 is the "null" character, for which there's no generally-accepted glyph that I'm aware of. Why no error when doing int a11 = 65536; char ch22 = (char) a11;? Because that's how Java's narrowing primitive conversions are defined. No error is thrown; instead, only the relevant bits are used: A narrowing conversion of a signed integer to an integral type T simply discards all but the n lowest order bits, where n is the number of bits used to represent type T. In addition to a possible loss of information about the magnitude of the numeric value, this may cause the sign of the resulting value to differ from the sign of the input value.
has comment: http://stackoverflow.com/comment/40190201
has comment: http://stackoverflow.com/comment/40188749
has comment: http://stackoverflow.com/comment/40190738
accepted answer of: http://stackoverflow.com/q/25709385
has comment: http://stackoverflow.com/comment/40188961
type: Answer
answers question: http://stackoverflow.com/q/25709385
score: 2
upvote count: 2

http://stackoverflow.com/q/25597215
score: 0
has comment: http://stackoverflow.com/comment/39984287
has comment: http://stackoverflow.com/comment/40136296
has answer: http://stackoverflow.com/a/25653921
has answer: http://stackoverflow.com/a/25681554
has answer: http://stackoverflow.com/a/25657441
has comment: http://stackoverflow.com/comment/39983698
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40181584
has comment: http://stackoverflow.com/comment/39983815
possible better answer: http://stackoverflow.com/a/25664512
accepted answer: http://stackoverflow.com/a/25746991
answer count: 6
has comment: http://stackoverflow.com/comment/40157488
has comment: http://stackoverflow.com/comment/39983646
has answer: http://stackoverflow.com/a/25664512
has answer: http://stackoverflow.com/a/25720974
has title: Writing String to Text File
has comment: http://stackoverflow.com/comment/39984111
has answer: http://stackoverflow.com/a/25746991
type: Question
linked to: http://stackoverflow.com/q/11027074
has body: I am saving a log to a .txt file on the sdcard but once there is two lines saved, it overwrites it and starts over? Here is my code: public static String getTimestamp() { try { SimpleDateFormat dateFormat = new SimpleDateFormat("MMMdd HH:mm:ss", Locale.getDefault()); String currentTimeStamp = dateFormat.format(new Date()); // Find todays date return currentTimeStamp; } catch (Exception e) { e.printStackTrace(); return null; } } public static void writeToLog(Context context, String string) { String text = getTimestamp() + " " + string; // ONLY SAVES TWO LINES try { PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(logFile, true))); out.println(text); out.close(); } catch (IOException e) { Log.d(Constants.APP_NAME, e.toString()); } } As soon as you mount /data in recovery, the log files in /sdcard &amp; /data/media/0 show the full log history but not when the device is powered on
has comment: http://stackoverflow.com/comment/40164361
linked to: http://stackoverflow.com/q/1625234
has comment: http://stackoverflow.com/comment/40105748
has comment: http://stackoverflow.com/comment/39983710
has comment: http://stackoverflow.com/comment/40137321
upvote count: 1
has comment: http://stackoverflow.com/comment/40169499
downvote count: 1
has comment: http://stackoverflow.com/comment/40127607
has comment: http://stackoverflow.com/comment/40009075
favorite count: 0
type: AnsweredQuestion
tagged with: bufferedwriter

http://stackoverflow.com/comment/40209293
type: Comment
comment on: http://stackoverflow.com/a/25720415
score: 0
type: AnswerComment
has text: The session factory could be autowired the same way as check manager.

http://stackoverflow.com/comment/39965415
comment on: http://stackoverflow.com/a/25587205
score: 0
type: AnswerComment
has text: i see in your screenshot that your filename differs from its containing java class-(name) (check case sensitivity! Classes always begin with Uppercase Letter!) maybe this can be a problem in "your" environment.
type: Comment

http://stackoverflow.com/comment/40061117
score: 1
type: Comment
type: QuestionComment
has text: add a new line for each `index%3==0`?
comment on: http://stackoverflow.com/q/25639845

http://stackoverflow.com/comment/40100417
score: 0
comment on: http://stackoverflow.com/q/25660300
has text: you can use Threads .... for that study wait and notify .. create a main thread that will wait for all the threads to complete their task and when they complete their tasks main thread will be notified.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25649791
tagged with: nullpointerexception
has title: Nullpointer setadapter in spinner
tagged with: android
tagged with: eclipse
has body: this is my code where there is an error. i think that every its ok but i dont know where is the error this is my code: public class MainActivity extends Activity implements OnItemSelectedListener{ private EditText promAcum; private EditText credCur; private EditText sem; private EditText num_examenes; private EditText editText13; private EditText editText14; private EditText editText15; private EditText editText16; private EditText editText17; private EditText editText18; private EditText editText19; private EditText editText20; private EditText editText21; private Spinner spinner1; public String valorPromAcum; public String valorCredCur; public String valorSem; public String[] numeroExamenes={"3","4","5","6"}; private final static String TAG_FRAGMENT = "TAG_FRAGMENT"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); FragmentManager fm = getFragmentManager(); Fragment fragment = fm.findFragmentById(R.id.fragment_content); if (fragment == null) { FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.fragment_content, new MainFragment()); ft.commit(); } promAcum = (EditText) findViewById(R.id.promAcum); credCur = (EditText) findViewById(R.id.credCur); sem = (EditText) findViewById(R.id.sem); editText13 = (EditText)findViewById(R.id.editText13); editText14 = (EditText)findViewById(R.id.editText14); editText15 = (EditText)findViewById(R.id.editText15); editText16 = (EditText)findViewById(R.id.editText16); editText17 = (EditText)findViewById(R.id.editText17); editText18 = (EditText)findViewById(R.id.editText18); editText19 = (EditText)findViewById(R.id.editText19); editText20 = (EditText)findViewById(R.id.editText20); editText21 = (EditText)findViewById(R.id.editText21); spinner1 = (Spinner) findViewById(R.id.spinner1); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String> (this,android.R.layout.simple_spinner_item,numeroExamenes); dataAdapter.setDropDownViewResource(and…
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25650164
has comment: http://stackoverflow.com/comment/40079276
tagged with: spinner
type: Question
has answer: http://stackoverflow.com/a/25649940

http://stackoverflow.com/a/25705189
score: 0
has body: Your getter and setter should be static since it is a static field. However, since it is a primitive type and that your getter and setter do not process anything particular, I would recommend you to make your counter public so you can access it very easily.
type: Answer
answers question: http://stackoverflow.com/q/25705148

http://stackoverflow.com/comment/40169568
comment on: http://stackoverflow.com/a/25698638
type: AnswerComment
score: 0
type: Comment
has text: @AndrewThompson Do think its better to overwrite `getPreferredSize` of the `JPanel` as _nIcE cOw_ suggested? I think its only more code with the same function

http://stackoverflow.com/q/25642814
type: UnansweredQuestion
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/40066234
score: 1
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40097020
has title: editing the jar files
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40095628
answer count: 0
has body: I was using hibernate 3.5 with spring 3.2 in my application but now I have migrated hibernate to 4.2. I have some custom jar which are having hibernate 3.5 dependent code i.e Session class in org.hibernate.classic package so I need to update my class files kept in custom jar. I used JD GUI tool to get java files, edited them accordingly and end up with a directory containing META-INF and com folder. Now if I try to make jar from this directory , again META-INF folder is being created(I know it happens). so now if I open this jar and delete the generated META-INF folder(I want my META-INF folder intact because it contain dependencies) then JAR becomes corrupt. Kindly let me know the alternative. Thanks in advance

http://stackoverflow.com/q/25712784
has title: Problems with Layout for Login GUI
tagged with: layout
has body: I am trying to make a simple GUI that has the username and password with the textfields under each one. Any help would be greatly appreciated! Here is my code. I cannot figure out how to get everything in it's rightful place. enter code here import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.Color; import java.awt.Font; import java.awt.*; import javax.swing.*; /** */ public class PassWordFrame extends JFrame { private static final int FIELD_WIDTH = 10; private static final int FRAME_WIDTH = 500; private static final int FRAME_HEIGHT = 400; private JLabel instruct; private JLabel username; private JLabel password; private JTextField usertext; private JTextField passtext; private JButton login; private ActionListener listener; String text = ""; public PassWordFrame() { createComponents(); setSize(FRAME_WIDTH, FRAME_HEIGHT); listener = new ClickListener(); } class ClickListener implements ActionListener { public void actionPerformed(ActionEvent event) { System.out.println("Hello"); } } public void createComponents() { Color blue = new Color(0,128,155); Font font = new Font("Times New Roman", Font.BOLD, 14); instruct = new JLabel("Please enter your username and password."); instruct.setFont(font); username = new JLabel("Username: "); username.setFont(font); password = new JLabel("Password: "); password.setFont(font); usertext = new JTextField(FIELD_WIDTH); passtext = new JTextField(FIELD_WIDTH); login = new JButton("Login"); login.setFont(font); instruct.setForeground(Color.BLACK); login.setForeground(Color.BLACK); username.setForeground(Color.BLACK); password.setForeground(Color.BLACK); login.addActionListener(listener); JPanel panel = new JPanel(); panel.setBackground(blue); panel.add(instruct); panel.add(username); panel.add(usertext); panel.add(password); panel.add(passtext); panel.add(login); add(panel); } }
tagged with: awt
linked to: http://stackoverflow.com/q/24320436
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40224839
has answer: http://stackoverflow.com/a/25715157
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/40225065
tagged with: swing
linked to: http://stackoverflow.com/q/21658144
has comment: http://stackoverflow.com/comment/40224771
type: Question
accepted answer: http://stackoverflow.com/a/25715157

http://stackoverflow.com/comment/39961967
type: QuestionComment
comment on: http://stackoverflow.com/q/25585365
score: 0
type: Comment
has text: You can't access variables that are not declared in the method, class or passed as a method argument. So you could think about passing a list of `JTextField`s (I guess you use that type) and call `setText("")` for every entry. Like `public boolean Clear(List<JTextField> textFields)` and inside the method: (pseudo code) `for each JTextField as entry in textFields { entry.setText(""); }`.

http://stackoverflow.com/comment/39983764
type: QuestionComment
has text: The above code does not work. see //unsure about this
score: 0
comment on: http://stackoverflow.com/q/25597287
type: Comment

http://stackoverflow.com/q/25620726
accepted answer: http://stackoverflow.com/a/25636120
tagged with: spring
has comment: http://stackoverflow.com/comment/40026878
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
tagged with: spring-profiles
has body: I have configured spring.profiles.active environment variable into websphere server and using variable value into spring config file. My Config.xml is like <bean id="propertiesUtil" class="common.PropertiesUtil"> classpath:common.properties classpath:${spring.profiles.active}/env_${spring.profiles.active}_config.properties and getting exception while deploying application into WAS is like : Caused by: java.io.FileNotFoundException: class path resource [${spring.profiles.active}/env_${spring.profiles.active}_config.properties] cannot be opened because it does not exist pls let me know if i missed anything?
has comment: http://stackoverflow.com/comment/40026667
tagged with: java
has comment: http://stackoverflow.com/comment/40026903
answer count: 1
has answer: http://stackoverflow.com/a/25636120
has title: Issue with spring profile not being picked properties value from server env?
has comment: http://stackoverflow.com/comment/40027116
type: Question
has comment: http://stackoverflow.com/comment/40026798

http://stackoverflow.com/q/25560878
has comment: http://stackoverflow.com/comment/39917048
has comment: http://stackoverflow.com/comment/39916449
has comment: http://stackoverflow.com/comment/39917218
has answer: http://stackoverflow.com/a/25570118
has comment: http://stackoverflow.com/comment/39916981
tagged with: jclouds
has comment: http://stackoverflow.com/comment/39931772
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39917386
has comment: http://stackoverflow.com/comment/39926061
has comment: http://stackoverflow.com/comment/39916848
has comment: http://stackoverflow.com/comment/39917683
has comment: http://stackoverflow.com/comment/39916283
has comment: http://stackoverflow.com/comment/39917202
score: 4
has comment: http://stackoverflow.com/comment/39917246
has comment: http://stackoverflow.com/comment/39916232
has comment: http://stackoverflow.com/comment/39917331
has comment: http://stackoverflow.com/comment/39917079
has answer: http://stackoverflow.com/a/25561003
has comment: http://stackoverflow.com/comment/39917001
tagged with: deadlock
has comment: http://stackoverflow.com/comment/39917993
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25569032
answer count: 3
has comment: http://stackoverflow.com/comment/39916890
has comment: http://stackoverflow.com/comment/39917119
has comment: http://stackoverflow.com/comment/39916312
tagged with: java
has answer: http://stackoverflow.com/a/25569032
downvote count: 0
possible better answer: http://stackoverflow.com/a/25561003
tagged with: concurrency
has comment: http://stackoverflow.com/comment/39916870
has body: Please note: I'm tagging this with JClouds because if you read the entire question and comments that ensue, I believe this to be either a bug with JClouds or a misuse of that library. I have an executable JAR that runs, works for a while, finishes the work without throwing any errors/exceptions, and then hangs forever when it should be exiting. I profiled it with VisualVM (paying attention to the running threads), and I also tossed in a log statement to print at the point (at the end of the main() method) where the app hangs. Here is the last part of my main method: Set&lt;Thread&gt; threadSet = Thread.getAllStackTraces().keySet(); for(Thread t : threadSet) { String daemon = (t.isDaemon()? "Yes" : "No"); System.out.println("The ${t.getName()} thread is currently running; is it a daemon? ${daemon}."); } When my JAR executes this code, I see the following output: The com.google.inject.internal.util.Finalizer thread is currently running; is it a daemon? Yes. The Signal Dispatcher thread is currently running; is it a daemon? Yes. The RMI Scheduler(0) thread is currently running; is it a daemon? Yes. The Attach Listener thread is currently running; is it a daemon? Yes. The user thread 3 thread is currently running; is it a daemon? No. The Finalizer thread is currently running; is it a daemon? Yes. The RMI TCP Accept-0 thread is currently running; is it a daemon? Yes. The main thread is currently running; is it a daemon? No. The RMI TCP Connection(1)-10.10.99.8 thread is currently running; is it a daemon? Yes. The Reference Handler thread is currently running; is it a daemon? Yes. The JMX server connection timeout 24 thread is currently running; is it a daemon? Yes. I don't think I have to worry about daemons (correct me if I'm wrong), so filtering that to non-daemons: The user thread 3 thread is currently running; is it a daemon? No. The main thread is currently running; is it a daemon? No. Obviously, the main thread is still running because something is preventing it fr…
has comment: http://stackoverflow.com/comment/39928653
has comment: http://stackoverflow.com/comment/39916926
favorite count: 0
has comment: http://stackoverflow.com/comment/39916225
type: Question
upvote count: 4
has title: Java: how to repair a hung thread?

http://stackoverflow.com/q/25619154
has comment: http://stackoverflow.com/comment/40024136
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40024215
type: Question
has comment: http://stackoverflow.com/comment/40032029
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40025633
has title: get url login password from BasicDatasource bean spring
has body: i need to get url/login and password from this bean: appcontext.getBean("dataSource"); &lt;bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"&gt; &lt;property name="jndiName" value="java:comp/env/jdbc/webDatasource"/&gt; &lt;/bean&gt; Jndi was configured under weblogic If i put a breakpoint in my application, i can see login/url/password int the variable view. But there is no getter on those parameters. How can i get those informations? another method/bean can do this? Today, the solution is to put all this informations into the database, but if i can do it more simply, because if the login or the url change, i don't need to update the DB. thanks a lot.
has comment: http://stackoverflow.com/comment/40059244
tagged with: datasource
tagged with: spring
has comment: http://stackoverflow.com/comment/40023898
has comment: http://stackoverflow.com/comment/40025731
score: 0

http://stackoverflow.com/comment/39904480
comment on: http://stackoverflow.com/q/25553668
score: 0
type: Comment
type: QuestionComment
has text: @Jigar thank you, that helped me uncover the problem actually, an artifactory process that needed restarting.

http://stackoverflow.com/q/25571850
tagged with: p2
has comment: http://stackoverflow.com/comment/39938099
tagged with: eclipse-rcp
score: 0
has title: How can I control what happens after an update?
has body: The latest version of our RCP application has a bug that leads to the application process not being destroyed during a restart after an update. It happens because, during an after-update restart, some Eclipse shutdown routines simply don't get run. As we have some code that blocks multiple executions, the restart does not happen. On Windows, the user must open the Task Manager and manually kill the process. Given this scenario, we are looking for ways to achieve one of the following: Not showing the "do you wish to restart now?" dialog to the user after the update. This way the user will have to manually close and restart the application, leading to the execution of those specific Eclipse shutdown routines. Force the execution of the Eclipse shutdown routines after the update. Is there a way to do any of those two?
tagged with: java
has comment: http://stackoverflow.com/comment/39937136
type: Question
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39937475

http://stackoverflow.com/q/25611427
type: Question
tagged with: android-notification-bar
has title: Can I use NotificationCompat.BigTextStyle without crashing on older devices?
has body: I don't have any device older than 4.1 to test on. I'm trying to test out pushing my notifications with the code below. It's mostly all taken from the Notification documentation. Would my code crash or does the NotificationCompat class handle all of this for me gracefully? Under the "Handling Compatability" section it reads: Handling compatibility Not all notification features are available for a particular version, even though the methods to set them are in the support library class NotificationCompat.Builder. For example, action buttons, which depend on expanded notifications, only appear on Android 4.1 and higher, because expanded notifications themselves are only available on Android 4.1 and higher. To ensure the best compatibility, create notifications with NotificationCompat and its subclasses, particularly NotificationCompat.Builder. In addition, follow this process when you implement a notification: ... So does this mean that if I use the NotificationCompat class it will handle all of the compatibility for me? My code that I'm worried about (because it uses BigTextStyle): NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext).setSmallIcon(R.drawable.ic_launcher).setContentTitle("Title") .setContentText(String.format("%s", message)); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(mContext, ActivityMain.class); // The stack builder object will contain an artificial back stack for // the // started Activity. // This ensures that navigating backward from the Activity leads out of // your application to the Home screen. TaskStackBuilder stackBuilder = TaskStackBuilder.create(mContext); // Adds the back stack for the Intent (but not the Intent itself) stackBuilder.addParentStack(MainActivity.class); // Adds the Intent that starts the Activity to the top of the stack stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPD…
tagged with: android
tagged with: android-notifications
has answer: http://stackoverflow.com/a/25611513
tagged with: notifications
type: UnansweredQuestion
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39899599
comment on: http://stackoverflow.com/q/25552209
score: 2
type: QuestionComment
has text: Any time you're trying to apply the same mutation to multiple data structures, you've got yourself a design smell. Like all the other comments are saying, create a data structure which encompasses all the data elements you need and create a single list of them.
type: Comment

http://stackoverflow.com/q/25645732
downvote count: 1
has comment: http://stackoverflow.com/comment/40071628
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25646108
answer count: 3
tagged with: android
tagged with: java
score: 1
has title: Android - how to switch activity on image click
has comment: http://stackoverflow.com/comment/40071665
has answer: http://stackoverflow.com/a/25645816
type: Question
accepted answer: http://stackoverflow.com/a/25646163
upvote count: 2
tagged with: mobile
has answer: http://stackoverflow.com/a/25646163
has body: Here I've got this code switchact.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent act2 = new Intent(view.getContext(), Activity2.class); startActivity(act2); } }); And i've got image on my activity/layout1. How do I make that when I click on the image it switched to activity 2?
possible better answer: http://stackoverflow.com/a/25645816

http://stackoverflow.com/comment/40121555
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25671460
type: QuestionComment
has text: This question appears to be off-topic because OpenShift does not allow the running of Proxy Servers.

http://stackoverflow.com/comment/39947182
has text: +1 for a question with multiple language tags that's actually relevant to them all.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25576966
score: 1

http://stackoverflow.com/q/25690164
tagged with: netbeans
score: 0
tagged with: singleton
tagged with: java
has title: Non-singleton top component in Netbeans 8.0
answer count: 1
has answer: http://stackoverflow.com/a/25739056
accepted answer: http://stackoverflow.com/a/25739056
type: Question
has body: I'm trying to create a non-singleton Top Component for my Netbeans Platform project. There's a handy wizard for creating all types of files and components, including a singleton Top Component, but nothing for non-singleton ones, even though that would seem like a common use-case. What's going on there - am I missing something? Anyway there's instructions for doing a work-around to get what I want, but it only applies up to Netbeans version 6.9. I've tried it in a later version and the module refuses to load. I'm using Netbeans 8.0. How can I make a non-singleton Top Component?
tagged with: netbeans-platform
type: AnsweredQuestion

http://stackoverflow.com/a/25638936
answers question: http://stackoverflow.com/q/25638643
has body: Array List should have more memory footprints as by default ArrayList will reserve memory for 10 objects while stringbuilder will not. Since string object appended to stringbuilder or added to arraylist will occupy same memory, difference lies in the non utilisation of the reserved space created by Arraylist. In terms of accesiblity arraylist offers more options as compared to StringBuilder
type: Answer
score: 0

http://stackoverflow.com/q/25664851
downvote count: 0
tagged with: layout-manager
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/40107785
possible better answer: http://stackoverflow.com/a/25675130
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17372068
linked to: http://stackoverflow.com/q/17640063
has answer: http://stackoverflow.com/a/25665599
answer count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40106249
accepted answer: http://stackoverflow.com/a/25665599
has title: GridBagLayout cell taking entire row
favorite count: 0
type: Question
tagged with: gridbaglayout
has body: I'm making a small java swing app and I have to create a table with a gridBagLayout in a scrollpane. First the GridBagLayout doesn't align on the top of the pannel. Second, if I center the (1,2,3,4) cells, they are centered in the middle of the panel (not in the middle of the cell). What am I doing wrong ? Here's my code : //Folder -------------------------------------------------------- folderPanel.setBackground(Color.WHITE); folderPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridheight = 1; gbc.gridwidth = 1; gbc.weightx = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTHWEST; JLabel iCell = new JLabel(); JLabel nameCell = new JLabel(); JLabel typeCell = new JLabel(); JLabel dateCell = new JLabel(); iCell.setPreferredSize(new Dimension(50, 60)); iCell.setHorizontalAlignment(SwingConstants.CENTER); nameCell.setPreferredSize(new Dimension(50, 60)); nameCell.setHorizontalAlignment(SwingConstants.CENTER); typeCell.setPreferredSize(new Dimension(50, 60)); typeCell.setHorizontalAlignment(SwingConstants.CENTER); dateCell.setPreferredSize(new Dimension(50, 60)); dateCell.setHorizontalAlignment(SwingConstants.CENTER); int gridy = 0; int i = 0; iCell.setText("#"); gbc.gridx = 0; gbc.gridy = gridy; folderPanel.add(iCell, gbc); //--------------------------------------------- nameCell.setText("Name"); gbc.gridx = 1; gbc.gridy = gridy; folderPanel.add(nameCell, gbc); //--------------------------------------------- typeCell.setText("Type"); gbc.gridx = 2; gbc.gridy = gridy; folderPanel.add(typeCell, gbc); //--------------------------------------------- dateCell.setText("Date"); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.gridx = 3; gbc.gridy = gridy; folderPanel.add(dateCell, gbc); gridy++; i++; DBCursor cursor = imagesCollection.find(); try { while(cursor.hasNext()) { DBObject obj = cursor.next(); iCell = new JLabel(); nameCell = new JLabel(); typeCell = new JLabel(); dateCell = new JLabel();…
has answer: http://stackoverflow.com/a/25675130

http://stackoverflow.com/comment/39967541
type: QuestionComment
has text: For simplicity - can you post some code to see what you mean.
comment on: http://stackoverflow.com/q/25587793
score: 0
type: Comment

spring
tags question: http://stackoverflow.com/q/25557919
tags question: http://stackoverflow.com/q/25610490
tags question: http://stackoverflow.com/q/25661420
tags question: http://stackoverflow.com/q/25639875
tags question: http://stackoverflow.com/q/25674170
tags question: http://stackoverflow.com/q/25603295
tags question: http://stackoverflow.com/q/25667842
tags question: http://stackoverflow.com/q/25704125
tags question: http://stackoverflow.com/q/25687754
tags question: http://stackoverflow.com/q/25710797
tags question: http://stackoverflow.com/q/25629826
tags question: http://stackoverflow.com/q/25617097
tags question: http://stackoverflow.com/q/25635965
tags question: http://stackoverflow.com/q/25683464
tags question: http://stackoverflow.com/q/25676779
tags question: http://stackoverflow.com/q/25680728
tags question: http://stackoverflow.com/q/25592412
tags question: http://stackoverflow.com/q/25694360
tags question: http://stackoverflow.com/q/25598406
tags question: http://stackoverflow.com/q/25684106
tags question: http://stackoverflow.com/q/25683627
tags question: http://stackoverflow.com/q/25689837
tag name: spring
tags question: http://stackoverflow.com/q/25639160
tags question: http://stackoverflow.com/q/25673959
tags question: http://stackoverflow.com/q/25622670
tags question: http://stackoverflow.com/q/25632061
tags question: http://stackoverflow.com/q/25711970
tags question: http://stackoverflow.com/q/25557319
tags question: http://stackoverflow.com/q/25660582
tags question: http://stackoverflow.com/q/25589916
tags question: http://stackoverflow.com/q/25623515
tags question: http://stackoverflow.com/q/25678115
tags question: http://stackoverflow.com/q/25639864
tags question: http://stackoverflow.com/q/25640217
tags question: http://stackoverflow.com/q/25568261
tags question: http://stackoverflow.com/q/25575231
tags question: http://stackoverflow.com/q/25593897
tags question: http://stackoverflow.com/q/25557906
tags question: http://stackoverflow.com/q/25666769
tags question: http://stackoverflow.com/q/25690923
tags question: http://stackoverflow.com/q/25642845
tags question: http://stackoverflow.com/q/25574597
tags question: http://stackoverflow.com/q/25683210
tags question: http://stackoverflow.com/q/25630316
tags question: http://stackoverflow.com/q/25626028
tags question: http://stackoverflow.com/q/25600292
tags question: http://stackoverflow.com/q/25684624
tags question: http://stackoverflow.com/q/25580095
tags question: http://stackoverflow.com/q/25581363
tags question: http://stackoverflow.com/q/25700872
tags question: http://stackoverflow.com/q/25689134
tags question: http://stackoverflow.com/q/25696230
tags question: http://stackoverflow.com/q/25675626
tags question: http://stackoverflow.com/q/25608699
tags question: http://stackoverflow.com/q/25632784
tags question: http://stackoverflow.com/q/25640116
tags question: http://stackoverflow.com/q/25622427
tags question: http://stackoverflow.com/q/25629107
tags question: http://stackoverflow.com/q/25648446
tags question: http://stackoverflow.com/q/25682399
tags question: http://stackoverflow.com/q/25603854
tags question: http://stackoverflow.com/q/25654269
tags question: http://stackoverflow.com/q/25699727
tags question: http://stackoverflow.com/q/25681520
tags question: http://stackoverflow.com/q/25676605
tags question: http://stackoverflow.com/q/25584183
tags question: http://stackoverflow.com/q/25674582
tags question: http://stackoverflow.com/q/25576153
tags question: http://stackoverflow.com/q/25574776
tags question: http://stackoverflow.com/q/25627249
tags question: http://stackoverflow.com/q/25609538
tags question: http://stackoverflow.com/q/25632395
tags question: http://stackoverflow.com/q/25638462
tags question: http://stackoverflow.com/q/25573034
tags question: http://stackoverflow.com/q/25565238
tags question: http://stackoverflow.com/q/25632779
tags question: http://stackoverflow.com/q/25659398
tags question: http://stackoverflow.com/q/25584335
tags question: http://stackoverflow.com/q/25640872

http://stackoverflow.com/a/25659207
accepted answer of: http://stackoverflow.com/q/25658354
answers question: http://stackoverflow.com/q/25658354
score: 0
type: AcceptedAnswer
has body: use this to cancel the request in doInBackground: httpclient.getConnectionManager().shutdown(); onPostExecute method will not execute in this case.
has comment: http://stackoverflow.com/comment/40098000
type: Answer

http://stackoverflow.com/comment/40126983
score: 0
type: Comment
has text: Thanks. I find this in further search: https://stackoverflow.com/questions/13913000/why-doesnt-jaxb-generate-setters-for-lists
type: AnswerComment
comment on: http://stackoverflow.com/a/25676125

http://stackoverflow.com/q/25669845
has comment: http://stackoverflow.com/comment/40115712
has answer: http://stackoverflow.com/a/25670681
tagged with: hash
type: Question
tagged with: hashmap
has body: The source code of java.util.HashMap#put(Object, Object) is public V put(K key, V value) { if (key == null) return putForNullKey(value); int hash = hash(key.hashCode()); int i = indexFor(hash, table.length); for (Entry&lt;K,V&gt; e = table[i]; e != null; e = e.next) { Object k; if (e.hash == hash &amp;&amp; ((k = e.key) == key || key.equals(k))) { V oldValue = e.value; e.value = value; e.recordAccess(this); return oldValue; } } modCount++; addEntry(hash, key, value, i); return null; } I think that if the keys can get the same index in the table(example:key1 and key2 are all in the table[x]), the e.hash == hash will always return true. Is the code e.hash == hash neccessary for .put() method? The only one explanation is that the different key.hashCode() after the operate of the hash() and indexFor() method, the result will be may the same, so the code will be necessary. Is my answer right? Who can tell me, if e.hash == hash is necessary?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40142705
tagged with: java
has title: Java hashmap method .put()
downvote count: 0
upvote count: 1
score: 1
answer count: 1
favorite count: 0

performance
tags question: http://stackoverflow.com/q/25666613
tags question: http://stackoverflow.com/q/25625867
tags question: http://stackoverflow.com/q/25606833
tags question: http://stackoverflow.com/q/25654269
tags question: http://stackoverflow.com/q/25705097
tags question: http://stackoverflow.com/q/25581221
tags question: http://stackoverflow.com/q/25603806
tags question: http://stackoverflow.com/q/25574412
tags question: http://stackoverflow.com/q/25674473
tags question: http://stackoverflow.com/q/25623265
tags question: http://stackoverflow.com/q/25581334
tag name: performance
tags question: http://stackoverflow.com/q/25574962
tags question: http://stackoverflow.com/q/25627408
tags question: http://stackoverflow.com/q/25563477
tags question: http://stackoverflow.com/q/25625401
tags question: http://stackoverflow.com/q/25591063
tags question: http://stackoverflow.com/q/25596471
tags question: http://stackoverflow.com/q/25692372
tags question: http://stackoverflow.com/q/25681397
tags question: http://stackoverflow.com/q/25606487
type: Tag
tags question: http://stackoverflow.com/q/25583297
tags question: http://stackoverflow.com/q/25703006
tags question: http://stackoverflow.com/q/25659045
tags question: http://stackoverflow.com/q/25673536
tags question: http://stackoverflow.com/q/25593533
tags question: http://stackoverflow.com/q/25635940
tags question: http://stackoverflow.com/q/25593196
tags question: http://stackoverflow.com/q/25683624
tags question: http://stackoverflow.com/q/25573616

http://stackoverflow.com/a/25592508
type: Answer
accepted answer of: http://stackoverflow.com/q/25591323
has body: "but I can't seem to get them to all be the same size and display right under each other." Generally this screams out GridLayout. Instead of using two BoxLayout (one vertical and one horizinal) just use a GridLayout(4, 6) (for the number buttons). Keep in mind though that the size of the buttons will be the size of the largest button (which is sqrt). Also I'd recommend staying away from keeping your panels in an array like you are doing. It's difficult to follow the flow of how you want to add everything. Give your panels (and all components for that matter) meaningful names that are self-documenting. For general knowledge on layout managers, check out Laying out Component Within a Container I refactored your code to be able to run it as an applet or as a standalone frame. I also wrapped all the components in a panel and set the layout manager of the content pane to GridBagLayout, so everything does get screwed up if you resize the frame import java.awt.BorderLayout; import java.awt.Container; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class MyCalc extends JApplet implements ActionListener { /** * */ protected static final long serialVersionUID = 3169756252830354073L; private JMenuBar menuBar = new JMenuBar(); private JMenu edit = new JMenu("Edit"); private JMenu view = new JMenu("View"); private JMenu help = new JMenu("Help"); // Instantiated all JPanels used in this Applet //private JPanel[] rows = { new JPanel(), new JPanel(), new JPanel(), // new JPanel(), new JPanel(), new JPanel(), new JPanel() }; JTextField calc = new JTextField(1); private JButton[] buttons = { new JButton("Backspace"), new JButton("CE"), new JButton("C"), new JButton("M…
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25591323

face-recognition
tags question: http://stackoverflow.com/q/25683514
tag name: face-recognition
type: Tag

http://stackoverflow.com/a/25578248
has body: No it's not thread safe. You are not using any synchronization facilities around mainList. The fact that the code didn't throw ConcurrentModificationException does not imply that the code is thread-safe. It merely means you might have a race condition if it's thrown.
has comment: http://stackoverflow.com/comment/39949219
has comment: http://stackoverflow.com/comment/39949161
score: 0
has comment: http://stackoverflow.com/comment/39949236
answers question: http://stackoverflow.com/q/25578210
type: Answer

http://stackoverflow.com/q/25703386
has body: This is more of a conceptual question than technical pertaining to Java. I've noticed lately programmers tend to avoid creating classes to pass data around and simply move it using JSONObject if available or a basic HashMap. A lot of new interviewees choose to use what I call a JavaScript method of coding. So instead of creating class called Address, they would store it all in JSONObject/HashMap and pass it around as Object later casting to appropriate type. Also I notice a lot of try { ... } finally { return str; } structured methods. Is this something normal and accepted these days? To me, it just goes against everything I was thought in school. I mean, no generalization, no encapsulation, etc... And when asked, they claim JSONObject is encapsulation. Well, not disagreeing, but just not something expected. The task is always being done in the end, but the way its done is disturbing to me. This kind of practice produces a lot of loose structures with a lot of potential errors if programmers are not careful. Wasn't java generics created to avoid exactly that? Feel free to move this question to other exchange, but I'd really like to hear some opinions from seasoned folks.
upvote count: 4
score: 3
tagged with: oop
has comment: http://stackoverflow.com/comment/40176958
answer count: 0
tagged with: java
has title: Modern OO practices in Java
downvote count: 1
has comment: http://stackoverflow.com/comment/40177425
favorite count: 0
has comment: http://stackoverflow.com/comment/40176750
type: Question
has comment: http://stackoverflow.com/comment/40176960
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40176763
has comment: http://stackoverflow.com/comment/40176894

http://stackoverflow.com/q/25656937
has comment: http://stackoverflow.com/comment/40092920
has comment: http://stackoverflow.com/comment/40092809
type: Question
has answer: http://stackoverflow.com/a/25660179
type: UnansweredQuestion
tagged with: fortify
tagged with: settings
score: 0
has comment: http://stackoverflow.com/comment/40092742
has body: In my java program, I'm using System.set property, and it's working fine. But in my whole project, I'm not using any System.get property. But when I use Hp fortify tool, it's showing bug as Setting Manipulation. Set property using like this :System.setProperty("java.net.useSystemProxies", "true"); is it wrong way to use,if so can anybody guide me.
tagged with: java
has title: What is wrong when using System.set property in java?
answer count: 1

http://stackoverflow.com/comment/39952366
type: Comment
type: AnswerComment
has text: I have run a micro benchmark with 1500 data points and 3 missing dates in retainDates: my code takes 50 microseconds vs. 80 microseconds for your proposal. So you suggestion does improve biziclop's code significantly but is still slower that the original version. Thanks anyway!
score: 0
comment on: http://stackoverflow.com/a/25578274

http://stackoverflow.com/a/25706493
has body: I'm not going to read your entire code base (@see Hovercraft Full of Eels comments). However, it looks like the problem is that you're not trying to update on the GUI thread. You need to rejoin the thread via SwingUtilities.invokeLater(thingThatUpdates) Some other quick notes, you're not following Java conventions. Class names should be CamelCase not lowerCamelCase. Basically if you work on another thread Swing won't know to update as that thread is "just chillin'" until you tell it to draw. I'd highly recommend doing something SMALL and TESTABLE so that we can help you out, linking to a non-standard GitHub project is really annoying. (I think you're probably a student and students who ask should get some help. As with anything, try to clean it up before you come and this community will be infinitely more useful to you.)
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25706345
downvote count: 0
has comment: http://stackoverflow.com/comment/40182802
type: Answer
answers question: http://stackoverflow.com/q/25706345
score: 2
upvote count: 2

http://stackoverflow.com/a/25720815
score: 0
answers question: http://stackoverflow.com/q/25689161
has body: I solved with this simplified (without try/catch and no control on nullpointer...) code: (Using SVNKit) public static long getWorkingCopyRevisionNumber (String localpath) { SVNStatus status = getWorkingStatus (localpath); Long revNum = status.getCommittedRevision().getNumber(); return revNum; } public static SVNStatus getWorkingStatus (String localpath) { SVNStatusClient statusClient = SVNClientManager.newInstance().getStatusClient(); File f = new File(localpath); SVNStatus status = statusClient.doStatus( f, false); return status; }
type: Answer

http://stackoverflow.com/comment/40057871
has text: The class you mentioned is probably a part of HTTPS HostnameVerifier, so the checks might be specific to HTTPS specs. I'm going to roll on my own, but it seldom hurts to see another implementation. Thanks.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25634147

http://stackoverflow.com/q/25692963
has title: Logback log created in same directory as far at build time
has body: I created a command line tool that ships as an executable jar. When someone uses my tool I do not know where the jar will be located. All of the logging is being done with logback. I want my log file to go to the same directory as the jar file no matter where the jar is located and no matter what the current directory is. My current logback.xml files looks like this. admintool.log UTF-8 %d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"} [%thread] %-5level %logger{35} - %msg %n <appender-ref ref="FILE" /> Does anyone know how I can get the log to go where the jar is? Thanks in advance.
upvote count: 4
has comment: http://stackoverflow.com/comment/40157965
linked to: http://stackoverflow.com/q/5448673
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25693321
score: 4
has comment: http://stackoverflow.com/comment/40158080
tagged with: logging
has answer: http://stackoverflow.com/a/25693321
favorite count: 0
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40158049
has comment: http://stackoverflow.com/comment/40157887
tagged with: java
tagged with: logback
tagged with: gradle

tree
tags question: http://stackoverflow.com/q/25595725
tags question: http://stackoverflow.com/q/25675080
tags question: http://stackoverflow.com/q/25662572
type: Tag
tag name: tree
tags question: http://stackoverflow.com/q/25588041
tags question: http://stackoverflow.com/q/25587003
tags question: http://stackoverflow.com/q/25569437
tags question: http://stackoverflow.com/q/25678639
tags question: http://stackoverflow.com/q/25558826

http://stackoverflow.com/comment/40260498
has text: @CoolGuy Nah, can't compile. I have default code created (right after created a project) and it says "Can not locate java.lang" http://epsiloncool.ru/i/E20140909-211455-001.png
score: 0
comment on: http://stackoverflow.com/q/25708348
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25693083
has body: 1) If we have an import statement e.g.import org.springframework.stereotype.*,how do we know what maven artifacts we have to provide in pom.xml? 2) Given an import statement e.g. above, how do we know which jar (and hence the artifacts) we have to use in as maven dependency. The short cut that i think of is to use a shell script which does jar -xvf and does look for the package which matches which the import statement in the code. use findjar.com and then determine GAV parameters OR use http://search.maven.org/#advancedsearch|gav type in class name
score: 0
answers question: http://stackoverflow.com/q/25693059
has comment: http://stackoverflow.com/comment/40158174
type: Answer
has comment: http://stackoverflow.com/comment/40158145
has comment: http://stackoverflow.com/comment/40158275
has comment: http://stackoverflow.com/comment/40158297

http://stackoverflow.com/comment/40008536
score: 0
type: Comment
has text: One more thing, I did not have the ability to change, I meant add new element, to the returned list it throws this error "Exception in thread "main" java.lang.UnsupportedOperationException at java.util.AbstractList.add(AbstractList.java:131) at java.util.AbstractList.add(AbstractList.java:91)" But you are correct I tried to add new element to the array and still I can have it in the list although I add it after the asList.
type: AnswerComment
comment on: http://stackoverflow.com/a/25610703

http://stackoverflow.com/a/25680520
has comment: http://stackoverflow.com/comment/40140908
has comment: http://stackoverflow.com/comment/40161644
has body: I assume you folder structure is like this: +-- shaker-multi +--- pom.xml +--- shaker-multi-core +-- pom.xml +--- shaker-multi-runnable +-- pom.xml +--- shaker-multi-webapp +-- pom.xml Furthermore you should check if your project works correctly on command and NOT in Eclipse. So you should go to the root of your project (shaker-multi folder) and mvn clean package This should produce no error etc. One thing which comes into my mind is why do you use a release version instead of a SNAPSHOT version for your project. So 0.0.1 instead of 0.0.1-SNAPSHOT? A thing which you should improve is the definintion of maven-compiler plugin in your parent: org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 UTF-8 I would suggest to do it this way: org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 UTF-8 The encoding can be solved in a better way just define the following in your pom: ... <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> ... The above will define the default value for many plugin like maven-compiler-plugin, maven-resources-plugin etc. part from that your structure looks good ...one small improvement i would suggest is if you define dependencies between your module: sunshine.web shaker-multi-core 0.0.1 I would suggest to define inter module dependencies like this: sunshine.web shaker-multi-core ${project.version}
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/40161665
answers question: http://stackoverflow.com/q/25674839
downvote count: 0

http://stackoverflow.com/a/25646005
upvote count: 1
answers question: http://stackoverflow.com/q/25644149
has body: Overriding findOne method solved my problem. I can help anyone having the same problem. mongoTemplate.findOne( Query.query(Criteria.where("itemId").is(Long.decode(itemId))), MyItem.class, collectionName);
type: Answer
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25644149
downvote count: 0

http://stackoverflow.com/comment/56630332
score: 1
has text: sir, you are time saver.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26353514

synonym
tags question: http://stackoverflow.com/q/25711426
type: Tag
tag name: synonym

http://stackoverflow.com/a/25583930
downvote count: 0
has body: It's an example of something that is legal, not something that is useful or recommended. It's showing that the lock is recursive ("Note that this program would deadlock if a single thread were not permitted to lock a monitor more than once").
score: 2
type: Answer
answers question: http://stackoverflow.com/q/25583858
upvote count: 2

http://stackoverflow.com/q/25657747
has answer: http://stackoverflow.com/a/48794545
has title: How to normalize Unicode digits in Java
tagged with: java
possible better answer: http://stackoverflow.com/a/52422820
upvote count: 4
type: AnsweredQuestion
tagged with: normalization
answer count: 3
tagged with: digit
downvote count: 0
linked to: http://stackoverflow.com/q/890686
tagged with: unicode-normalization
score: 4
accepted answer: http://stackoverflow.com/a/25698113
tagged with: unicode
favorite count: 0
has answer: http://stackoverflow.com/a/52422820
type: Question
has body: Is there any Java API to normalize Unicode digits into ASCII digits? There is a normalization API in JDK and ICU4J which seems not to able to handle this kind of normalization (since it's probably not called normalization by Unicode standard) What I need is to convert all forms of Unicode digits (listed in this post) into [0-9]. A possible messy solution is 10 replace-all for any digit from 0 to 9.
has answer: http://stackoverflow.com/a/25698113

http://stackoverflow.com/comment/40033706
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25586853
has text: @MarkusWMahlberg I'm not refusing. I'll give it a go just to see what happens but I think you're still missing the part where I bypassed mongos altogether.
score: 0

http://stackoverflow.com/comment/40057038
type: AnswerComment
score: 0
type: Comment
has text: I only took successfully the last path of the URL, what I want to have is the remaining portion of the whole URL, not the last path.
comment on: http://stackoverflow.com/a/25636563

http://stackoverflow.com/comment/40071637
comment on: http://stackoverflow.com/a/25645626
score: 0
type: AnswerComment
has text: A `toUpper()` should be added to `beginAddress`, `endAdress` and `macAddress`
type: Comment

http://stackoverflow.com/q/25694806
has answer: http://stackoverflow.com/a/25694838
accepted answer: http://stackoverflow.com/a/25694838
tagged with: jprogressbar
tagged with: swing
type: AnsweredQuestion
score: 2
upvote count: 3
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40188873
has body: I have my main GUI thread which has a JprogressBar in it and is implementing ProprtyChangeListener. When a button is pressed, a different class, which extends SwingWorker, kicks into action and performs a series of potentially long calculations. I need the progress bar in class A to present the progress according to a variable in Class B. My code is below (could be a bit messy with all my failed tries...) Would appreciate any help. GUI CLASS: SignalSimulator signalSimulator = new SignalSimulator( path, numOfdataPoints, numOfLocalSpikes, numOfExpSpikes, noiseAmp, slope, offset, rdbtnSineWave.isSelected()); signalSimulator.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { String property = evt.getPropertyName(); if ("progress".equals(property)) { int progress = (Integer) evt.getNewValue(); System.out.println("value in PropertChangeListener is: " + progress); progressBar.setValue(progress); } } }); signalSimulator.execute(); Calculating class: protected Integer doInBackground() throws Exception { if (isSine){ data = generateSineWave(numOfDataPoints, noiseAmp, offset); data = addAnomalies(data, numOfPointOutliers, numOfExpSpikes); } else { data = generateLinearSignal(numOfDataPoints, noiseAmp, slope, offset); data = addAnomalies(data, numOfPointOutliers, numOfExpSpikes); } writeLogFile(path, ".txt", data); firePropertyChange("progress", 1, 1); setProgress((int)progress); publish(progress); System.out.println("value in doInBackground is: " + progress); return 1; } EDIT Original problem remains. For some reason the progress bar is still not updating, I know for sure that the "progress" variable in progressBar.setValue(progress) is updating yet the progress bar in the GUI remains unchanged (fixed at 0) here is my new code: GUI Class: SignalSimulator signalSimulator = new SignalSimulator(path, numOfdataPoints, numOfLocalSpikes, numOfExpSpikes, noiseAmp, slope, offset, rdbtnSineWave.isSelected()); signalSimulator.…
downvote count: 1
favorite count: 0
type: Question
has title: Can't get JProgressBar to update from SwingWorker class
tagged with: swingworker

http://stackoverflow.com/a/25568845
answers question: http://stackoverflow.com/q/25568492
has comment: http://stackoverflow.com/comment/48818724
type: Answer
score: 0
has body: Try this way,hope this will help you to solve your problem. ArrayList&lt;HashMap&lt;String,String&gt;&gt; listMap = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); HashMap&lt;String,String&gt; map1 =new HashMap&lt;String, String&gt;(); map1.put("title","Amdroid1"); HashMap&lt;String,String&gt; map2 =new HashMap&lt;String, String&gt;(); map2.put("title","Amdroid2"); HashMap&lt;String,String&gt; map3 =new HashMap&lt;String, String&gt;(); map3.put("title","Amdroid3"); HashMap&lt;String,String&gt; map4 =new HashMap&lt;String, String&gt;(); map4.put("title","Amdroid4"); HashMap&lt;String,String&gt; map5 =new HashMap&lt;String, String&gt;(); map5.put("title","Amdroid5"); listMap.add(map1); listMap.add(map2); listMap.add(map3); listMap.add(map4); listMap.add(map5); ArrayList&lt;String&gt; listString = new ArrayList&lt;String&gt;(); for(HashMap&lt;String,String&gt; row : listMap){ listString.add(row.get("title")); } String[] array = listString.toArray(new String[listString.size()]); System.out.print("Lenght "+array.length);
accepted answer of: http://stackoverflow.com/q/25568492
type: AcceptedAnswer

http://stackoverflow.com/comment/40243054
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25654592
score: 0
has text: Thanks for your help. I found [a solution](http://stackoverflow.com/a/25738517/1594933) using `@AssistedInject`.

http://stackoverflow.com/comment/39967288
type: QuestionComment
has text: C++ and Java are two different languages and have slightly different rules for polymorphism. I suggest you read a book or tutorial about inheritence and polymorphism. This question has already been answered multiple times.
comment on: http://stackoverflow.com/q/25588310
score: 1
type: Comment

http://stackoverflow.com/q/25583265
has body: OK so if I select hard and then I select easy it gives me this exception in thread AWT-EventQueue-0" java.lang.StackOverflowError I only wanted to see how it works if you have any tips / ideas it would be grateful. Here is the code: import java.awt.Component; import java.awt.Container; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.JCheckBox; import javax.swing.JFrame; public class Difficulty extends JFrame { /** * */ private static JCheckBox easy; private static JCheckBox hard; private static Container pane; private Handeler handeler; private static final long serialVersionUID = 1L; public Difficulty() { super("Select a Difficulty"); pane = new Container(); getContentPane().add(pane); pane.add(Easy()); pane.add(Hard()); } public Component Hard() { handeler = new Handeler(); hard = new JCheckBox("Hard"); hard.setBounds(60, 40, 60, 50); hard.setVisible(true); hard.addItemListener(handeler); return hard; } private Component Easy() { handeler = new Handeler(); easy = new JCheckBox("Easy"); easy.setBounds(60, 0, 60, 50); easy.setVisible(true); easy.addItemListener(handeler); return easy; } public static void main(String[] args) { Difficulty gui = new Difficulty(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setLocationRelativeTo(null); gui.setSize(200, 200); gui.setVisible(true); gui.setResizable(false); } private class Handeler implements ItemListener { @Override public void itemStateChanged(ItemEvent item) { if(item.getSource() == easy){ for(int x = 0; x &lt; 1; x++){ if(hard.isSelected()){ hard.setSelected(false); easy.setSelected(true); }else {easy.setSelected(true);} } }else if(item.getSource() == hard){ for(int x = 0; x &lt; 1; x++){ if(easy.isSelected()){ easy.setSelected(false); hard.setSelected(true); }else{hard.setSelected(true);} } } } }
has answer: http://stackoverflow.com/a/25583337
type: Question
tagged with: swing
tagged with: stack-overflow
type: AnsweredQuestion
score: 0
has title: Came across an issue while creating a difficulty selector
tagged with: java
accepted answer: http://stackoverflow.com/a/25583337
answer count: 1

http://stackoverflow.com/a/25564444
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25564233
downvote count: 0
upvote count: 1
has body: Your 3rd party libraries are being processed twice. Add them to another folder in this case to lib and add the following line to proguard.cfg file. -injars lib/dropbox.jar See Pro Guard Troubleshooting Note: duplicate definition of program/library class Your program jars or library jars contain multiple definitions of the listed classes. ProGuard continues processing as usual, only considering the first definitions. The warning may be an indication of some problem though, so it's advisable to remove the duplicates. A convenient way to do so is by specifying filters on the input jars or library jars. You can switch off these notes by specifying the -dontnote option. As indicated by the link to the ProGuard Troubleshooting page in your console log, you should change the target in project.properties to a target that contains the missing classes. In this case: "android-18" or maybe "Google Inc.:Google APIs:18". You can still specify a different minSdkVersion in AndroidManifest.xml. You should not specify any -libraryjars options, since the Android build process already specifies those options for you -- you'll just see warnings about duplicate classes now. In fact, the Android build process specifies most other options for you as well.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25564233

http://stackoverflow.com/q/25625056
tagged with: velocity
downvote count: 0
has title: How to obtain csrf token in a velocity macro when using spring security
has body: I am trying to create a custom login screen for a spring web security enabled application, and I cannot figure out how to pass the csrf token to velocity (no, I cannot use JSP at the moment). The model looks something like this: @RequestMapping(value = "/login", method = RequestMethod.GET) public ModelAndView login( @RequestParam(value = "error", required = false) String error, @RequestParam(value = "logout", required = false) String logout ModelAndView model = new ModelAndView(); if (error != null) { model.addObject("error", "Invalid username or password!"); } if (logout != null) { model.addObject("msg", "You've been logged out successfully."); } model.setViewName("login"); return model; } And the relevant section of the velocity template looks like (taken and modified from a jsp example): User: Password: Of course, the ${_csrf.parameterName} and ${_csrf.token} variables are empty, so this only works if I disable csrf protection. So my main question is: how do I fill them in the model (or anywhere else)?
tagged with: spring
possible better answer: http://stackoverflow.com/a/37090892
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/37090892
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/3320674
accepted answer: http://stackoverflow.com/a/25639809
has answer: http://stackoverflow.com/a/25639809
favorite count: 0
type: Question
answer count: 2

http://stackoverflow.com/comment/40155244
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25689871
score: 0
has text: @jtahlborn : Like 2 to 3 min. I am in the network which hosts all the servers. Not sure how the performance will be for external users.

merge
type: Tag
tag name: merge
tags question: http://stackoverflow.com/q/25710251
tags question: http://stackoverflow.com/q/25604555
tags question: http://stackoverflow.com/q/25608315

http://stackoverflow.com/a/25619795
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25619676
score: 3
type: Answer
has body: If you go through the Generic Guidelines stated by Oracle docs, these kind of list declarations are tend to be read-only (no write operations can be performed) Quoted from the page A list defined by List&lt;? extends ...&gt; can be informally thought of as read-only, but that is not a strict guarantee. As per your example, let us assume Child2 and Child3 extends Parent, then List&lt;? extends Parent&gt; list can be a list of any of these subclasses. Adding a specific subclass element can cause runtime error, thus compiler complains in advance
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25619676

http://stackoverflow.com/q/25601098
has answer: http://stackoverflow.com/a/25659584
has title: java.lang.NoSuchFieldError: WADL_JSON in creating jersey rest client
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39991069
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
downvote count: 0
score: 1
upvote count: 1
favorite count: 0
type: Question
has body: I am creating jersey rest client with jackson pojo mapping. here is code spinet: ClientConfig clientConfig = new DefaultClientConfig(); clientConfig.getClasses().add(JacksonJsonProvider.class); clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); client = Client.create(clientConfig); webResource = client.resource("url to exposed rest web service"); This code is throwing following exception at line client = Client.create(clientConfig) Sep 01, 2014 12:42:04 PM com.sun.jersey.core.spi.component.ProviderFactory __getComponentProvider SEVERE: The provider class, class com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$Wadl, could not be instantiated. Processing will continue but the class will not be utilized java.lang.NoSuchFieldError: WADL_JSON at com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$Wadl.&lt;init&gt;(JSONRootElementProvider.java:138) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.sun.jersey.core.spi.component.ComponentConstructor._getInstance(ComponentConstructor.java:161) at com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:141) at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:163) at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:134) at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:232) at com.sun.jersey.core.spi.component.ProviderServices.getProvidersAndServices(ProviderServices.java:149) at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:153) at com.sun.jersey.core.spi.factory.Message…
tagged with: rest
accepted answer: http://stackoverflow.com/a/25659584
tagged with: jersey

http://stackoverflow.com/a/25570597
type: Answer
answers question: http://stackoverflow.com/q/25570390
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39935275
has body: It seems your plugin is not able to find the ModelControllerClient. It has a missing dependency on the org.jboss.as:jboss-as-controller-client. I should recommend using this plugin: https://docs.jboss.org/jbossas/7/plugins/maven/latest/ Because i use and i know it works. Take a look at how to configure it: https://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/deployment-example.html
has comment: http://stackoverflow.com/comment/40005318
has comment: http://stackoverflow.com/comment/39936726

http://stackoverflow.com/q/25658761
has comment: http://stackoverflow.com/comment/40095869
has title: can we use Hashmap in multithreaded environment?
has body: Hashmap is not synchronized. Suppose I want to use Hashmap in multithreaded environemnt. what will be the behaviour of hashmap?
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/40095931
answer count: 2
has comment: http://stackoverflow.com/comment/40095911
has comment: http://stackoverflow.com/comment/40096088
linked to: http://stackoverflow.com/q/510632
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/25658822
score: -3
favorite count: 0
has comment: http://stackoverflow.com/comment/40096667
has comment: http://stackoverflow.com/comment/40096700
downvote count: 3
has answer: http://stackoverflow.com/a/25658812
linked to: http://stackoverflow.com/q/11050539
tagged with: java

http://stackoverflow.com/a/25685525
answers question: http://stackoverflow.com/q/25685383
type: Answer
score: 0
has body: There are tow ways. print your data in a js variable. var data = "${user.id}"; give every &lt;li&gt; a id or class attribute. so you can retrieve the date via. var data1 = document.getElementByID().value; or jQuery $(#'').val();

http://stackoverflow.com/comment/40140488
type: AnswerComment
comment on: http://stackoverflow.com/a/25683823
score: 0
type: Comment
has text: Try qualifier anyway.

http://stackoverflow.com/q/25583596
has comment: http://stackoverflow.com/comment/39959486
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25595864
has answer: http://stackoverflow.com/a/25595864
has body: i have basic downloader class where i download and decode bitmap as well. but if i try to decode out of this class, i get my bitmap = null. public void add_item(String _txt, String _url) { try { Downloader dw = new Downloader(_url, context); InputStream s = dw.execute().get(); Bitmap b = BitmapFactory.decodeStream(s); // &lt;&lt;&lt;&lt;&lt;&lt; bitmap is null bmp.add(b); } catch (ExecutionException e) { Toast.makeText(this.context, "Ошибка загрузки картинки", Toast.LENGTH_SHORT).show(); } catch (InterruptedException e) { Toast.makeText(this.context, "Ошибка загрузки картинки", Toast.LENGTH_SHORT).show(); } } downloader.java package com.example.john.weather; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.widget.Toast; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class Downloader extends AsyncTask&lt;Void, Void, InputStream&gt; { String url; Context mContext; public Downloader(String _url, Context _context){ this.url = _url; this.mContext = _context; } @Override protected InputStream doInBackground(Void... params) { InputStream s; try{ s = download(this.url); //Bitmap b = BitmapFactory.decodeStream(s); // &lt;&lt;&lt;&lt;&lt;&lt; Bitmap is good return s; } catch (MalformedURLException e) { Toast.makeText(mContext, "Ошибка загрузки "+url, Toast.LENGTH_SHORT).show(); return null; } catch (IOException e){ Toast.makeText(mContext, "Ошибка загрузки "+url, Toast.LENGTH_SHORT).show(); return null; } } private InputStream download(String url) throws IOException { HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); connection.connect(); InputStream input = connection.getInputStream(); return input; } } i have basic downloader class where i download and decode bitmap as well. but if i try to decode out of this class, i get my bitmap = nul…
downvote count: 0
upvote count: 1
has title: losing data betwen classes
favorite count: 0
possible better answer: http://stackoverflow.com/a/25584262
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25584262
has comment: http://stackoverflow.com/comment/39959588
score: 1
tagged with: android
tagged with: java

http://stackoverflow.com/comment/40145136
type: QuestionComment
score: 0
has text: @M.Deinum I finally chose your solution. If you post an answer I am going to accept it!
comment on: http://stackoverflow.com/q/25684624
type: Comment

http://stackoverflow.com/a/25588031
type: Answer
downvote count: 0
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25586854
has body: Is that another instance of the 'textures that have sizes not power of 2' problem ? lwjgl will extend your texture to a power of 2 size, meaning your UV coordinates that are [0...1] will be wrong, they should be [0 ... 0.5783] because the rest is lwjgl padding to reach power of 2. Can't find a reference...
has comment: http://stackoverflow.com/comment/39973422

http://stackoverflow.com/a/25695570
has comment: http://stackoverflow.com/comment/40162841
has comment: http://stackoverflow.com/comment/40163100
has comment: http://stackoverflow.com/comment/40163056
has comment: http://stackoverflow.com/comment/40164488
score: 1
has body: If I understand you correctly you want to use a menu item to switch to a specific tab, right? To change to a tab grammatically you can use setSelectedNavigationItem like this: ActionBar actionBar = getActionBar(); actionBar.setSelectedNavigationItem(0); //this will put the screen to the first tab (tab at index 0). If you want to do this with a menu item just put it in onMenuItemSelected. Let me know if you need me to explain in more detail. =================EDIT===================== ah i think i understand, so replace the current tab fragment with another one in its place? I think you can do that by: actionBar.removeTabAt(position); //position is the current tab position. actionBar.addTab(tab, position); //insert a new tab at that position if its not selected after you insert it, try this: actionBar.addTab(tab, position, setSelected) i did not test this, so let me know if it does not work.
answers question: http://stackoverflow.com/q/25695394
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40164467
type: Answer

http://stackoverflow.com/comment/40145858
has text: Check if you dont have a copy of your jsp under the app directory.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25686759

http://stackoverflow.com/q/25646335
has comment: http://stackoverflow.com/comment/40210077
has comment: http://stackoverflow.com/comment/40185074
tagged with: playframework-2.0
has comment: http://stackoverflow.com/comment/40094645
accepted answer: http://stackoverflow.com/a/25675344
tagged with: playframework
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25675344
score: 1
upvote count: 1
tagged with: playframework-2.2
has body: In my application authentication scheme is based on user and role. users with particular role have access to particular action method. To implement this I have done following 1.Write custom action public class Authorization extends play.mvc.Action.Simple { public Promise&lt;Result&gt; call(Context ctx) throws Throwable { //check access return delegate.call(ctx); } } 2.Annotate controller with action @With(actions.Authorization.class) public class Upload extends Controller { .... } In my action I have access to user which is in session. I want to get current controller and action so that I can authenticate user. Is there any way to this? I have read about creating custom annotation with params and in each controller pass parameters to identify the action. But it seems to much work and error prone if by mistake i write wrong action name while copy paste. Thanks
favorite count: 0
has title: Play framework 2.2: How to get current controller and action in java
type: Question
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40076055

http://stackoverflow.com/comment/39924030
score: 0
comment on: http://stackoverflow.com/q/25561515
has text: Right only sharing going on is the name of the variables. Unfortunately I'm not using Spring though I'm using Google App Engine
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40181786
type: AnswerComment
score: 0
has text: Yes, I understand that it'll work. The reason we have it in a separate private method is that in reality the exception handling is much more complicated and we don't want it to fly everywhere.
comment on: http://stackoverflow.com/a/25705969
type: Comment

http://stackoverflow.com/comment/40200414
type: Comment
has text: Thank you. Had a typo there. Fixed
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25677270

http://stackoverflow.com/comment/40172767
type: Comment
has text: I added my implementation of the adapter, if you could take a look, I'd appreciate :)
type: QuestionComment
comment on: http://stackoverflow.com/q/25683942
score: 0

http://stackoverflow.com/q/25643938
tagged with: java
linked to: http://stackoverflow.com/q/11260102
downvote count: 0
has answer: http://stackoverflow.com/a/25644172
has answer: http://stackoverflow.com/a/25643987
has answer: http://stackoverflow.com/a/25644876
favorite count: 0
type: Question
score: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25643990
has title: Is a mutable object still constant
answer count: 4
tagged with: constants
has comment: http://stackoverflow.com/comment/40069046
has body: If i have an object lets say for example public class Person { private int age; public Person(int age) { this.age = age; } public void setAge(int age) { this.age = age; } public int getAge() { return age; } } and public static final Person PERSON = new Person(12); Because I still can change the age is it not considered constant?
upvote count: 3
has comment: http://stackoverflow.com/comment/40069122

http://stackoverflow.com/q/25581650
has answer: http://stackoverflow.com/a/25581693
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/9854166
upvote count: 4
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39955435
score: 4
has answer: http://stackoverflow.com/a/25581999
type: AnsweredQuestion
has title: Java left shift and fill with Zeros
has comment: http://stackoverflow.com/comment/48807403
tagged with: bit-shift
tagged with: java
has body: I want to do left shifting but filling with zero, just like int number = 20 &gt;&gt;&gt; 10 = ( 0000 0000 0000 0000 0000 0000 0001 0100 ) int number = 20 &gt;&gt;&gt; 32‎ = ( 0000 0000 0000 0000 0000 0000 0000 0000 ) I want to do the same with left shift, since there is no operator &lt;&lt;&lt; for leftshift int number = 20 &lt;&lt; 32 = 0000 0000 0000 0000 0000 0000 0001 0100 ; I want to fill it with zeros just like >>> operator. So how I can do this?
accepted answer: http://stackoverflow.com/a/25581693
has comment: http://stackoverflow.com/comment/39955281
possible better answer: http://stackoverflow.com/a/25581999

http://stackoverflow.com/comment/40026781
type: AnswerComment
has text: the blog post is about eclipselink. do I need to switch from toplink to eclipselink to do this?
score: 0
comment on: http://stackoverflow.com/a/25619869
type: Comment

http://stackoverflow.com/comment/40049527
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25632292
score: 0
has text: Try something simplier: `SELECT c FROM Customer c` to fetch only Customers and `SELECT c FROM Customer c left join fetch c.addressCollection` to return everything you need.

http://stackoverflow.com/a/25661247
accepted answer of: http://stackoverflow.com/q/25661036
type: Answer
answers question: http://stackoverflow.com/q/25661036
has comment: http://stackoverflow.com/comment/40148222
score: 0
type: AcceptedAnswer
has body: Suggest you to move this operation to native library (C/C++). You can pass whole Bitmap object to native library function and modify content of Bitmap without copy pixels back and forth. Even optimization in assembler can be applied. Or more simpler try to optimize your code.

http://stackoverflow.com/a/25703426
answers question: http://stackoverflow.com/q/25703348
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40176799
has comment: http://stackoverflow.com/comment/40176818
score: 2
has body: Remove library project android-support-v7-appcompact and add it again properly. also check your package name in manifest file. update SDK Build Tools on SDK Tools -> SDK Platform Tools, if not, please try it and clean &amp; rebuild. check imports to see any broken R.java imports. if there is "import android.R;" remove it. check style and layout xmls to prevent any missing drawables or depreciates. also see : R cannot be resolved - Android error
has comment: http://stackoverflow.com/comment/40177117
accepted answer of: http://stackoverflow.com/q/25703348
has comment: http://stackoverflow.com/comment/40177076
has comment: http://stackoverflow.com/comment/40176915

http://stackoverflow.com/a/25562072
has body: The main problem is, once you've read the number of stones to be entered, you never initialise the gemArray before you use it... numOfStones = Integer.parseInt(in.nextLine()); //in.nextLine(); System.out.println(numOfStones); //reading the strings for (int i = 0; i &lt; numOfStones; i++) { gemArray[i] = in.nextLine(); System.out.println(gemArray[i]); } You should use the numOfStones value to initialise the gemArray numOfStones = Integer.parseInt(in.nextLine()); //in.nextLine(); System.out.println(numOfStones); // Intialise gemStones here... gemStones = new String[numOfStones]; //reading the strings for (int i = 0; i &lt; numOfStones; i++) { gemArray[i] = in.nextLine(); System.out.println(gemArray[i]); }
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25562045
type: Answer
score: 1

http://stackoverflow.com/q/25604215
linked to: http://stackoverflow.com/q/38035179
favorite count: 0
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25604448
has answer: http://stackoverflow.com/a/68949654
answer count: 6
linked to: http://stackoverflow.com/q/19498378
tagged with: spring
score: 27
upvote count: 27
tagged with: mockmvc
has answer: http://stackoverflow.com/a/33174853
has title: Register @ControllerAdvice annotated Controller in JUnitTest with MockMVC
tagged with: spring-mvc
has body: My @ControllerAdvice annotated Controller looks like this: @ControllerAdvice public class GlobalControllerExceptionHandler { @ResponseStatus(value = HttpStatus.UNAUTHORIZED) @ExceptionHandler(AuthenticationException.class) public void authenticationExceptionHandler() { } } Of course my development is test driven and I would like to use my exception Handler in the JUnit Tests. My Test case looks like this: public class ClientQueriesControllerTest { private MockMvc mockMvc; @InjectMocks private ClientQueriesController controller; @Mock private AuthenticationService authenticationService; @Before public void setup() { MockitoAnnotations.initMocks(this); mockMvc = MockMvcBuilders.standaloneSetup(controller).build(); } @Test public void findAllAccountRelatedClientsUnauthorized() throws Exception { when(authenticationService.validateAuthorization(anyString())).thenThrow(AuthenticationException.class); mockMvc.perform(get("/rest/clients").header("Authorization", UUID.randomUUID().toString())) .andExpect(status().isUnauthorized()); } } Probably I need to register the ControllerAdvice Class. How to do that?
has comment: http://stackoverflow.com/comment/39996540
downvote count: 0
tagged with: java
tagged with: junit
has answer: http://stackoverflow.com/a/63420772
has answer: http://stackoverflow.com/a/40630715
has answer: http://stackoverflow.com/a/25787476

http://stackoverflow.com/comment/39992242
type: QuestionComment
score: 0
has text: yes i am using maven
comment on: http://stackoverflow.com/q/25601766
type: Comment

http://stackoverflow.com/q/25677479
tagged with: eclipse
answer count: 4
possible better answer: http://stackoverflow.com/a/25688314
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/40129356
has comment: http://stackoverflow.com/comment/40136454
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40130764
favorite count: 0
tagged with: layout-manager
tagged with: swing
has comment: http://stackoverflow.com/comment/40129372
type: Question
has body: import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class box{ public static String b1state = "A"; public static String b2state = "S"; public static String b3state = "D"; public static String b4state = "F"; public static String b5state = "G"; public static String b6state = "H"; public static String b7state = "J"; public static String b8state = "K"; public static String b9state = "Q"; public static void main(String[] args){ JFrame frame = new JFrame("Tic Tac Toe"); frame.setSize(500,500); frame.setResizable(false); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel p = new JPanel(); JButton b1 = new JButton(b1state); b1.setLocation(100, 50); JButton b2 = new JButton(b2state); b2.setLocation(150, 50); JButton b3 = new JButton(b3state); b3.setLocation(200, 50); JButton b4 = new JButton(b4state); b4.setLocation(100, 100); JButton b5 = new JButton(b5state); b5.setLocation(150, 100); JButton b6 = new JButton(b6state); b6.setLocation(200, 100); JButton b7 = new JButton(b7state); b7.setLocation(100, 150); JButton b8 = new JButton(b8state); b8.setLocation(150, 150); JButton b9 = new JButton(b9state); b9.setLocation(200, 150); b1.setSize(50, 50); b2.setSize(50, 50); b3.setSize(50, 50); b4.setSize(50, 50); b5.setSize(50, 50); b6.setSize(50, 50); b7.setSize(50, 50); b8.setSize(50, 50); b9.setSize(50, 50); p.add(b1); p.add(b2); p.add(b3); p.add(b4); p.add(b5); p.add(b6); p.add(b7); p.add(b8); p.add(b9); frame.add(p); frame.add(b1); frame.add(b2); frame.add(b3); frame.add(b4); frame.add(b5); frame.add(b6); frame.add(b7); frame.add(b8); frame.add(b9); } When ever I run this sometimes it works but other times it just opens the window with a whole button taking up the screen! Please Help!
score: 3
has answer: http://stackoverflow.com/a/25688314
has answer: http://stackoverflow.com/a/46487649
has answer: http://stackoverflow.com/a/25677564
has title: Button Takes Up My Whole Screen
accepted answer: http://stackoverflow.com/a/25677564
has answer: http://stackoverflow.com/a/76437432
has comment: http://stackoverflow.com/comment/40129455

http://stackoverflow.com/comment/39917955
type: Comment
type: QuestionComment
has text: Thanks for all your explain! I will try to use another client-api lib to do it and I will report the detail result.
comment on: http://stackoverflow.com/q/25561083
score: 0

http://stackoverflow.com/a/25667426
answers question: http://stackoverflow.com/q/25667203
has body: In "date_add\\((.*),\\s*([0-9]+\\s*)\\)" pattern .* will try to find maximal potential match, so it will try to find part which will start with date_add\\( and will end with ,\\s*([0-9]+\\s*)\\) which means that in data select to_date(id) from location_dim location_dim where ( location_name = '123' ) limit 10 union all select item_id item_id from (select item_dim.time_id from item_dim item_dim where item_dim.time_id in ( select time_dim.id from time_dim where (( time_dim . day ) = date_add( '1999-01-01' , 2 )) ) ) item_dim inner join time_dim time_dim on (( item_dim . time_id ) = ( time_dim . id )) where (( time_dim . day ) = date_add( '1999-01-01' , 2 )) limit 20 it will match select to_date(id) from location_dim location_dim where ( location_name = '123' ) limit 10 union all select item_id item_id from (select item_dim.time_id from item_dim item_dim where item_dim.time_id in ( select time_dim.id from time_dim where (( time_dim . day ) = date_add( '1999-01-01' , 2 )) ) ) item_dim inner join time_dim time_dim on (( item_dim . time_id ) = ( time_dim . id )) where (( time_dim . day ) = date_add( '1999-01-01' , 2 )) limit 20 To make .* search for minimal match you need to make * quantifier reluctant (lazy) by adding ? after it. So try with "date_add\\((.*?),\\s*([0-9]+\\s*)\\)" // ^-add this Same rule apples for date_sub\\((.*),\\s*([0-9]+\\s*)\\) pattern, which means you need should change it to date_sub\\((.*?),\\s*([0-9]+\\s*)\\)
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25667203
downvote count: 0
type: Answer
score: 2
type: AcceptedAnswer

http://stackoverflow.com/a/25678434
has body: There is no such feature in Hibernate, you need to map individual fields of your entity to corresponding columns in your mapping table.
has comment: http://stackoverflow.com/comment/40150873
has comment: http://stackoverflow.com/comment/40146528
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25676103

http://stackoverflow.com/q/25711351
has comment: http://stackoverflow.com/comment/40191338
type: Question
has comment: http://stackoverflow.com/comment/40191464
has comment: http://stackoverflow.com/comment/40191485
score: 0
type: UnansweredQuestion
has body: i have wrote a method to send some data to server and receive a integer value : private void sendOrder(Order order,String cid) { InputStream inputStream = null; String result = ""; int statusCode = 0; try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(send_url); JSONArray jsonArray = new JSONArray(); for (OrderDetails detail : order.getOrders()) { JSONObject jsonObject = new JSONObject(); jsonObject.accumulate("c_id", cid); jsonObject.accumulate("r_id", String.valueOf(detail.getR_id())); jsonObject.accumulate("f_id", String.valueOf(detail.getF_id())); jsonObject.accumulate("count", String.valueOf(detail.getCount())); jsonArray.put(jsonObject); } String json = jsonArray.toString(); StringEntity se = new StringEntity(json); httpPost.setEntity(se); httpPost.setHeader("Accept", "application/json"); httpPost.setHeader("Content-type", "application/json"); HttpResponse httpResponse = httpclient.execute(httpPost); statusCode = httpResponse.getStatusLine().getStatusCode(); inputStream = httpResponse.getEntity().getContent(); if (inputStream != null) result = Util.convertInputStreamToString(inputStream); else result = "0"; } catch (Exception e) { Log.d("send order", e.toString()); } Log.d("order result", result); return Integer.parseInt(result); } the cid is numbers stored in a string like : "30111" but in the server there is a problem in receiving c_id. its's value in server is like :"c_id":"\"30111\"" i want to c_id to be in the server as same as it is in the client. how can i fix that ? UPDATE this is my json string in android log : [{"count":"1","r_id":"8","f_id":"10033","c_id":"\"30111\""},{"count":"2","r_id":"8","f_id":"10034","c_id":"\"30111\""}]
answer count: 1
has comment: http://stackoverflow.com/comment/40191548
has comment: http://stackoverflow.com/comment/40191800
has title: Android Sending String in JSON format to Server
has answer: http://stackoverflow.com/a/25711623
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/40191440
has comment: http://stackoverflow.com/comment/40192278

http://stackoverflow.com/comment/39913606
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25559508
has text: depends on usecase, are you expecting code as input ? are you expecting some flags based on which you can take decision which implementation to execute (you could use polymorphism or runtime binding here)
score: 1

http://stackoverflow.com/comment/40223054
comment on: http://stackoverflow.com/q/25706875
has text: Another (very serious) drawback of that solution is that you can't prevent invalid dates in the databases.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25645641
has answer: http://stackoverflow.com/a/25645739
downvote count: 5
tagged with: regex
has title: How to replace set of repeating String pattern with specific character?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40071561
has comment: http://stackoverflow.com/comment/40071571
upvote count: 0
has comment: http://stackoverflow.com/comment/40071640
has body: I have a string like this Sample Input 00000000255255255255000000000255255000000000000002552552552552552552550000000000 I need to replace this string as follows using regx Sample Output 00000000000,0000000000000000,000000000000000,0000000000 suppose the code is like this s="00000000255255255255000000000255255000000000000002552552552552552552550000000000"; s.replace("regularexpression",",");
has comment: http://stackoverflow.com/comment/40071614
has answer: http://stackoverflow.com/a/25645856
favorite count: 0
type: AnsweredQuestion
score: -5
possible better answer: http://stackoverflow.com/a/25645739
has comment: http://stackoverflow.com/comment/40071444
tagged with: java
accepted answer: http://stackoverflow.com/a/25645856

http://stackoverflow.com/q/25620908
tagged with: alarmmanager
has body: In my application I have to check whether the 24 hours are completed. How do I check such things using Thread, TimerTask and Alaram Manager. Let me know how do I achieve this thing using TIMERTASK and THREAD ?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40027040
has comment: http://stackoverflow.com/comment/40026645
downvote count: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/25621016
has title: What are the ways to check 24 hours are completed?
upvote count: 0
has comment: http://stackoverflow.com/comment/40026701
score: -4
tagged with: multithreading
has answer: http://stackoverflow.com/a/25621016
tagged with: timertask
has comment: http://stackoverflow.com/comment/40026669
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40026741
accepted answer: http://stackoverflow.com/a/25620973
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25620973
has comment: http://stackoverflow.com/comment/40026680

http://stackoverflow.com/a/25646957
has comment: http://stackoverflow.com/comment/40074128
has comment: http://stackoverflow.com/comment/40075434
answers question: http://stackoverflow.com/q/25646835
has body: Assuming the input is 1 2, after this line String str = input.nextLine(); str is equal to " 2", so it can't be parsed as int. You can do simply: int temp1 = input.nextInt(); int temp2 = input.nextInt(); int total = temp1+temp2; System.out.println(total);
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40075612
type: Answer

http://stackoverflow.com/comment/40134441
comment on: http://stackoverflow.com/q/25680295
type: QuestionComment
has text: Did you try catching a TimeoutException rather than a NoSuchElementException?
score: 1
type: Comment

http://stackoverflow.com/comment/40192971
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25712126
has text: [How can I make a Java Swing animation smoother](http://stackoverflow.com/questions/15511282/how-can-i-make-a-java-swing-animation-smoother)
score: 0

recursion
type: Tag
tags question: http://stackoverflow.com/q/25694669
tags question: http://stackoverflow.com/q/25664237
tags question: http://stackoverflow.com/q/25579762
tags question: http://stackoverflow.com/q/25701145
tags question: http://stackoverflow.com/q/25564102
tags question: http://stackoverflow.com/q/25693855
tags question: http://stackoverflow.com/q/25620749
tags question: http://stackoverflow.com/q/25593313
tags question: http://stackoverflow.com/q/25572740
tag name: recursion
tags question: http://stackoverflow.com/q/25635696
tags question: http://stackoverflow.com/q/25705695
tags question: http://stackoverflow.com/q/25609641
tags question: http://stackoverflow.com/q/25590402
tags question: http://stackoverflow.com/q/25576484
tags question: http://stackoverflow.com/q/25712590
tags question: http://stackoverflow.com/q/25635713
tags question: http://stackoverflow.com/q/25671967
tags question: http://stackoverflow.com/q/25611434
tags question: http://stackoverflow.com/q/25559771
tags question: http://stackoverflow.com/q/25617389
tags question: http://stackoverflow.com/q/25611250
tags question: http://stackoverflow.com/q/25645962
tags question: http://stackoverflow.com/q/25701981
tags question: http://stackoverflow.com/q/25566410
tags question: http://stackoverflow.com/q/25665421

http://stackoverflow.com/comment/39972522
has text: @Jongware adding 1s and 2s does not change the map, the image loading code is correct, and unless i put x here when it should be y :map[x].length; i get an error
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25590777
score: 0

http://stackoverflow.com/q/25591204
accepted answer: http://stackoverflow.com/a/26786949
tagged with: rtsp
has answer: http://stackoverflow.com/a/26786949
favorite count: 0
type: Question
has body: What i must use here, to save jpeg image? String[] args = new String[] { "--containerformat", "jpeg", "--acodec", "libmp3lame", "--asamplerate", "22050", "--achannels", "1", "--abitrate", "64000", "--aquality", "0", "--vcodec", "jpegls", "--vscalefactor", "1.0", "--vbitrate", "300000", "--vbitratetolerance", "12000000", "--vquality", "0", "--realtime", // this will stream out to an RTMP server url, "com.xuggle.xuggler.RTMPPublishingExhaustiveTest#testRTSPRead.jpeg" };
tagged with: xuggler
has title: Xuggler get jpeg image from rtsp stream
tagged with: stream
downvote count: 0
upvote count: 1
tagged with: http://stackoverflow.com/tag/jpeg
type: AnsweredQuestion
score: 1
tagged with: java
answer count: 1

http://stackoverflow.com/a/41415958
answers question: http://stackoverflow.com/q/25605676
downvote count: 0
score: 5
upvote count: 5
type: Answer
has body: An activity: is an instance of Activity, a class in the Android SDK. An activity is responsible for managing user interaction with a screen of information. You write subclasses of Activity to implement the functionality that your app requires. A simple application may need only one subclass; a complex application can have many. A layout: defines a set of user interface objects and their position on the screen. A layout is made up of definitions written in XML. Each definition is used to create an object that appears on screen, like a button or some text.

http://stackoverflow.com/comment/39979533
type: QuestionComment
has text: In Java you cannot declare objects, only object references.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25595019

http://stackoverflow.com/comment/39981793
has text: Sorry I didn't see the `GET` mapping
comment on: http://stackoverflow.com/q/25596179
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/44291423
downvote count: 0
answers question: http://stackoverflow.com/q/25661519
upvote count: 1
score: 1
type: Answer
has body: Here's my solution, two lines of Java code. public int solution(int A, int B, int K) { int a = (A == 0) ? -1 : (A - 1) / K; return B / K - a; } The thought is simple. a refers to how many numbers are divisible in [1..A-1] B / K refers to how many numbers are divisible in [1..B] 0 is divisible by any integer so if A is 0, you should add one to the answer.

http://stackoverflow.com/comment/40060073
type: Comment
has text: Have a look at maven, pom.xml files, dependencies and versioning.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25620297

http://stackoverflow.com/a/25649633
answers question: http://stackoverflow.com/q/25649442
type: Answer
score: 0
has body: what you are doing is perfectly right, here is an example of one of my projects that I use as a library: dependencies { compile project(':boundservice') } of course what you should do also is to define the module you added your library as android-library plagin and not application. This should happen automatically if you do it using the New Module -> Android Library option, but maybe as this project, as I understand... has nothing to do with Android you should just chose the Java Library option. When you do that and sync the build.gradle file (maybe a little clean build should help as well) you should be able to use your class files in the Android project.

http://stackoverflow.com/comment/40022068
type: AnswerComment
score: 0
has text: are you using the ObjectMapper before or after setting filter? Can you make a complete class that reproduces your problem? Does the code from my answer work for you?
type: Comment
comment on: http://stackoverflow.com/a/25613351

http://stackoverflow.com/a/25646656
type: Answer
downvote count: 0
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25646346
has body: Maybe I don't understand your question, but if you are looking to create a class instance only using your class name, you can try this method: public static MyClass getFromString(String myClassName) { Object result = null; MyClass final_result = null; try{ result = Class.forName(myClassName).getConstructor().newInstance(); final_result= (MyClass)result; }catch(ClassNotFoundException e){} //you must specify concrete Exception here return final_result; } Hope it helps.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25646346

http://stackoverflow.com/comment/39944145
score: 0
type: Comment
type: QuestionComment
has text: my apologies..wrong part..I think this should b the problem illustrated now
comment on: http://stackoverflow.com/q/25574700

http://stackoverflow.com/comment/39996334
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25603626
has text: post your full code where you are trying to change the theme

http://stackoverflow.com/q/25617800
has title: Hibernate producing unique constraint that I do not want and do not need
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25627026
tagged with: hsqldb
favorite count: 0
linked to: http://stackoverflow.com/q/15972549
type: Question
has comment: http://stackoverflow.com/comment/40021862
has body: I have the following problem. Here are my entities. TestTeam.java package utils; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name = "TEST_TEAM") public final class TestTeam implements Serializable { /** * */ private static final long serialVersionUID = -7275223441128447981L; @Id @Column(name = "NAME") private String name; @OneToMany(mappedBy = "playerId", cascade = CascadeType.ALL) private List&lt;TestPlayer&gt; test1List; public String getName() { return name; } public void setName(String name) { this.name = name; } public List&lt;TestPlayer&gt; getTest1List() { return test1List; } public void setTest1List(List&lt;TestPlayer&gt; test1List) { this.test1List = test1List; } public TestTeam() { } public TestTeam(final String name, final List&lt;TestPlayer&gt; test1List) { this.name = name; this.test1List = new ArrayList&lt;&gt;(test1List); } } TestPlayer.java package utils; import java.io.Serializable; import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.persistence.CascadeType; import javax.persistence.CollectionTable; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @Entity @Table(name = "TEST_PLAYER") public class TestPlayer implements Serializable { /** * */ private static final long serialVersionUID = -2792602076488917813L; @Id private long playerId; @Column(name = "NAME", nullable = false) private String playerName; @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "TEAM_NAME") private TestTeam team; @ElementCollection(fetch = FetchType.EAGER) @…
accepted answer: http://stackoverflow.com/a/25627026
has comment: http://stackoverflow.com/comment/40027327
has comment: http://stackoverflow.com/comment/40021513
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/25668065
has comment: http://stackoverflow.com/comment/40136906
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25688868
tagged with: alfresco
score: 2
tagged with: java
tagged with: hibernate
answer count: 1
downvote count: 0
tagged with: jsp
has title: Custom the default login page Alfresco
accepted answer: http://stackoverflow.com/a/25688868
favorite count: 0
type: Question
has body: I want to custom my login page alfresco from the default one (4.2.f). I only want to change the alfresco logo and the background color. I think that I can copy files about login page ALfresco and copy them to the extension mechanism. I can't find those file in the alfresco path ? Please, can someone can help me to figure it out ?
upvote count: 2
tagged with: spring

http://stackoverflow.com/a/25584892
score: 0
answers question: http://stackoverflow.com/q/25584813
type: Answer
has body: The javadoc of moveToInsertRow() says: The insert row is a special row associated with an updatable result set (emphasis mine) The javadoc of ResultSet says: A default ResultSet object is not updatable and has a cursor that moves forward only. Thus, you can iterate through it only once and only from the first row to the last row. It is possible to produce ResultSet objects that are scrollable and/or updatable. The following code fragment, in which con is a valid Connection object, illustrates how to make a result set that is scrollable and insensitive to updates by others, and that is updatable. See ResultSet fields for other options.

http://stackoverflow.com/comment/40158352
has text: Perhaps the transient keyword was placed there for serialization purposes, this will not effect in any way the double-checked locking process.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25692942

http://stackoverflow.com/comment/40034979
has text: @kajacx: and why not?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25624957

http://stackoverflow.com/comment/40004708
type: AnswerComment
has text: Pinch is in a specific component. Some platforms only send the single argument pressed/released event which makes sense since you are always removing/placing one finger at a time (even if it doesn't feel like it).
comment on: http://stackoverflow.com/a/25594228
score: 0
type: Comment

http://stackoverflow.com/q/25600292
has comment: http://stackoverflow.com/comment/40004664
tagged with: jpa
has comment: http://stackoverflow.com/comment/39998507
accepted answer: http://stackoverflow.com/a/25607136
tagged with: spring
has answer: http://stackoverflow.com/a/25607136
tagged with: postgresql
type: AnsweredQuestion
score: 0
has body: I'm using JPA with Hibernate. For the entities defined in my app, I use annotations, but some of the entities come as third-party code without any mappings. Therefore I have to map them via XML (at least I think I have to): FIELD <id name="id"/> Since this is JPA mapping, it works great except for one case where I have to use a Hibernate specific custom type to map PostgreSQL's uuid type to java.util.UUID. Using annotations, it's a piece of cake: @Entity public class Partner { @Id @Type(type = "org.hibernate.type.PostgresUUIDType") private UUID id = IdGenerator.generate(); } The problem is that I can't figure out how to do the same via XML. I considered using Hibernate's native XML mapping, but it seems like it doesn't support mapped superclasses.
tagged with: java
tagged with: hibernate
answer count: 1
type: Question
has title: Hibernate specific configuration in JPA XML mapping file
linked to: http://stackoverflow.com/q/11305204

adapter
tags question: http://stackoverflow.com/q/25643551
tags question: http://stackoverflow.com/q/25679618
tag name: adapter
tags question: http://stackoverflow.com/q/25695083
type: Tag
tags question: http://stackoverflow.com/q/25640835

http://stackoverflow.com/comment/39938452
type: Comment
type: QuestionComment
score: 0
has text: Now i have values but how to make them blocks
comment on: http://stackoverflow.com/q/25569469

http://stackoverflow.com/q/25697632
has title: What does the “+” operator do in Java?
favorite count: 0
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25697642
downvote count: 5
has answer: http://stackoverflow.com/a/25697645
has answer: http://stackoverflow.com/a/25697661
has comment: http://stackoverflow.com/comment/40166558
has answer: http://stackoverflow.com/a/25697648
score: -4
has comment: http://stackoverflow.com/comment/40169196
has body: Please someone explain the ("x = " + x) part of the code. public class While-With-Nested-If { public static void main(String [] args) { int x = 1; while(x &lt; 100) { System.out.println("x = " + x); if(x % 2 == 0) { x++; } else { x *= 2; } } } }
tagged with: java
has answer: http://stackoverflow.com/a/25697646
has answer: http://stackoverflow.com/a/25697904
has comment: http://stackoverflow.com/comment/40166570
answer count: 7
has answer: http://stackoverflow.com/a/25697673
upvote count: 1

http://stackoverflow.com/q/25563201
has comment: http://stackoverflow.com/comment/39920462
accepted answer: http://stackoverflow.com/a/25563264
type: AnsweredQuestion
score: 0
answer count: 2
has body: In my web application, I am trying to build a JSON string on the server and then pass this to the client so I can process it with some client side javascript. This works most of the time, however when the JSON string contains a single quote, the javascript breaks. The JSON is basically a list of maps, which is passed into my GSP page in the mappings variable. I then evaluate the string to convert it into a javascript object: var json = eval('(${mappings})'); When mappings is evaluated, the complete javascript expression looks something like this: var json = eval('([{"targetId":123,"targetName":"this isn't going to work"}])'); So clearly, in this case when mappings contains a single quote ("...this isn't going to work..."), the JSON string is terminated prematurely and the browser reports a javascript error. I would have expected this to be easy to work around, however on the java side, when I try to replace ' with \' using json.replaceAll("'", "\\'") I get this: "...this isn't going to work..." i.e. it doesn't change at all! If I try to double escape the backslash, i.e. json.replaceAll("'", "\\\\'") I get this: "...this isn\\'t going to work..." Which isn't correct either. How can I replace the single quote with a single backslash and quote so that when the string is rendered on the client it can be evaluated properly?
tagged with: java
has answer: http://stackoverflow.com/a/25563248
possible better answer: http://stackoverflow.com/a/25563248
has answer: http://stackoverflow.com/a/25563264
type: Question
has title: Escaping a single quote in java and trying to render the escaped quote in a json blob
tagged with: escaping
tagged with: javascript
tagged with: regex
tagged with: grails

http://stackoverflow.com/q/25560876
upvote count: 0
answer count: 3
type: UnansweredQuestion
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25560934
type: Question
tagged with: java
has title: Using Modulo? writing code that uses existing code
has answer: http://stackoverflow.com/a/25560931
score: -1
has body: I have written code with a for loop that prints out multiples of a number entered up to 100. I now have to write a code (preferably with a for loop) using modulo to print out all integers other than the multiples printed in the existing code. For instance, if you enter 3 in this code, it will need to print out 1,2,4,5,7,8, etc. Everything but those multiples up to 100. I'm having a hard time seeing how to use modulo here. This is the existing code it's based on: import java.util.Scanner; public class mult { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); System.out.println("Please Enter a number between 2 and 10:"); int inputValue = in.nextInt(); for (int i = inputValue; i &lt; 100; i += inputValue) { System.out.println(i + ""); } } }
has answer: http://stackoverflow.com/a/25561008
tagged with: modulo

http://stackoverflow.com/comment/40027973
comment on: http://stackoverflow.com/a/25621193
score: 0
type: Comment
has text: okay thanks. This is what I have worked around so far mUserAgeRetrieved.setText(objects.get(i).get(Integer.parseInt("UserAge")).toString()); but I can't exactly do that because get is looking for a string
type: AnswerComment

http://stackoverflow.com/comment/39930990
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25567865
has text: I do not know how deeply an Android Java compiler will go bothering itself to inline my code. I think when a function is called with some uncertainty inside, like a parameter that is not known at compile time, inline should not happen. My question just deal with inlining because I know I am not protecting my string from real hackers, I just want to avoid simple reading of a string. Obfuscation is for method names, not strings.

http://stackoverflow.com/a/25689664
has body: Java omits the classpath variable when you run it with java -jar due to security reasons. The solution is to define the dependencies in the Class-Path: attribute of your MANIFEST.MF file.
downvote count: 0
answers question: http://stackoverflow.com/q/25687229
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/25623685
type: AnsweredQuestion
score: 0
has body: My question is how can i put my spinner in an external java class and implement it in all other activities (works as a menu), here is my spinner code: final Spinner spinner = (Spinner) findViewById(R.id.comboCasino); ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(this, R.array.comboCasino, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setSelection(0, false); // this will be called when you select any item in this spinner spinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View arg1, int position, long arg3) { // get the text at that position switch(position) { case 0: { Intent NewPost = new Intent(getApplicationContext(), StartingPoint.class); startActivity(NewPost); break; } case 1: { Intent NewPost = new Intent(getApplicationContext(), Simmering.class); startActivity(NewPost); break; } case 2: { Intent NewPost = new Intent(getApplicationContext(), LugnerCity.class); startActivity(NewPost); break; } case 3: { Intent NewPost = new Intent(getApplicationContext(), Gmunden.class); startActivity(NewPost); break;} case 4: { Intent NewPost = new Intent(getApplicationContext(), Salzburg.class); startActivity(NewPost); break; } case 5: { Intent NewPost = new Intent(getApplicationContext(), Linz.class); startActivity(NewPost); break; } case 6: { Intent NewPost = new Intent(getApplicationContext(), Saalbach.class); startActivity(NewPost); break; } case 7: { Intent NewPost = new Intent(getApplicationContext(), Innsbruck.class); startActivity(NewPost); break;} case 8: { Intent NewPost = new Intent(getApplicationContext(), Reutte.class); startActivity(NewPost); break; } case 9: { Intent NewPost = new Intent(getApplicationContext(), Bregenz.class); startActivity(NewPost); break; } case 10: { Intent NewPost = new Intent(getApplicationContext(), Kufstein.class); startA…
has title: Use spinner in external class because needed in all other activities
tagged with: android
tagged with: java
tagged with: spinner
tagged with: external
has comment: http://stackoverflow.com/comment/40031925
tagged with: class
answer count: 3
has answer: http://stackoverflow.com/a/25624141
accepted answer: http://stackoverflow.com/a/25624141
has answer: http://stackoverflow.com/a/25623756
possible better answer: http://stackoverflow.com/a/25623756
type: Question
has answer: http://stackoverflow.com/a/25623787

http://stackoverflow.com/a/25562114
accepted answer of: http://stackoverflow.com/q/25562017
type: AcceptedAnswer
downvote count: 0
has body: Try this, modify if condition according to yours if required. &lt;form:select name="precipant" path="precipant" id="precipant" onchange="showpopup(this.options[this.selectedIndex].value,this.form,'Newprecipant?#login_form3');"&gt; &lt;form:option value="" selected="selected"&gt;--Please Select--&lt;/form:option&gt; &lt;c:forEach items="${precipitantdroplist}" var="listop"&gt; &lt;c:if test="${listop.precipitants eq listop.precipant}"&gt; &lt;option value="${listop.precipitants}"&gt;${listop.precipitants}&lt;/option&gt; &lt;/c:if&gt; &lt;c:if test="${listop.precipitants != listop.precipant}"&gt; &lt;option value="${listop.precipitants}"&gt;${listop.precipitants}&lt;/option&gt; &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;form:option value=""&gt;-----------------------&lt;/form:option&gt; &lt;form:option value="Add New"&gt;Add New&lt;/form:option&gt; &lt;form:option value="removeP"&gt;Remove&lt;/form:option&gt; &lt;/form:select&gt; or register the handler for the dropdown like this, &lt;script type="text/javascript"&gt; $(document).ready(function() { $("#precipant").change(function() { $('select[name^="precipant"] option:selected').attr("selected",null); $('select[name^="precipant"] option[value="Please Select"]').attr("selected","selected"); }); }); &lt;/script&gt;
has comment: http://stackoverflow.com/comment/39918414
has comment: http://stackoverflow.com/comment/39918781
upvote count: 2
has comment: http://stackoverflow.com/comment/39918860
has comment: http://stackoverflow.com/comment/39918675
type: Answer
answers question: http://stackoverflow.com/q/25562017
score: 2

http://stackoverflow.com/q/25582226
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25708669
downvote count: 1
tagged with: image-processing
favorite count: 0
has comment: http://stackoverflow.com/comment/40083851
type: Question
has answer: http://stackoverflow.com/a/25636521
has comment: http://stackoverflow.com/comment/40053363
has answer: http://stackoverflow.com/a/25686139
type: UnansweredQuestion
has title: How can I make transparent background of a Bitmap?
tagged with: bitmap
answer count: 6
has answer: http://stackoverflow.com/a/25737663
has body: I am working on a module in which I have to make background of bitmap image transparent. Actually, I am making an app like "Stick it" through which we can make sticker out of any image. I don't know from where to begin. Can someone give me a link or a hint for it? Original Image- After making background transparent- This is what I want.
has comment: http://stackoverflow.com/comment/40093725
tagged with: bitmapimage
has comment: http://stackoverflow.com/comment/39956300
has comment: http://stackoverflow.com/comment/39956392
has comment: http://stackoverflow.com/comment/39956258
has comment: http://stackoverflow.com/comment/39956177
score: 0
has comment: http://stackoverflow.com/comment/40205613
has comment: http://stackoverflow.com/comment/40067351
has answer: http://stackoverflow.com/a/25744113
has answer: http://stackoverflow.com/a/25641068
upvote count: 1

http://stackoverflow.com/a/25601543
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25601312
has body: From the doc : The toString() method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode()) The toString() method you are using is of Object class. And as you can see, it involves hashCode, hence it will never print duplicate values,provided that, all the instances of your previous Runnable are still IN memory.

http://stackoverflow.com/q/25620207
type: UnansweredQuestion
score: 2
tagged with: java
has body: Does anyone have idea regarding the RTF2FO 3.5.0. I am trying this to convert rtf to fo file,it worked... but i am facing a issue in table formation and pictures. Can I set a path were i can save picture from RTF files with out the default folder (.images), which the RTF2FO create in default. Can I set the table layout and the width properties in percentage "%", default is "pt". can any one help me out.
downvote count: 0
has title: RTF2FO converted API used in java to extract and merge RTF content to Existing XSL
favorite count: 0
tagged with: xslt
type: Question
upvote count: 2
answer count: 0

http://stackoverflow.com/comment/40031313
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25623351
has text: I think last part of the proof is not correct - the restoration is also a modification. Isn't it?

http://stackoverflow.com/q/25627017
tagged with: ora-06502
has comment: http://stackoverflow.com/comment/40045155
score: 0
has comment: http://stackoverflow.com/comment/40056336
has comment: http://stackoverflow.com/comment/40039120
has comment: http://stackoverflow.com/comment/40045318
answer count: 0
has body: I am inserting a row in my table from Java and I got the following error below. But the same sql query executed in TOAD insert my data without problem. The insert : INSERT INTO TRAVAUX_FICHE(date1, date2, description, cie , work_id) VALUES(TO_DATE('2014-08-15','yyyy-MM-dd'), TO_DATE('2014-08-15','yyyy-MM-dd'), 'test', 'test','test'); The error ORA-20999: TAPI--6502:ORA-06502: PL/SQL: numeric or value error: character string buffer too small TAPI--6502:ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at "PILOTAGE.CG$ERRORS", line 87 ORA-06512: at "PERMIS.CG$TRAVAUX_FICHE", line 557 ORA-06512: at "PERMIS.CG$BIR_TRAVAUX_FICHE", line 51 ORA-04088: error during execution of trigger 'PERMIS.CG$BIR_TRAVAUX_FICHE' EDIT for TRIGGER CODE (I didnt write the trigger code, It is generated I think) : CREATE OR REPLACE TRIGGER cg$BIR_TRAVAUX_FICHE BEFORE INSERT ON TRAVAUX_FICHE FOR EACH ROW DECLARE cg$rec cg$TRAVAUX_FICHE.cg$row_type; cg$ind cg$TRAVAUX_FICHE.cg$ind_type; BEGIN -- Application_logic Pre-Before-Insert-row &lt;&lt;Start&gt;&gt; -- Application_logic Pre-Before-Insert-row &lt;&lt; End &gt;&gt; -- Load cg$rec/cg$ind values from new cg$rec.NO_TRAV_FICHE_SQ := :new.NO_TRAV_FICHE_SQ; cg$ind.NO_TRAV_FICHE_SQ := TRUE; cg$rec.DATE_DEBUT := :new.DATE_DEBUT; cg$ind.DATE_DEBUT := TRUE; cg$rec.DATE_FIN := :new.DATE_FIN; cg$ind.DATE_FIN := TRUE; cg$rec.DESCRIPTION := :new.DESCRIPTION; cg$ind.DESCRIPTION := TRUE; cg$rec.COMPAGNIE := :new.COMPAGNIE; cg$ind.COMPAGNIE := TRUE; cg$rec.NUM_APPEL_OFFRE := :new.NUM_APPEL_OFFRE; cg$ind.NUM_APPEL_OFFRE := TRUE; cg$rec.DATE_CREATION := :new.DATE_CREATION; IF (:new.DATE_CREATION IS NULL) THEN cg$ind.DATE_CREATION := FALSE; ELSE cg$ind.DATE_CREATION := TRUE; END IF; cg$rec.USAGER_CREATION := :new.USAGER_CREATION; IF (:new.USAGER_CREATION IS NULL) THEN cg$ind.USAGER_CREATION := FALSE; ELSE cg$ind.USAGER_CREATION := TRUE; END IF; cg$rec.DATE_MODIFICATION := :new.DATE_MODIFICATION; IF (:new.DATE_MODIFICATION …
type: UnansweredQuestion
has title: ORA-06502 error when insert from Java but work fine in TOAD
has comment: http://stackoverflow.com/comment/40045025
has comment: http://stackoverflow.com/comment/40038487
has comment: http://stackoverflow.com/comment/40047267
type: Question
tagged with: oracle-database
tagged with: sql
tagged with: java
has comment: http://stackoverflow.com/comment/40039891
has comment: http://stackoverflow.com/comment/40038588
has comment: http://stackoverflow.com/comment/40044997
has comment: http://stackoverflow.com/comment/40047307
has comment: http://stackoverflow.com/comment/40045064

http://stackoverflow.com/q/25711507
upvote count: 2
tagged with: apache-poi
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/72050620
tagged with: java
possible better answer: http://stackoverflow.com/a/68110418
tagged with: jxls
has body: I use JXLS to create my woorkbook. JXLS uses POI underneath. To create a workbook JXLS either need a File or an input stream. With file object I get my desired woorkbook. But, with stream I get error ZIP entry size is too large. JXLS lib use WorkbookFactory.create() method to create workbook. So, I tried with ZipStream and PushbackStream; no help. I was able to run the same code from my Junit. I read the below post. Why am I getting exception "IOException: ZIP entry size is too large" when trying to open an Excel file using Apache POI?. The solution form the post is, a change in Maven. But, the post did not mentioned about the change made in Maven. Do you have any suggestions?
favorite count: 0
has title: POI - ZIP entry size is too large
has answer: http://stackoverflow.com/a/25878693
has answer: http://stackoverflow.com/a/68110418
accepted answer: http://stackoverflow.com/a/25878693
tagged with: maven
type: Question
tagged with: excel
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/40034216
type: Comment
comment on: http://stackoverflow.com/a/25624476
score: 0
type: AnswerComment
has text: I do not want users to go to previous page by clicking browser back button.

http://stackoverflow.com/q/25566230
has title: Java operators, explanation
has answer: http://stackoverflow.com/a/25566325
has comment: http://stackoverflow.com/comment/39926114
has answer: http://stackoverflow.com/a/25566328
has body: I know there are several question about the x++ operation, I know the difference between ++x and x++. But now I have to solve this: int x = 5; x += x++ * x++ * x++; Well I know that this shouldn't be too difficult, but still, I need an explanation how this calculatino is done, step by step, I don't get it by myself..
linked to: http://stackoverflow.com/q/23308228
tagged with: operators
type: Question
possible better answer: http://stackoverflow.com/a/25566311
accepted answer: http://stackoverflow.com/a/25566328
tagged with: java
duplicate of: http://stackoverflow.com/q/23308228
has comment: http://stackoverflow.com/comment/39927436
has answer: http://stackoverflow.com/a/25566332
answer count: 4
has comment: http://stackoverflow.com/comment/39925894
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39925908
has answer: http://stackoverflow.com/a/25566311
score: 0

http://stackoverflow.com/a/25563426
has body: What is the status of the following parameters of the http request which is failing: Use multipart/form-data for HTTP POST Browser-compatible headers You don't have any HTTP Header Manager instances elsewhere in you test plan, do you? As if yes it may interfere as HTTP Header Manager's scope isn't limited to one sampler only when it is not added as a child. Your post request details doesn't look like file upload request. Take a look into Upload and Download Scenarios with Apache JMeter guide to see whether you missed anything important. Never run load generator and application under test on the same machine. Even when developing or debugging your test.
score: 0
answers question: http://stackoverflow.com/q/25552307
type: Answer

http://stackoverflow.com/a/66772528
downvote count: 0
upvote count: 1
has body: I had the problem when migrating some old test configuration into the current workspace.xml. The problem was that the prolog was prefixed with a Byte-Order-Mark for UTF-8, which is usually added by xml editors. After removing the BOM with a hex editor, the problem was gone.
answers question: http://stackoverflow.com/q/25652140
type: Answer
has comment: http://stackoverflow.com/comment/119433128
score: 1

http://stackoverflow.com/q/25602477
favorite count: 0
answer count: 4
type: Question
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25602724
has answer: http://stackoverflow.com/a/25602541
has title: how do sum the list object values with null value in java?
score: 2
tagged with: java
has body: I have list with null value. How to sum in java. While am sum, getting null value exception. I have the list like, Double list = { null, 113.43, 11.5, 25.6} getting list from object. How can i sum and display in console in java?
downvote count: 0
has answer: http://stackoverflow.com/a/25602520
has answer: http://stackoverflow.com/a/25602808

http://stackoverflow.com/comment/40025907
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25617519
has text: Use `rateInventoryMap['your_key_here'].currentRate`.

odata
tag name: odata
type: Tag
tags question: http://stackoverflow.com/q/25572084

http://stackoverflow.com/comment/40095931
has text: The behavour will be of a HashMap. The Map does'nt know how it is accessed (synchronized or not). It depends all on the **use case**.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25658761

http://stackoverflow.com/comment/40180438
score: 0
type: AnswerComment
has text: Correct. But if that Application is your class you may want to check the isInterrupted flag there.
type: Comment
comment on: http://stackoverflow.com/a/25705215

http://stackoverflow.com/q/25586505
has answer: http://stackoverflow.com/a/62307307
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39963912
has title: How can I remove the subdomain part of a URL
has body: I am trying to remove subdomain and leave only the domain name followed by the extension. It is difficult to find the subdomain because I do not know how many dots to expect in a url. some urls end in .com some in .co.uk for example. How can I remove the subdomain safely so that foo.bar.com becomes bar.com and foo.bar.co.uk becomes bar.co.uk if(!rawUrl.startsWith("http://")&amp;&amp;!rawUrl.startsWith("https://")){ rawUrl = "http://"+rawUrl; } String url = new java.net.URL(rawUrl).getHost(); String urlWithoutSub = ???
score: 2
answer count: 2
upvote count: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25586552
downvote count: 0

http://stackoverflow.com/q/25574962
tagged with: java
has answer: http://stackoverflow.com/a/25576989
tagged with: repeat
upvote count: 4
linked to: http://stackoverflow.com/q/322715
type: Question
has answer: http://stackoverflow.com/a/25575154
has answer: http://stackoverflow.com/a/25575121
has answer: http://stackoverflow.com/a/25575293
has comment: http://stackoverflow.com/comment/39942960
has body: I am making a few methods that are used for finding the prime factors of a certain number. This is broken down into two functions which both use arrays. However, in both functions the code is very inefficient. First I have to count the length of the array, make a new array of that length and then use almost the exact same code to populate the array. Is there a way I can make the array unknown width and push integers to the end of the array as I find them? Here is my code: public class JavaApplication7{ public static void main(String[] args) { System.out.println(Arrays.toString(primeFactors(85251))); } public static int[] primeFactors(int num){ int[] factors = primesUpTo(num); int originalNum = num; int i = 0; int count = 0; while(num != 1){ if(num % factors[i] == 0){ num /= factors[i]; i = 0; count++; }else{ i++; } } int[] primeFactors = new int[count]; i = 0; count = 0; while(originalNum != 1){ if(originalNum % factors[i] == 0){ originalNum /= factors[i]; primeFactors[count] = factors[i]; i = 0; count++; }else{ i++; } } return primeFactors; } public static int[] primesUpTo(int upTo){ int count = 0; int num = 2; while(num &lt;= upTo){ boolean isPrime = true; for(int div = 2; div &lt;= num / 2; div++){ isPrime = num % div == 0 ? false : isPrime; } count += isPrime ? 1 : 0; num++; } int i = 0; num = 2; int[] primes = new int[count]; while(num &lt;= upTo){ boolean isPrime = true; for(int div = 2; div &lt;= num / 2; div++){ isPrime = num % div == 0 ? false : isPrime; } if(isPrime){ primes[i] = num; i++; } num++; } return primes; } }
answer count: 5
has comment: http://stackoverflow.com/comment/39944206
tagged with: arrays
has title: Inefficient java / arrays of unknown length
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39943230
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/25575293
possible better answer: http://stackoverflow.com/a/25575121
tagged with: performance
has answer: http://stackoverflow.com/a/25575971

http://stackoverflow.com/q/25602644
tagged with: android
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: ssl
has answer: http://stackoverflow.com/a/25602863
tagged with: https
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/18126372
has comment: http://stackoverflow.com/comment/39993807
downvote count: 0
has comment: http://stackoverflow.com/comment/39993598
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39993430
answer count: 1
has body: First, sorry for my bad english! My Problem: With this JSONParser.java I want to connect to a SSL-secured server. How to change my code to make it work? ADDITION: The SSL Certificate is a self-signed certificate! public class JSONParser { static InputStream is = null; static JSONObject jObj = null; static String json = ""; public JSONParser() {} public JSONObject getJSONFromUrl(String url, List params) { try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line; while ((line = reader.readLine()) != null) {sb.append(line).append("n");} is.close(); json = sb.toString(); Log.e("JSON", json); } catch (Exception e) { Log.e("Buffer Error", "Error converting result " + e.toString()); } try { jObj = new JSONObject(json); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); } return jObj; } } Logcat output (i had to censor the packagename): 09-01 11:26:14.759 1462-1462/ *package_name* W/ActivityThread: Application *package_name* is waiting for the debugger on port 8100... 09-01 11:26:14.806 1462-1462/ *package_name* I/System.out: Sending WAIT chunk 09-01 11:26:14.887 1462-1467/ *package_name* I/dalvikvm: Debugger is active 09-01 11:26:15.031 1462-1462/ *package_name* I/System.out: Debugger has connected 09-01 11:26:15.031 1462-1462/ *package_name* I/System.out: waiting for debugger to settle... 09-01 11:26:17.673 1462-1462/ *package_name* I/System.out: debugger has settled (1391) 09-01 11:26:21.538 1462-1462/ *package_name* W/ResourceType: Entry identifier 0x11…
linked to: http://stackoverflow.com/q/11923380
has title: Android JSON Parser with DefaultHttpClient and POST over SSL
linked to: http://stackoverflow.com/q/17159657
upvote count: 1

http://stackoverflow.com/q/25583297
type: Question
score: 3
tagged with: performance
tagged with: optimization
upvote count: 4
has title: Why are floating point operations much faster with a warmup phase?
type: AnsweredQuestion
answer count: 2
possible better answer: http://stackoverflow.com/a/25583350
accepted answer: http://stackoverflow.com/a/25583375
tagged with: java
has body: I initially wanted to test something different with floating-point performance optimisation in Java, namely the performance difference between the division by 5.0f and multiplication with 0.2f (multiplication seems to be slower without warm-up but faster with by a factor of about 1.5 respectively). After studying the results I noticed that I had forgotten to add a warm-up phase, as suggested so often when doing performance optimisations, so I added it. And, to my utter surprise, it turned out to be about 25 times faster in average over multiple test runs. I tested it with the following code: public static void main(String args[]) { float[] test = new float[10000]; float[] test_copy; //warmup for (int i = 0; i &lt; 1000; i++) { fillRandom(test); test_copy = test.clone(); divideByTwo(test); multiplyWithOneHalf(test_copy); } long divisionTime = 0L; long multiplicationTime = 0L; for (int i = 0; i &lt; 1000; i++) { fillRandom(test); test_copy = test.clone(); divisionTime += divideByTwo(test); multiplicationTime += multiplyWithOneHalf(test_copy); } System.out.println("Divide by 5.0f: " + divisionTime); System.out.println("Multiply with 0.2f: " + multiplicationTime); } public static long divideByTwo(float[] data) { long before = System.nanoTime(); for (float f : data) { f /= 5.0f; } return System.nanoTime() - before; } public static long multiplyWithOneHalf(float[] data) { long before = System.nanoTime(); for (float f : data) { f *= 0.2f; } return System.nanoTime() - before; } public static void fillRandom(float[] data) { Random random = new Random(); for (float f : data) { f = random.nextInt() * random.nextFloat(); } } Results without warm-up phase: Divide by 5.0f: 382224 Multiply with 0.2f: 490765 Results with warm-up phase: Divide by 5.0f: 22081 Multiply with 0.2f: 10885 Another interesting change that I cannot explain is the turn in what operation is faster (division vs. multiplication). As earlier mentioned, without the warm-up the division seems to be a tad faster, w…
has answer: http://stackoverflow.com/a/25583350
has answer: http://stackoverflow.com/a/25583375
tagged with: floating-point
downvote count: 1
favorite count: 0

http://stackoverflow.com/q/25627673
tagged with: sms
upvote count: 2
tagged with: java
answer count: 1
has body: Just want to ask where does the default android messaging app stores and read failed to send messages. I thought it can be queried on content://sms/sent with STATUS_FAILED as status. Thanks.
downvote count: 0
accepted answer: http://stackoverflow.com/a/25627867
has title: Failed sending messages storage android
has answer: http://stackoverflow.com/a/25627867
favorite count: 0
type: Question
tagged with: android-contentprovider
type: AnsweredQuestion
tagged with: message
tagged with: android
score: 2
linked to: http://stackoverflow.com/q/52205463

user-management
tag name: user-management
tags question: http://stackoverflow.com/q/25552433
type: Tag

http://stackoverflow.com/comment/40095226
comment on: http://stackoverflow.com/q/25658330
type: QuestionComment
has text: What do you mean by "this kind of constructor" - what's your suggested alternative? Just having the private constructor which does nothing?
score: 2
type: Comment

http://stackoverflow.com/a/25703453
type: AcceptedAnswer
has body: The glyphs (graphical representations) for non-printing ASCII bytes were never standardized. Character 30 has no standard glyph. Bytes 128-255 also have no standard glyphs. If you want to reliably display the glyphs from a particular pre-Unicode glyph set, you need to identify Unicode characters with glyphs that look like the old glyphs, and convert your byte values to those Unicode characters. For example, here's a table of Unicode characters that look similar to IBM codepage 437: char[] decoded = new char[] { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2…
downvote count: 0
answers question: http://stackoverflow.com/q/25702593
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40176872
accepted answer of: http://stackoverflow.com/q/25702593
score: 2
has comment: http://stackoverflow.com/comment/40181191

http://stackoverflow.com/comment/39966331
score: 0
type: Comment
has text: @CupawnTae Given the context I don't think OP has any intention of removing the `println` statement. Good point though.
type: AnswerComment
comment on: http://stackoverflow.com/a/25587786

http://stackoverflow.com/q/25643348
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/59773919
has comment: http://stackoverflow.com/comment/40067429
favorite count: 0
type: Question
has body: I'm working on project with Java 8 and found one situation which I can't understand. I have code like this: void deleteEntity(Node node) throws SomeException { for (ChildNode child: node.getChildren()) { deleteChild(child); } } void deleteChild(Object child) throws SomeException { //some code } This code is working fine, but I can rewrite it with a method reference: void deleteEntity(Node node) throws SomeException { node.getChildren().forEach(this::deleteChild); } And this code doesn't compile, giving the error Incompatible thrown types *SomeException* in method reference. Also IDEA gave me the error unhandled exception. So, my question is why? Why code compiles with for each loop and doesn't compile with lambda?
has answer: http://stackoverflow.com/a/50135463
has answer: http://stackoverflow.com/a/60451875
has answer: http://stackoverflow.com/a/27661504
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/78758065
linked to: http://stackoverflow.com/q/27644361
has title: Java 8 method reference unhandled exception
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27661504
accepted answer: http://stackoverflow.com/a/25643503
has answer: http://stackoverflow.com/a/39431499
tagged with: java
upvote count: 91
score: 91
has answer: http://stackoverflow.com/a/25643503

http://stackoverflow.com/q/25607985
tagged with: oracle-database
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25617856
has answer: http://stackoverflow.com/a/25617856
has answer: http://stackoverflow.com/a/25608560
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/40003931
has body: I am building a java program to insert data to my oracle database. My problem is that I need to insert into two tables, and to reach unique rows I use in TABLE_A triggers for id before insert get next val in a sequence. But i need the same id for the TABLE_B for connection. ( i cant get getval because what if another user uses the program... ) So I need to reach somehow that when I use executeql(sql) command in return I see what I have submit. Now I use that I have name and date, so I select the id where name and date is the just inserted. But its not the best because in one day I can insert more names. So now this will not unique. like : insert into table a ( name,date) val ( 'Ryan','2014.01.01') id here is autoincremented by sequence than another sql run: inert into table_b ( id,someval) val ( select id from table_a where name ='Ryan', date='2014.01.01, 23) so i need something like: system.out.println(smtp.executesql(sql).whatIinsertednow()) *than console:* '1 row insered (id,name,date) : ( 1, Ryan, 2014.01.01)
linked to: http://stackoverflow.com/q/17320205
tagged with: sql
linked to: http://stackoverflow.com/q/682539
has title: Get inserted row to Oracle with java
downvote count: 0
possible better answer: http://stackoverflow.com/a/25608560
upvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/a/58971202
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25617865
has body: Yees, it is possible to run a java program without a JVM, albeit with limitations. Aside from the http://en.wikipedia.org/wiki/GNU_Compiler_for_Java , there is the GraalVM native-image generator, which could be used : https://www.graalvm.org.
type: Answer
score: 2

http://stackoverflow.com/a/25675246
has comment: http://stackoverflow.com/comment/40126656
answers question: http://stackoverflow.com/q/25674713
downvote count: 0
type: Answer
has body: You should not rely on implicit joins when you need to reference them in your where clause. So instead of: FROM PatientInfo AS pi WHERE pi.customerApplicationPatient.customerApplication.customerApplicationId = :customerApplicationId AND pi.customerAppPatient.patient.patientId = :patientId to select pi from PatientInfo AS pi inner join pi.customerApplicationPatient cap inner join cap.customerApplication ca inner join cap.patient p where ca.customerApplicationId = :customerApplicationId AND p.patientId = :patientId The explicit joins will be translated to the exact join statements you'd expect. The previous query might not be that clever and might join the same child table twice.
score: 1
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25674713

http://stackoverflow.com/comment/40223775
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25704527
has text: ok I got rid of maven altogether an created a normal java project, added the dependencies manually as external jars and still no luck. I also tried running eclipse with Admin account, but still didnt work. Though, the same code worked fine on another machine with same JDK, same architecture. I guess, there is some environment issue. Trying to zero down on it now. Thanks for help though.
type: Comment

http://stackoverflow.com/comment/39920101
score: 2
has text: I don't see the parentheses you talk about in the code you posted.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25563111

http://stackoverflow.com/q/25677386
answer count: 1
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40129428
has body: I am getting a Null Pointer Exception in my .java files and I've got no idea what I need to do to fix them. Here is my logCat showing where the error is getting thrown.: 09-05 11:17:19.569 12588-12588/au.gov.nsw.shellharbour.saferroadsshellharbour E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at android.content.ContextWrapper.getSystemService(ContextWrapper.java:370) at com.android.internal.app.AlertController$AlertParams.&lt;init&gt;(AlertController.java:801) at android.app.AlertDialog$Builder.&lt;init&gt;(AlertDialog.java:273) at au.gov.nsw.shellharbour.saferroadsshellharbour.GPSTracker.&lt;init&gt;(GPSTracker.java:116) at au.gov.nsw.shellharbour.saferroadsshellharbour.HomeScreen$1.onClick(HomeScreen.java:30) at android.view.View.performClick(View.java:2494) at android.view.View$PerformClick.run(View.java:9122) at android.os.Handler.handleCallback(Handler.java:587) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3806) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(Native Method) I should point out that I'm starting out in android, having done a fair amount in iOS. Here are my .java files HomeScreen.java: public class HomeScreen extends ActionBarActivity { Button btnShowLocation; //GPSTracker Class GPSTracker gps; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_home_screen); btnShowLocation = (Button) findViewById(R.id.btnShowLocation); //show location button click event btnShowLocation .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //create class object gps = new GPSTracker(HomeS…
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25677502
has title: NullPointerException in 2 .java files
tagged with: android
has answer: http://stackoverflow.com/a/25677502
has comment: http://stackoverflow.com/comment/40129298
has comment: http://stackoverflow.com/comment/40129246
type: AnsweredQuestion
tagged with: java
downvote count: 0

http://stackoverflow.com/q/25551686
tagged with: java
has body: I'm facing this task: I have class A and class B. These two classes are different but almost the same. I need to somehow merge them into 1 Single array of objects so I will be able to use them later in a list that combines both classes. Class A: public class Followers { private String request_id; private String number_sender; private String state; public String getRequest_id() { return request_id; } public String getNumber_sender() { return number_sender; } public String getState() { return state; } } Class B: public class Following { private String name; private String state; private String request_id; public String getRequest_id() { return request_id; } public String getName() { return name; } public String getState() { return state; } } I've tried doing this next move: Object[] obj1 = (Object[]) followers; Object[] obj2 = (Object[]) followings; Object[] completeArray = ArrayUtils.addAll(obj1, obj2); Where followers and followings are both arrays of the corresponding classes. Then in my list adapter I use: if (values[currentItem] instanceof Followers) { BLA BLA BLA} else if (values[currentItem] instanceof Following) { BLA BLA BLA} But I get this exception: Caused by: java.lang.ArrayStoreException: source[0] of type json.objects.Following cannot be stored in destination array of type json.objects.Followers[] What will be the best way to merge two arrays of different objects into one array? Will just implementing the same interface between them do the job and then they will basically be in an array of the interface type? what other ways do you recommend?
possible better answer: http://stackoverflow.com/a/25551928
has answer: http://stackoverflow.com/a/25551923
answer count: 4
has answer: http://stackoverflow.com/a/25551876
type: Question
has answer: http://stackoverflow.com/a/25551928
score: 0
has comment: http://stackoverflow.com/comment/39898607
tagged with: arrays
type: AnsweredQuestion
tagged with: object
accepted answer: http://stackoverflow.com/a/25551747
has title: Merge two Arrays of different objects into one Array/collection
has comment: http://stackoverflow.com/comment/39898635
has answer: http://stackoverflow.com/a/25551747

http://stackoverflow.com/comment/39952434
has text: Are you using this code DatabaseHandler db = new DatabaseHandler(context); in your activity?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25579987

http://stackoverflow.com/q/25571156
has comment: http://stackoverflow.com/comment/39935673
duplicate of: http://stackoverflow.com/q/6343166
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39935750
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39938305
has comment: http://stackoverflow.com/comment/39935800
linked to: http://stackoverflow.com/q/6343166
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39935837
tagged with: android
tagged with: java
has body: I have an asynchTask that is downloading a file, which is working fine. However I want to account for the internet connection dropping midway through the download, and then attempt to restart the download after the connection has been restored. To do this I tried to put the downloading into a Runnable so that if I catch an error I can just re-run the runnable after the connection has been restored. When I try to run this I get an exception saying it is using the main thread(see logcat below), I'm calling the runnable from doInBackground() so presumably it should be run on a separate thread, or is my reasoning wrong? Posting code is not really possible as it is ~1000 lines of code, and I would rather be told why my reasoning is wrong than have someone fix the code for me as I'm more likely to learn from it. Logcat android.os.NetworkOnMainThreadException E/BxmcGFT ( 3808): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117) E/BxmcGFT ( 3808): at java.net.InetAddress.lookupHostByName(InetAddress.java:385) E/BxmcGFT ( 3808): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) E/BxmcGFT ( 3808): at java.net.InetAddress.getAllByName(InetAddress.java:214) E/BxmcGFT ( 3808): at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:70) E/BxmcGFT ( 3808): at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:50) E/BxmcGFT ( 3808): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:341) E/BxmcGFT ( 3808): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87) E/BxmcGFT ( 3808): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) E/BxmcGFT ( 3808): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315) E/BxmcGFT ( 3808): at libcore.net.http.HttpEngine.connect(HttpEngine.java:310) E/BxmcGFT ( 3808): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289) E/BxmcGFT ( 3808): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:2…
has title: Runnable inside an AsyncTask being run on main thread.
has comment: http://stackoverflow.com/comment/39974268
has comment: http://stackoverflow.com/comment/62836826
type: Question
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/39951888

http://stackoverflow.com/a/25725718
answers question: http://stackoverflow.com/q/25676779
has comment: http://stackoverflow.com/comment/40279927
score: 0
has body: If you dont have any apparent errors in your files (marked with a red underline in IntelliJ) then you can do "Invalidate Caches and restart" Goto settings (alt+ctrl+s) Select "Invalidate Caches / Restart" Select "Invalidate and restart"
type: Answer

http://stackoverflow.com/comment/39976244
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25593147
has text: Perhaps your code is throwing an exception that you're not catching? Again, please elaborate. Post a [minimal example program](http://stackoverflow.com/help/mcve).

http://stackoverflow.com/comment/135960323
comment on: http://stackoverflow.com/a/54487733
type: Comment
score: 1
has text: **"Don't use bundled mvn."** – That was it.
type: AnswerComment

http://stackoverflow.com/comment/39914926
type: QuestionComment
score: 0
has text: @DonRoby Do you mean the lack of `class`? I've added those in. Now the question is why that generic compilation error happens.
comment on: http://stackoverflow.com/q/25560145
type: Comment

http://stackoverflow.com/comment/40190941
type: AnswerComment
comment on: http://stackoverflow.com/a/25711155
has text: i tried using but it was not working,so i tried which is there in the post
type: Comment
score: 0

http://stackoverflow.com/comment/40263632
comment on: http://stackoverflow.com/a/25671947
has text: `s:RunJava` is local script function you can call it from same script in your case - from .(g)vimrc. For manual call you must define function like this `g:RunJava`. `g:` for global functions and variables.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25701308
has body: I am trying to create Multi user chat group from App Server(TOMCAT),I have created a XMPP bot in a servlet. As per my requirement i have to create a Multiuser Chat group from App server(using xmpp bot on app server),and join user from android app. Creation of Multi user chat group and joining user from Android(using aSmack)works just fine,when i try to do same thing on appServer(TOMCAT),i am getting error, At first when I try to create MUC i was getting "Can't create a multi user chat (MUC) room with aSmack library for Android: “packet.DefaultPacketExtension cannot be cast to packet.MUCUser”, When i searched on SO i found POST in which @FLOW has mention reson for this error which is org.jivesoftware.smack.packet.DefaultPacketExtension cannot be cast to org.jivesoftware.smackx.packet.MUCUser is usually an indicator that you didn't initialized the static code of aSmack that takes care of registering the Smack providers for the various packet (and packet extension) classes of Smack. For most aSmack versions, simply calling SmackAndroid.init(Context ctx) will do the trick. There is no such method in core Smack package which takes care of registering the Smack providers for the various packet (and packet extension) classes of Smack. So i have manually configure provide using configure(ProviderManager pm) method on this link Now after configuring provider everything should be working fine but still i am unable to create MUC group My code is as below SmackConfiguration.setPacketReplyTimeout(packetReplyTimeout); if(service != null) config = new ConnectionConfiguration(server, port, service); else config = new ConnectionConfiguration(server, port); config.setSASLAuthenticationEnabled(true); config.setSecurityMode(SecurityMode.disabled); config.setDebuggerEnabled(true); connection = new XMPPConnection(config); connection.connect(); System.out.println("Connected: " + connection.isConnected()); chatManager = connection.getChatManager(); messageListener = new MyMessageListener()…
type: Question
tagged with: smack
has title: Smack throws "Exception in thread "Smack Packet Reader (0)" java.lang.NoSuchMethodError: org.jivesoftware.smack.util.StringUtils.parseDate"
upvote count: 1
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25701848
tagged with: xmpp
tagged with: java
has answer: http://stackoverflow.com/a/25701848
answer count: 1
linked to: http://stackoverflow.com/q/15174040
downvote count: 1
favorite count: 0

http://stackoverflow.com/a/25678462
score: 0
answers question: http://stackoverflow.com/q/25674339
type: Answer
has body: One more way of doing this is using Criteria queries

http://stackoverflow.com/q/25601266
has body: I am developing a JavaFX project and I need something similar to a TouchEvent that characterizes a "push and hold" event. But It should be mapped as a MouseEvent because I'm having troubles with touch events on Linux. For instance, in Ubuntu, it won't respond to touch events. Please, let me know if you have any ideas about how to fire a MouseEvent whenever a "push and hold" occurs on Linux?
has comment: http://stackoverflow.com/comment/39991116
tagged with: touch
accepted answer: http://stackoverflow.com/a/25610190
answer count: 1
has answer: http://stackoverflow.com/a/25610190
has comment: http://stackoverflow.com/comment/39991633
type: Question
type: AnsweredQuestion
score: 0
tagged with: linux
tagged with: javafx-8
tagged with: java
tagged with: events
has comment: http://stackoverflow.com/comment/39991037
has comment: http://stackoverflow.com/comment/39991013
has title: how to achieve javafx mouse event "push and hold"?

http://stackoverflow.com/q/25675715
has comment: http://stackoverflow.com/comment/40128035
has comment: http://stackoverflow.com/comment/40132319
tagged with: audio
score: 0
has comment: http://stackoverflow.com/comment/40142711
tagged with: java
has body: I am trying to make a program which sends a file from a server to a client (via sockets). The server converts a .wav file to a byte array and sends that to the client. My problem though is that I can't play the .wav file (at the client) because it is corrupted. I have done some research and found out that for this you can't just use a FileOutputStream or BufferedOutputStream. I just don't know how to convert the byte array to the .wav file so it can be played. Maybe someone knows the answer for me? Server code: package me.Ciaran.simplefileserver; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; public class SimpleFileServer { public final static int SOCKET_PORT = 13267; // you may change this public final static String FILE_TO_SEND = "D:/server/plugins/TBMCAudioServer/music/DLTALL.wav"; // you may change this public static void main (String [] args ) throws IOException { FileInputStream fis = null; BufferedInputStream bis = null; OutputStream os = null; ServerSocket servsock = null; Socket sock = null; try { servsock = new ServerSocket(SOCKET_PORT); while (true) { System.out.println("Waiting..."); try { sock = servsock.accept(); System.out.println("Accepted connection : " + sock); // send file final File myFile= new File(FILE_TO_SEND); //sdcard/DCIM.JPG byte[] mybytearray = new byte[8192]; fis = new FileInputStream(myFile); bis = new BufferedInputStream(fis); DataInputStream dis = new DataInputStream(bis); try { os = sock.getOutputStream(); DataOutputStream dos = new DataOutputStream(os); dos.writeUTF(myFile.getName()); dos.writeLong(mybytearray.length); int read; while((read = dis.read(mybytearray)) != -1){ dos.write(mybytearray, 0, read); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Done."); …
has comment: http://stackoverflow.com/comment/40126705
has title: Converting byte stream to .wav file
has comment: http://stackoverflow.com/comment/40142697
type: Question
has comment: http://stackoverflow.com/comment/40126402
answer count: 0
has comment: http://stackoverflow.com/comment/40132308
type: UnansweredQuestion
tagged with: sockets
tagged with: arrays
tagged with: wav
has comment: http://stackoverflow.com/comment/40132285
has comment: http://stackoverflow.com/comment/40126322

http://stackoverflow.com/a/25708010
upvote count: 1
has body: A file is a sequential data structure and only admits a linear search which is, of course, linear time. To improve this the most, you need to change your data structure in order to allow random access for a binary search. I can think of several ways to do this: Reformat your file format so that you can read it with random access. This means that you will need to make each record the same size. Read the entire file into an appropriate in-memory data structure, perhaps simply an ArrayList. Write your own data structure that provides a random-access interface to your current file format. If none of these are feasible, then you will have to settle for minor optimizations to your current linear search. These optimizations will only affect the constant factor and not change the run-time complexity, so the benefits are much more limited than the previous suggestions.
type: Answer
answers question: http://stackoverflow.com/q/25707942
downvote count: 0
score: 1

http://stackoverflow.com/q/25641027
tagged with: regex
has title: Using semicolon and comma in JTextField for search
tagged with: search
has answer: http://stackoverflow.com/a/25641443
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has body: do you have an idea why there are no search results when I use an comma or semicolon in my search bar? I really get crazy... Thanks ;-) // Create searchbar searchBar = new JTextField(15); searchButton.setVisible(false); // Add to panel panel.add(searchBar); getRootPane().setDefaultButton(searchButton); add(panel, BorderLayout.PAGE_START); ... ... ... // Integrate ActionListener for textfilter searchButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String text = searchBar.getText(); if (text.length() == 0) { tableRowSorter.setRowFilter(null); } else { tableRowSorter.setRowFilter(RowFilter.regexFilter("(?i)" + text)); } } });![Panel with search box][1]
tagged with: jtextfield
type: Question
accepted answer: http://stackoverflow.com/a/25641443
tagged with: actionlistener

http://stackoverflow.com/comment/39969004
type: QuestionComment
comment on: http://stackoverflow.com/q/25589180
score: 0
type: Comment
has text: Please read http://www.javacodegeeks.com/2012/07/four-solutions-to-lazyinitializationexc_05.html

http://stackoverflow.com/comment/40077399
type: Comment
type: QuestionComment
has text: @EricStein :) I want OP to answer my questions so they can see where they went wrong.
score: 0
comment on: http://stackoverflow.com/q/25648642

http://stackoverflow.com/comment/40167235
has text: @Alon well it's simply impossible unless you write your own custom layout
type: Comment
comment on: http://stackoverflow.com/a/25698016
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39996903
has text: Valid tables for some common data
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25603949

http://stackoverflow.com/a/27492107
answers question: http://stackoverflow.com/q/25630369
type: Answer
score: 0
has body: I believe what you need to do is open a second audio stream for the PCM data, and play it simultaneously with the mp4 file. This will likely require some thread programming. I've done this myself and am happy to offer help.

http://stackoverflow.com/comment/40049016
score: 0
comment on: http://stackoverflow.com/q/25632733
type: Comment
type: QuestionComment
has text: I agree with that, but for the values for which float<-> int is exact, couldn't you return that value, say 6, not 6.0? Conserve memory?

http://stackoverflow.com/q/25557516
tagged with: jquery
score: -1
tagged with: css
tagged with: jssor
has answer: http://stackoverflow.com/a/25560247
upvote count: 0
has comment: http://stackoverflow.com/comment/39913160
tagged with: java
answer count: 1
downvote count: 1
has body: Few things: I think there is a JQuery Clash, because either the nav bar wont load or the slider wont work I can't get the jssor slider to work at 100% width and height. It only works when i set the w and h in pixels. Here is the head tag of the site: $gantry->addScript(array( 'tooltips.js', 'jquery.preloader.js', 'touch.gallery.js', 'jquery.isotope.min.js', 'scripts.js' )); ?> And here is the slider div: <?php if ($class=="homepage") :?> <?php endif; ?> Been digging through this and searching for answers for about 5 hours now. Am I missing something really big thats in front of my face? Site: www.xabre.net/tempbw
has title: jssor - Clash of JQuery of some sort?
favorite count: 0
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39912932
tagged with: javascript

http://stackoverflow.com/comment/39915296
comment on: http://stackoverflow.com/a/25560355
type: AnswerComment
has text: NPE is generally caused by a reference to a NULL object. (Well, fine ALWAYS) it is not caused by a non existent file as that would cause the FileNotFoundException. (Subclass of Exception)
score: 0
type: Comment

http://stackoverflow.com/comment/39929585
type: Comment
score: 0
type: AnswerComment
has text: Can you please answere me what I have to do? When we deliver our product we bundle jdk 32 bit with it. So now what jdk we should bundle? It support LINUX and WINDOWS. JAVA, JSP and servlet is used to create this product and on tomcat it is running. So what jdk I should bundle with this product.
comment on: http://stackoverflow.com/a/25567571

http://stackoverflow.com/q/25609538
type: Question
has comment: http://stackoverflow.com/comment/40033160
score: 0
tagged with: java
has body: In an Spring MVC AOP project I have two interfaces and two classes, beyond a Model class as follows: ActivityDao (Interface) ActivityDaoImpl (Class) ActivityService (Interface) ActivityServiceImpl (Class) Activity (Class) Model class (n. 5): package com.mycompany.myproject.model; //... imports @Entity public class Activity { @NotNull private long id; private String description; public Activity() { } //... getters and setters } Dao Interface (n. 1): package com.mycompany.myproject.dao; import com.mycompany.myproject.model.Activity; import java.util.Collection; public interface ActivityDao { public Collection&lt;Activity&gt; findAll(); public void delete(Activity activity); public void create(Activity activity); public Activity update(Activity activity); } } Dao Implementation (n. 2): package com.mycompany.myproject.dao.impl; import com.mycompany.myproject.model.Activity; import com.mycompany.myproject.dao.ActivityDao; import java.util.Collection; // ... other imports @Repository public class ActivityDaoImpl implements ActivityDao { //... Spring autowiring, etc. public Collection&lt;Activity&gt; findAll(){ //... } // other methods implementation } Service interface (n. 3): package com.mycompany.myproject.service; import com.mycompany.myproject.model.Activity; import java.util.Collection; //... other imports public interface ActivityService { public Collection&lt;Activity&gt; getAllActivities(); // other method statements } Service Class (n. 4): package com.mycompany.myproject.service.impl; import com.mycompany.myproject.model.Activity; import com.mycompany.myproject.dao.ActivityDao; import java.util.Collection; import com.mycompany.myproject.service.ActivityService; // ... other imports @Service @Transactional(readOnly = true) public class ActivityServiceImpl implements ActivityService { @Autowired ActivityDao activityDao; public Collection&lt;Activity&gt; getAllActivities(){ //&lt;=== ERROR! return activityDao.findAll(); } // other methods implementation } Java gramm…
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40017730
has title: How to fix Collection<type> import issues in Eclipse
has answer: http://stackoverflow.com/a/25624444
type: UnansweredQuestion
answer count: 1
tagged with: spring

http://stackoverflow.com/comment/49914569
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/30938468
has text: I don't understand your point. The interceptor does not need to handle any dirty checking, as far as I can see you can just set it to always return the new value. Then the enhanced dirty checking works properly. By configuring via annotations a simple dummy interceptor, the enhanced dirty checking works. I thought this was what you wanted. Otherwise this question is just a bug report: "The enhanced code requires an interceptor - either it shouldn't or Hibernate should supply a dummy, without explicitly being told to via annotations".
type: Comment

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/25637185
tags question: http://stackoverflow.com/q/25572916
tags question: http://stackoverflow.com/q/25615895
tags question: http://stackoverflow.com/q/25567041
tags question: http://stackoverflow.com/q/25653407
tags question: http://stackoverflow.com/q/25582968
tags question: http://stackoverflow.com/q/25584183
tags question: http://stackoverflow.com/q/25603463
tags question: http://stackoverflow.com/q/25640439
tags question: http://stackoverflow.com/q/25641985
tags question: http://stackoverflow.com/q/25699225
tags question: http://stackoverflow.com/q/25660433
tags question: http://stackoverflow.com/q/25708946
tags question: http://stackoverflow.com/q/25663348
tags question: http://stackoverflow.com/q/25586435
tags question: http://stackoverflow.com/q/25615936
tags question: http://stackoverflow.com/q/25621691
tags question: http://stackoverflow.com/q/25691550
tags question: http://stackoverflow.com/q/25678724
tags question: http://stackoverflow.com/q/25587338
tags question: http://stackoverflow.com/q/25707728
tags question: http://stackoverflow.com/q/25674963
tags question: http://stackoverflow.com/q/25602644
tags question: http://stackoverflow.com/q/25663888
tags question: http://stackoverflow.com/q/25603581
tags question: http://stackoverflow.com/q/25637521
tags question: http://stackoverflow.com/q/25711351
tags question: http://stackoverflow.com/q/25570758
tags question: http://stackoverflow.com/q/25582730
tags question: http://stackoverflow.com/q/25572564
tag name: json
tags question: http://stackoverflow.com/q/25641993
tags question: http://stackoverflow.com/q/25693828
tags question: http://stackoverflow.com/q/25638809
tags question: http://stackoverflow.com/q/25564633
tags question: http://stackoverflow.com/q/25693041
tags question: http://stackoverflow.com/q/25560013
tags question: http://stackoverflow.com/q/25595931
tags question: http://stackoverflow.com/q/25553113
tags question: http://stackoverflow.com/q/25688532
tags question: http://stackoverflow.com/q/25564116
tags question: http://stackoverflow.com/q/25665519
tags question: http://stackoverflow.com/q/25651225
tags question: http://stackoverflow.com/q/25705187
tags question: http://stackoverflow.com/q/25675011
tags question: http://stackoverflow.com/q/25681071
tags question: http://stackoverflow.com/q/25576302
tags question: http://stackoverflow.com/q/25601517
tags question: http://stackoverflow.com/q/25629105
tags question: http://stackoverflow.com/q/25590303
tags question: http://stackoverflow.com/q/25581678
tags question: http://stackoverflow.com/q/25602284
tags question: http://stackoverflow.com/q/25660582
tags question: http://stackoverflow.com/q/25653017
tags question: http://stackoverflow.com/q/25568216
tags question: http://stackoverflow.com/q/25560241
tags question: http://stackoverflow.com/q/25557790
tags question: http://stackoverflow.com/q/25556908
tags question: http://stackoverflow.com/q/25608059
tags question: http://stackoverflow.com/q/25680877
tags question: http://stackoverflow.com/q/25565377
tags question: http://stackoverflow.com/q/25612786
tags question: http://stackoverflow.com/q/25601422
tags question: http://stackoverflow.com/q/25602936
tags question: http://stackoverflow.com/q/25608189
tags question: http://stackoverflow.com/q/25617907
tags question: http://stackoverflow.com/q/25586687
tags question: http://stackoverflow.com/q/25621522
tags question: http://stackoverflow.com/q/25600545
tags question: http://stackoverflow.com/q/25698687
tags question: http://stackoverflow.com/q/25640679
tags question: http://stackoverflow.com/q/25694832
tags question: http://stackoverflow.com/q/25619909
tags question: http://stackoverflow.com/q/25593790
tags question: http://stackoverflow.com/q/25701580
tags question: http://stackoverflow.com/q/25637417
tags question: http://stackoverflow.com/q/25563189
tags question: http://stackoverflow.com/q/25599720
tags question: http://stackoverflow.com/q/25646564
tags question: http://stackoverflow.com/q/25712407

http://stackoverflow.com/q/25600953
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39990818
has comment: http://stackoverflow.com/comment/40019801
tagged with: maven
has answer: http://stackoverflow.com/a/25602379
has body: I am getting below error while accessing http://localhost:8080/test_jboss_local/welcome url from browser : No mapping found for HTTP request with URI [/test_jboss_local/welcome] in DispatcherServlet with name 'appServlet' Below are the files: web.xml : contextConfigLocation /WEB-INF/spring/root-context.xml appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/appServlet/servlet-context.xml 1 appServlet / org.springframework.web.context.ContextLoaderListener servlet-context.xml : <annotation-driven /> <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <beans:property name="prefix" value="/WEB-INF/views/" /> <beans:property name="suffix" value=".jsp" /> </beans:bean> root-context.xml : <tx:annotation-driven transaction-manager="transactionManager"/> <context:component-scan base-package="com.abc" /> classpath:hibernate.cfg.xml HelloController.java : @Controller public class HelloController { @RequestMapping(value="/welcome", method = RequestMethod.GET) public String welcome(ModelMap model) { model.addAttribute("message", "Maven Web Project + Spring 3 MVC - welcome()"); //Spring uses InternalResourceViewResolver and return back index.jsp return "index"; } @RequestMapping(value="/welcome/{name}", method = RequestMethod.GET) public String welcomeName(@PathVariable String name, ModelMap model) { model.addAttribute("message", "Maven Web Project + Spring 3 MVC - " + name); return "index"; } index.jsp : Hello World! Message : ${message} I have check on net and i am not able to identify mistake. Please help.
tagged with: spring
has answer: http://stackoverflow.com/a/25601077
has answer: http://stackoverflow.com/a/25617074
tagged with: spring-mvc
duplicate of: http://stackoverflow.com/q/41577234
score: 0
answer count: 3
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39990504
type: Question
has comment: http://stackoverflow.com/comment/39990486
has comment: http://stackoverflow.com/comment/39990646
linked to: http://stackoverflow.com/q/41577234
has title: No mapping found for HTTP request with URI [/test_jboss_local/welcome] in DispatcherServlet with name 'appServlet'

http://stackoverflow.com/a/25695635
has comment: http://stackoverflow.com/comment/40642215
has comment: http://stackoverflow.com/comment/40315499
has comment: http://stackoverflow.com/comment/40405869
has comment: http://stackoverflow.com/comment/40407127
has body: I have never used Solr before, but here's one way to go about this with JavaCPP and Maven. First, create this pom.xml build file: 4.0.0 com.example solrtest 0 org.bytedeco javacpp 0.9 org.apache.solr solr-solrj 1.4.1 org.apache.solr solr-core 1.4.1 org.slf4j slf4j-api 1.7.7 org.slf4j slf4j-simple 1.7.7 org.bytedeco javacpp true . . . process-classes process-classes build org.apache.solr solr-solrj 1.4.1 solr-core org.apache.solr 1.4.1 org.apache.maven.plugins maven-shade-plugin 2.3 package shade As well as this src/main/java/SolrTest.java source file: import java.io.*; import org.apache.solr.core.*; import org.apache.solr.client.solrj.*; import org.apache.solr.client.solrj.embedded.*; import org.bytedeco.javacpp.*; import org.bytedeco.javacpp.annotation.*; public class SolrTest { static SolrServer createServer(String coreName) throws Exception { CoreContainer coreContainer = new CoreContainer(); CoreDescriptor discriptor = new CoreDescriptor(coreContainer, coreName, new File("/some/path/", coreName).getAbsolutePath()); SolrCore solrCore = coreContainer.create(discriptor); coreContainer.register(solrCore, false); return new EmbeddedSolrServer(coreContainer, coreName); } static class Query extends FunctionPointer { public @Name("query") String call(String string) throws Exception { createServer(string); return string; } } } Then we can execute mvn package, and after it has downloaded a whole bunch of things and built stuff for us, we're going to end up with target/solrtest-0.jar as well as a header file and a native library file in the target/classes subdirectory. Now, we can link all this together in C++ with a program like this: #include <iostream> #include "target/classes/jniSolrTest.h" int main() { const char *argv[] = { "-Djava.class.path=target/solrtest-0.jar" }; JavaCPP_init(1, argv); try { query("test"); } catch (std::exception &e) { std::cout << e.what() << std::endl; } JavaCPP_uninit(); } That we can compile and run this way under Linux x86_64, for example, …
has comment: http://stackoverflow.com/comment/40257421
answers question: http://stackoverflow.com/q/25655597
has comment: http://stackoverflow.com/comment/40397436
type: Answer
has comment: http://stackoverflow.com/comment/40354417
has comment: http://stackoverflow.com/comment/40339223
score: 0

http://stackoverflow.com/comment/40122374
type: Comment
comment on: http://stackoverflow.com/a/25673600
score: 0
type: AnswerComment
has text: Yes, it does log at the end

http://stackoverflow.com/comment/40057676
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25637835
has text: have you tried checking the value of `formats` if it contains an array.
type: QuestionComment

tess4j
type: Tag
tag name: tess4j
tags question: http://stackoverflow.com/q/25645462

http://stackoverflow.com/comment/39945608
score: 0
type: Comment
type: QuestionComment
has text: It's a Rubik's cube move generator, and if one move in the sequence is to, say, turn the right face (R), you don't want the next move to either be to turn it the opposite way (R') or all the way around (R2). I think the best way would be to keep track of which array the last one came from, and avoid selecting another one from it again, rather than detecting the problem after the fact and re-rolling.
comment on: http://stackoverflow.com/q/25575814

http://stackoverflow.com/q/25644681
tagged with: web-services
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/58932174
tagged with: exception
tagged with: ejbca
type: UnansweredQuestion
tagged with: keystore
has body: i have installed ejbca with jboss on a ubuntu server. The version of jboss is 5.1.0.GA, while the version of ejbca is 4_0_10. Now i would use ejbca function in my java project (eclipse) so I implemented the following code: CryptoProviderTools.installBCProvider(); String urlstr = "https://EJBCA.cloud:8443/ejbca/ejbcaws/ejbcaws?wsdl"; System.setProperty("javax.net.ssl.trustStore","C:\\Users\\PcEclipse.jks"); System.setProperty("javax.net.ssl.trustStorePassword","Prova"); System.setProperty("javax.net.ssl.keyStore","C:\\Users\\PcEclipse.jks"); System.setProperty("javax.net.ssl.keyStorePassword", "Prova"); QName qname = new QName("http://ws.protocol.core.ejbca.org/", "EjbcaWSService"); EjbcaWSService service = null; try { service = new EjbcaWSService(new URL(urlstr),qname); } catch (MalformedURLException e) { // TODO Auto-generated catch block System.out.println("errore nell'url"); } EjbcaWS ejbcaraws = service.getEjbcaWSPort(); but i have the exception Exception in thread "main" javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://EJBCA.cloud:8443/ejbca/ejbcaws/ejbcaws?wsdl. It failed with: Got java.security.cert.CertificateException: No name matching EJBCA.cloud found while opening stream from https://EJBCA.cloud:8443/ejbca/ejbcaws/ejbcaws?wsdl. The keystore is generated with ejbca web ui creating a new endentity ed create a keystore in jks extension. This is a problem of keystore?How i can create the correct keystore/truststore? Thanks I have generated a new keystore and truststore but now the error is: Caused by: java.security.UnrecoverableKeyException: Password must not be null
has comment: http://stackoverflow.com/comment/40072372
has comment: http://stackoverflow.com/comment/40073577
has answer: http://stackoverflow.com/a/27248909
score: 1
tagged with: java
answer count: 1
has title: EJBCA how create keystore for communication between webservice and java code (wsdl exception)
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/40114922
comment on: http://stackoverflow.com/q/25669445
score: 1
type: Comment
type: QuestionComment
has text: You have a lot of if statements, but no else-if statements.

http://stackoverflow.com/a/25568357
type: Answer
has body: You are not clearing the old list data. you have remove the old records from the list. public void builtListView() { _translist.clear(); DatabaseAdapter mDbHelper = new DatabaseAdapter(this); mDbHelper.createDatabase(); mDbHelper.open(); TransactionRecController trc = new TransactionRecController( mDbHelper.open()); ArrayList&lt;TransactionRecModel&gt; trans_list = trc .getTransactionRec(session_userID); for (int i = 0; i &lt; trans_list.size(); i++) { String date = trans_list.get(i).getDate(); String categoryName = trans_list.get(i).getCategory(); String transDesc = trans_list.get(i).getTransDescription(); TransactionRecModel _TransModel = new TransactionRecModel(); _TransModel.setDate(date); _TransModel.setCategory(categoryName); _TransModel.setTransDescription(transDesc); _translist.add(_TransModel); } // Set the data into listview listview.setAdapter(new ListAdapter(this)); mDbHelper.close(); } or you can reassign the values public void builtListView() { _translist.clear(); DatabaseAdapter mDbHelper = new DatabaseAdapter(this); mDbHelper.createDatabase(); mDbHelper.open(); TransactionRecController trc = new TransactionRecController( mDbHelper.open()); _translist = trc .getTransactionRec(session_userID); // Set the data into listview listview.setAdapter(new ListAdapter(this)); mDbHelper.close(); }
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25568221
answers question: http://stackoverflow.com/q/25568221

http://stackoverflow.com/comment/40268322
score: 0
type: Comment
has text: Have you tried this solution? http://stackoverflow.com/a/7504552/2492784
type: QuestionComment
comment on: http://stackoverflow.com/q/25573479

http://stackoverflow.com/a/25685571
score: 0
answers question: http://stackoverflow.com/q/25685158
type: AcceptedAnswer
has body: Someone stop me if I'm wrong, but the fact you application will be deplyed on the cloud only mean it will be on a virtual server hosted by an extern compagnie, wich in the case of your question don't chance anything. So the question is "is the database versionning system Liquibase on a database with an aimed stable shema worth it". In absolute it could be considered overkill, and a lot of big companies still manage database schema evolution with bare sql scripts. You could simply export the final built script of your developpement database and go with it. But since you know Liquibase, the overhead is pretty cheap, and the comfort of using if you happen to have to modify tour shema later is important. So yes, I think it's a pretty good pratice (safer than hand applying script under the stress of a production server problem) which cost one or two hours(given you know how to use the tool) and can save dozens when having to handle hotfixing of a production database.
type: Answer
accepted answer of: http://stackoverflow.com/q/25685158

http://stackoverflow.com/a/25700901
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/40172657
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40172472
answers question: http://stackoverflow.com/q/25700575
has comment: http://stackoverflow.com/comment/40172598
accepted answer of: http://stackoverflow.com/q/25700575
has body: Each Fragment can declare its own menu, which will be automatically merged with the current activity's menu. class YourPage extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Signal that this fragment has proper actions setHasOptionsMenu(true); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); // The menu will be added to the action bar inflater.inflate(R.menu.fragment_page_menu, menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_refresh: { // Handle the action... return true; } default: return super.onOptionsItemSelected(item); } } } Here's a complete example that I made, and also a relevant tutorial.

http://stackoverflow.com/q/25611674
accepted answer: http://stackoverflow.com/a/25612231
has title: How to find and read a line in a file with a specific value?
linked to: http://stackoverflow.com/q/101100
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/40009901
score: -1
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40009897
answer count: 1
tagged with: file
has comment: http://stackoverflow.com/comment/40009979
has body: I have an input text file in the following format: 11111, "Top Secret Twenty One - Janet Evanovich", 8.99 22222, "W Is For Wasted - Sue Grafton", 9.95 33333, "Gray Mountain - John Grisham", 14.95 44444, "Revival - Stephen King", 12.95 How can I read in "1111" "Top Secret Twenty One - Janet Evanovich" and "8.99" as separate variables without the quotes and commas? I'm basically trying to search the file for the bookID (aka "11111").
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25612231

http://stackoverflow.com/comment/40081236
type: AnswerComment
score: 0
has text: So you could switch the module implementation you use based on a properties file if the requested class is known to the producer method (included in the list)
comment on: http://stackoverflow.com/a/25649981
type: Comment

spring-social-google
tag name: spring-social-google
tags question: http://stackoverflow.com/q/25565238
type: Tag

http://stackoverflow.com/comment/40157098
type: AnswerComment
has text: Ok, I will try to learn about UUID.randomUUID().toString(). Thank you
comment on: http://stackoverflow.com/a/25692477
score: 0
type: Comment

http://stackoverflow.com/q/25656544
has title: Purpose of certain components
has comment: http://stackoverflow.com/comment/40092034
tagged with: algorithm
has body: This problem asks you to create an algorithm to determine if a string has unique characters. I was looking through solutions and this seems to be the most simplistic one I can find, however there are still a few parts of this code I can't wrap my head around. boolean[] chars = new boolean[26]; what exactly is the coder doing? Do the 26 characters represent the 26 letters of the alphabet. I ask because when I fiddled around with the code and changed the value to 12, 15, 20 etc the program still gave correct output. if(chars[(int)c - 'A']) What is the purpose of subtracting 'A' from the int c? I've seen this method of subtracting 'A' or 'a' in multiple solutions to this problems but I don't understand what purpose it serves. public class PracticeProblems { public static void questionOne(String input) { boolean[] chars = new boolean[26]; String upper = input.toUpperCase(); for(int i = 0, n = upper.length(); i &lt; n; i++){ char c = upper.charAt(i); if ('A' &lt;= c &amp;&amp; c &lt;= 'Z'){ if(chars[(int)c - 'A']){ System.out.println("not unique"); return; } chars[(int)c - 'A'] = true; } } System.out.println("unique"); } public static void main(String[] args) { questionOne("bil"); } }
accepted answer: http://stackoverflow.com/a/25656567
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25656567
tagged with: java
answer count: 1
tagged with: arrays
upvote count: 1
downvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/40039296
score: 1
type: Comment
type: QuestionComment
has text: Did you search for this Problem in Google first? Stack Overflow 2011: http://stackoverflow.com/questions/6343166/android-os-networkonmainthreadexception
comment on: http://stackoverflow.com/q/25627544

http://stackoverflow.com/a/25598104
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25598061
type: Answer
has body: Assuming by "letter" you mean an english character in A-Z, a-z, just iterate through the string and return true if you encounter a character whose int value is outside the letter range. public static boolean containsNonLetter(String s){ for(int i = 0; i &lt; s.length(); i++){ int ind = (int)s.charAt(i); if(ind &lt; 65 || (ind &gt; 90 &amp;&amp; ind &lt; 97) || ind &gt; 122) return true; } return false; }
accepted answer of: http://stackoverflow.com/q/25598061

http://stackoverflow.com/a/25703228
downvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25703056
upvote count: 13
has comment: http://stackoverflow.com/comment/139406778
score: 12
has body: You can take a look to JXTaskPaneContainer and JXTaskPane from SwingX project which have these advantages: They are components just like a JPanel is so no extra effort is required to work with them. Unlike accordions you can have more than one panel expanded at any time. They have a cool and smooth effect on collapsing/expanding events. Unlike trees/tree tables you don't have to mess with either TreeModel nor TreeTableModel at all. Also trees and tree tables are components intended to show data in a hierarhical form, not to add components into it. If you don't like task panes and want to implement something on your own then you have JXCollapsiblePane (also available in SwingX API). Check SwingLabs Demos for a complete set of SwingX components demo. Screenshot
answers question: http://stackoverflow.com/q/25703056
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/127986445

http://stackoverflow.com/comment/40189820
has text: is main class present in your manifest file ? Here is the sample tutorial for creating executable jars http://www.mkyong.com/java/how-to-make-an-executable-jar-file/
score: 0
comment on: http://stackoverflow.com/q/25710421
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25697764
score: 7
type: Answer
answers question: http://stackoverflow.com/q/25697729
has comment: http://stackoverflow.com/comment/40166743
has body: hMap.clear() always worked fine for me. Still hMap.put("A","test"); will automatically override the existing value for key "A". If you still wish to clear values, You can use hMap = new HashMap&lt;String,String&gt;(); which will initialize a new hashmap in hMap.
has comment: http://stackoverflow.com/comment/40166751
has comment: http://stackoverflow.com/comment/40166733
upvote count: 7
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40166817
has comment: http://stackoverflow.com/comment/40207836
has comment: http://stackoverflow.com/comment/40166816
accepted answer of: http://stackoverflow.com/q/25697729

http://stackoverflow.com/q/25700987
answer count: 2
upvote count: 2
has answer: http://stackoverflow.com/a/25701045
has body: The sample source code to match is String string="welcome"; String k="a\"welcome"; I am using "(\"[^(\")]*\")" regex in java. But this extracts 0:"welcome" 0:"a\" Expected output is 0:"welcome" 0:"a\"welcome" What change should i make in regex to get the expected output ? Java source : private static String pattern1="(\"[^(\")]*\")"; public void getStrings(){ Pattern r = Pattern.compile(pattern1); Matcher m = r.matcher("String string=\"welcome\";\n" + "String k=\"a\\\"welcome\";"); while(m.find()){ System.out.println("0:"+m.group(0)); } }
downvote count: 0
has title: regular expression to extract string from java code
linked to: http://stackoverflow.com/q/18547501
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40172465
has answer: http://stackoverflow.com/a/25701029
duplicate of: http://stackoverflow.com/q/18547501
type: UnansweredQuestion
tagged with: java
tagged with: regex
score: 2

http://stackoverflow.com/comment/40122209
has text: No your new solution is not generic. Its not gonna work. I like your idea of creating a extended class GenericTable. The only thing is i need to figure out how to make it work when i am calling method loadScreen(Person) or loadScreen(Equipment) or loadScreen(Vehicle). Basically the idea is to load the Table view for any type that is passed in.
type: AnswerComment
comment on: http://stackoverflow.com/a/25656697
score: 0
type: Comment

http://stackoverflow.com/q/25605145
accepted answer: http://stackoverflow.com/a/25605243
has body: I should be able to check if a cell is being edited during mouse hover by passing the column and row: TableCellEditor cellEditor = table.getCellEditor(rowPoint, colPoint); In the above example cellEditor doesn't provide a way to check whether is in edit mode. On the other hand, by checking table.isEditing() is not enough because it returns true if any one of the cells is being edited.
has title: How to check if a particular cell in JTable is being edited?
tagged with: jtable
type: AnsweredQuestion
upvote count: 3
score: 3
tagged with: java
answer count: 1
downvote count: 0
tagged with: swing
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25605243

http://stackoverflow.com/q/25598859
answer count: 1
downvote count: 0
tagged with: hortonworks-data-platform
has title: How connect to Hortonworks sandbox Hbase using Java Client API
tagged with: java
has comment: http://stackoverflow.com/comment/43888301
favorite count: 0
type: Question
score: 2
has answer: http://stackoverflow.com/a/29906714
upvote count: 2
has body: I have setup fresh Hortonworks sandbox .I'm trying to connect Hbase using Java Client API.This is the code i tried so far.But did not success.I did not change any configuration on Wortonworks sandbox.Do i need to do any configuration part in Hbase ? Configuration configuration = HBaseConfiguration.create(); configuration.set("hbase.zookeeper.property.clientPort", "2181"); configuration.set("hbase.zookeeper.quorum", "127.0.0.1"); configuration.set("hbase.master", "127.0.0.1:600000"); HBaseAdmin hBaseAdmin = new HBaseAdmin(configuration);
tagged with: hbase
type: UnansweredQuestion

http://stackoverflow.com/comment/40347489
has text: @specializt, Sorry, perhaps "configure" was not the right word. http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#Thread%28java.lang.ThreadGroup,%20java.lang.Runnable,%20java.lang.String,%20long%29
score: 0
comment on: http://stackoverflow.com/a/25701565
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40074373
type: QuestionComment
score: 0
has text: You need to start up the X server and set the DISPLAY environment variable to point to the local machine. Although your goal is to support a program you are writing, this would probably be better handled at unix.stackexchange.com or raspberrypi.stackexchange.com
comment on: http://stackoverflow.com/q/25647052
type: Comment

http://stackoverflow.com/q/25578061
has body: I am trying to write a method that will scan the input and return a String representing the lexeme found in the input string. This is what I have so far but I don't know if I'm going in the right direction-- all help would be appreciated :) private String scanNumbers(char input) { String result= ""; int value = in.read() if(value != -1) { If(isDigit(input)) { result = Integer.toString(value); } } return result; } public static boolean isDigit(char input) { return (input &gt;= '0' &amp;&amp; input &lt;= '9'); } Thank you I am new to parsing/lexemes/compilers.
has answer: http://stackoverflow.com/a/30277465
answer count: 1
tagged with: lexical-analysis
has title: Scanning a number and returning the lexeme in the input stream- Java?
tagged with: java
has comment: http://stackoverflow.com/comment/39950456
linked to: http://stackoverflow.com/q/16008685
has comment: http://stackoverflow.com/comment/39949389
has comment: http://stackoverflow.com/comment/39949059
type: Question
score: 0
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/39948933
type: UnansweredQuestion

http://stackoverflow.com/comment/113959244
score: 0
has text: There is no use of Hibernate in this answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/25601920
type: Comment

http://stackoverflow.com/comment/40196213
comment on: http://stackoverflow.com/a/25712728
score: 0
type: AnswerComment
has text: @m4rtin I don't understand what you are saying. I am exactly saying "the normal flow of the function continues" and in the OP's code, that means returning false.
type: Comment

http://stackoverflow.com/comment/39936886
type: AnswerComment
comment on: http://stackoverflow.com/a/25566924
type: Comment
has text: It's the same. For 40000 ms works fine, but if I set 1 minute it doesn't.
score: 0

http://stackoverflow.com/comment/40097241
score: 0
comment on: http://stackoverflow.com/q/25658174
type: Comment
type: QuestionComment
has text: This is most of the server side code I used to test the problem. I commented it out because once I set the Keep-Alive to the connection with con.setRequestProperty("Keep-Alive", "300"); con.setRequestProperty("Connection", "keep-alive");If I call disconnect() on a connection , the keep-Alive won't take effect, right? It doesn't help whether I call disconnect or not anyway.

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/25658457
tags question: http://stackoverflow.com/q/25661215
tags question: http://stackoverflow.com/q/25694000
tags question: http://stackoverflow.com/q/25680108
tags question: http://stackoverflow.com/q/25604667
tags question: http://stackoverflow.com/q/25712126
type: Tag

http://stackoverflow.com/q/25659008
accepted answer: http://stackoverflow.com/a/25660284
tagged with: mysql
has answer: http://stackoverflow.com/a/45960048
type: Question
possible better answer: http://stackoverflow.com/a/45960048
tagged with: hibernate-search
answer count: 2
upvote count: 1
has title: Hibernate Search query for multiple column
tagged with: lucene
favorite count: 0
type: AnsweredQuestion
has body: @Entity // mark book class as a entity bean for hibernate @Indexed // Book as indexable @AnalyzerDef(name = "ngram", tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class), filters = { @TokenFilterDef(factory = StandardFilterFactory.class), @TokenFilterDef(factory = LowerCaseFilterFactory.class), @TokenFilterDef(factory = StopFilterFactory.class), @TokenFilterDef(factory = SnowballPorterFilterFactory.class, params = { @Parameter(name = "language", value = "English") }), @TokenFilterDef(factory = NGramFilterFactory.class, params = { @Parameter(name = "minGramSize", value = "3"), @Parameter(name = "maxGramSize", value = "6") }) }) public class Book { @Id @GeneratedValue private Integer id; @Field(index = Index.YES,store= Store.YES) @FieldBridge(impl = PaddedIntegerBridge.class,params = @Parameter(name="padding", value="10")) private int isbnNo; @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO, analyzer = @Analyzer(definition = "ngram")) private String title; //And getter setter } public class PaddedIntegerBridge implements TwoWayStringBridge, ParameterizedBridge { public static String PADDING_PROPERTY = "padding"; private int padding = 5; //default public void setParameterValues(Map parameters) { Object padding = parameters.get( PADDING_PROPERTY ); String pad = (String) padding; if (padding != null) this.padding = Integer.parseInt(pad); } public String objectToString(Object object) { String rawInteger = ( (Integer) object ).toString(); if (rawInteger.length() &gt; padding) throw new IllegalArgumentException( "Try to pad on a number too big" ); StringBuilder paddedInteger = new StringBuilder( ); for ( int padIndex = rawInteger.length() ; padIndex &lt; padding ; padIndex++ ) { paddedInteger.append('0'); } return paddedInteger.append( rawInteger ).toString(); } public Object stringToObject(String stringValue) { return new Integer(stringValue); } } I want to write the query on two searchable column i.e isbnNo and title. QueryBuilder qb = full…
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25660284

http://stackoverflow.com/a/25564728
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25560774
downvote count: 0
answers question: http://stackoverflow.com/q/25560774
score: 2
type: Answer
has comment: http://stackoverflow.com/comment/39946361
has body: The simplest would be to use strings instead of QName. You can use the javaType customization to achieve this. If you want to add prefix/namespace mappings in the runtime, there are quite a few ways to do it: Similar to above, you could provide your own QName converter which would consider your prefixes. You can put a SAX or StAX filter in between and declare additional prefixes in the startDocument. What you actually need is to add your prefix mappings into the UnmarshallingContext.environmentNamespaceContext. I've checked the source code but could not find a direct and easy way to do it. I personally would implement a SAX/StAX filter to "preprocess" your XML on the event level.
upvote count: 2

http://stackoverflow.com/comment/40000495
comment on: http://stackoverflow.com/a/25606414
type: Comment
has text: @DarioP this is the reason.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39942634
comment on: http://stackoverflow.com/q/25574797
type: Comment
type: QuestionComment
score: 0
has text: It's not clear what you're asking here. For primitives, `volatile` refers to the primitive value itself. For objects, the `volatile` keyword refers only to the reference, not the object referred to. So for `list` and `array`, `volatile` does not have any effect on the contents of the list or array. `volatile` does not do what what you seem to think it does.

http://stackoverflow.com/comment/64442087
score: 0
type: Comment
has text: Before giving a poor description of how to navigate through the menus (that is only valid for a specific windows version) you should definite explain what you're doing (i.e. remove a certain value from the path environment variable)
comment on: http://stackoverflow.com/a/25616276
type: AnswerComment

http://stackoverflow.com/comment/39937265
score: 0
type: Comment
type: QuestionComment
has text: [OFF] There's no "readed" in english. It's read. [link](http://www.usingenglish.com/reference/irregular-verbs/read.html)
comment on: http://stackoverflow.com/q/25571107

http://stackoverflow.com/a/26642262
accepted answer of: http://stackoverflow.com/q/25615649
score: 2
type: Answer
has body: This situation seems to be resolved by ensuring two things. Ensuring there are enough threads in the application's thread pool Making sure the code using Jetty clean's up and catches/manages all exceptions. The two actions are inter-related. If sometimes the HttpClient misses an exception, or error, the thread hangs around. It seems the only way to avoid this is to ensure every HttpCLient used calls HttpCLient.stop(). This needs to go in a finally {...} clause. Secondly async calls must wait for the CompleteListener before calling HttpCLient.stop(). That seems to be the only way to ensure the stop was 'cleanly' done. For some cases, stop() calls appear to proceed OK. Eventually some will cause Exceptions and you application slowly leaks resources. The appearance is like the JVM has frozen, but some non-deamon tasks may continue (e.g. a GUI thread) and you may not notice the problem until the PC itself runs out of resources or crashes. That is an extreme case ## Heading ##running over several weeks. A reliable example to appropriately close the HttpClient is shown here: How to notify "content consumed" for Jetty 9.02. ContentListener? The number of threads will depend on your application. I suggest using jVisualVM or something similar to ensure your Jetty threads are all cleaning-up properly first, before tuning the number of threads in your thread pool. I feel that the documentation needs to stress the cleaning up and ensuring stop() is called. And the information of how to conclude an Async call is undocumented as far as I can tell. As long as your Jetty calls stop cleanly, then providing sufficient threads appears to resolve this -- With the usual caveats to manage concurrency.
upvote count: 2
answers question: http://stackoverflow.com/q/25615649
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/40013546
type: Comment
type: QuestionComment
score: 0
has text: When in doubt regarding the _language_, check the language spec
comment on: http://stackoverflow.com/q/25613580

http://stackoverflow.com/comment/40033021
type: Comment
comment on: http://stackoverflow.com/a/25621736
score: 0
type: AnswerComment
has text: Tomcat is able to save sessions when stopping a web application and restore them on next start.

http://stackoverflow.com/comment/40180334
has text: @thkala but you said that they use compressed pointers of 4 bytes if the heap size is around 28 GB. but now it is 5 bytes actually
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25705074

http://stackoverflow.com/comment/40157201
comment on: http://stackoverflow.com/q/25692520
has text: @theSun `mat[i][n] = sum;` In this piece of code you are accessing `n`, which is out of bounds, since it's the size of the second dimension, maybe you mean `mat[i][n-1] = sum;`
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40190729
comment on: http://stackoverflow.com/q/25711035
type: Comment
has text: Stupid question... Is your extension `.jsp`?
score: 1
type: QuestionComment

http://stackoverflow.com/q/25632460
has body: I thought this would be really simple but so far I have not managed this. I have a tomcat cluster and I want to assign a master. I was thinking a race between nodes to lock a table. Whoever locks it is master. The master must now keep that lock. The other nodes should try to acquire the lock... I don't mind pure JDBC but the application is using JPA and EJB (TomEE) How to lock? How to hold lock? how to wait to acquire lock indefinitely if already locked? OK I managed to get it to "wait forever" but now I am scared because when reading the docs I get the impression it should not wait at all so I don't feel like I am in control... This is my deadlock using Eclipselink: Map&lt;String, Object&gt; timeout = new HashMap&lt;&gt;(); timeout.put("javax.persistence.lock.timeout", 1L); master = entityManager.find(Master.class, "MASTER", LockModeType.PESSIMISTIC_READ, timeout); the timeout flag is also specified in persistence.xml...
type: Question
tagged with: ejb
tagged with: jpa
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25634818
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25634818
tagged with: jdbc
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40048546
favorite count: 0
tagged with: jpa-2.0
has title: How to Pessimistic lock then hold indefinitely in order to track who's master in a cluster?

http://stackoverflow.com/q/25638917
has title: model class beans are not being filled
favorite count: 0
tagged with: model-driven
linked to: http://stackoverflow.com/q/25544026
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25639720
tagged with: tiles2
tagged with: struts2
type: Question
downvote count: 0
upvote count: 1
type: UnansweredQuestion
answer count: 1
tagged with: jsp
has body: I wrote a web application where there are login.jsp, loginAction and login Beans. When I fill the form in th jsp beans in the loginbeans are being filled through loginAction. When I replicate the logic from these pages to registering an user, beans are not being filled. Here is my code.. <s:form action="login" method="post"> <s:textfield key="username" label="Username" required="true" /> <s:password key="password" label="Password" required="true" /> <s:submit value="SignIn"/> </s:form> relative code in struts.xml welcome login login LoginAction.java public class LoginAction extends ActionSupport implements Action, ModelDriven<LoginBeans>{ LoginBeans loginBeans = new LoginBeans(); . . . @Override public LoginBeans getModel() { return loginBeans; } LoginBeans.java public class LoginBeans { private String username; private String password; //getters and setters } This is all working fine and beans are being filled. Now take a look at registering a user. registerOphthalmologist.jsp <s:form action="registerOphthalmologist" method="post"> <s:hidden key="role" label="role" value="O" /> <s:textfield key="username" label="Choose UserName" required="true"/> <s:password key="password" label="Choose Password" required="true"/> <s:textfield key="givenName" label="Name" required="true"/> <s:textfield key="surname" label="Surname" required="true"/> <s:textfield key="age" label="Age" required="true" value=""/> <s:select key="gender" label="Gender" list="#{'M':'Male','F':'Female'}" required="true"/> <s:textfield key="contactNumber" name="contactNumber" label="Contact Number" required="true"/> <s:textfield key="email" name="email" label="email" required="true"/> <s:textfield key="city" name="city" label="City" required="true"/> <s:textfield key="district" name="district" label="District" required="true"/> <s:textfield key="state" name="state" label="State" required="true"/> <s:textfield key="country" name="country" label="country" required="true"/> <s:textfield key="postalCode" name=…
has comment: http://stackoverflow.com/comment/40061814
linked to: http://stackoverflow.com/q/25296554

http://stackoverflow.com/q/25657321
favorite count: 0
possible better answer: http://stackoverflow.com/a/25696446
has comment: http://stackoverflow.com/comment/40093403
has comment: http://stackoverflow.com/comment/40128353
type: Question
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40129461
accepted answer: http://stackoverflow.com/a/25715868
has title: Closed app reopens itself after background intent launch
has body: I am writing an application that needs to auto logout after a period of inactivity. I use a timer to fire a logout event after a period of inactivity. After the logout event is fired the user is taken to the login activity. The logout event can fire when the app is in the background or the foreground. (added) The app does not reopen if the user has opened another app. It only reopens when the user is looking at the home screen(s) [desktop] Problem: If the application is in the background the starting of the login activity reopens the application. LogoutTimer.java Responsible for firing new LogoutEvent() after AUTO_LOGOUT_WAIT_TIME_MS public class LogoutTimer { private static LogoutTimer timer; private Handler handler; private Runnable runnable; private LogoutTimer() { this.handler = new Handler(); this.runnable = new Runnable() { @Override public void run() { Log.i(AppConfig.LogTags.SECURITY, "auto logout of application"); EventBus.getDefault().post(new LogoutEvent(LogoutTypeEnum.SESSION_EXPIRED)); } }; } public static LogoutTimer getInstance() { if (timer == null) { timer = new LogoutTimer(); } return timer; } public void restart(String source) { Log.i(AppConfig.LogTags.SECURITY, "restarting logout timer. Source: (" + source + ")"); this.clearHandler(); handler.postDelayed(runnable, AppConfig.AUTO_LOGOUT_WAIT_TIME_MS); } public void stop(String source) { Log.i(AppConfig.LogTags.SECURITY, "stopping logout timer. Source: (" + source + ")"); this.clearHandler(); } private void clearHandler() { handler.removeCallbacks(runnable); } } MyApplication.java (the event listener) The following code starts my LoginActivity. It also reopens the application even when it is in the background! The issue also occurs when I put this code inside an Activity. public class MyApplication extends Application { // other non relevant code here public void onEvent(LogoutEvent event) { Intent intent = new Intent(this, LoginActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); inten…
has comment: http://stackoverflow.com/comment/40093591
has comment: http://stackoverflow.com/comment/40130904
has answer: http://stackoverflow.com/a/25696446
type: AnsweredQuestion
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40177185
upvote count: 1
score: 1
tagged with: android-intent
has answer: http://stackoverflow.com/a/25715868

http://stackoverflow.com/q/25663501
tagged with: datetime
has comment: http://stackoverflow.com/comment/40104227
has comment: http://stackoverflow.com/comment/40104141
tagged with: date
has comment: http://stackoverflow.com/comment/40223656
type: Question
has answer: http://stackoverflow.com/a/25664818
has title: Changing date format from one to another in java
has comment: http://stackoverflow.com/comment/40103969
has answer: http://stackoverflow.com/a/25664651
linked to: http://stackoverflow.com/q/2891361
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40104105
has comment: http://stackoverflow.com/comment/40104311
has comment: http://stackoverflow.com/comment/40104491
score: 0
linked to: http://stackoverflow.com/q/1166494
has body: I am trying to convert a date(Date object) with one time zone (say IST) to a date in GMT. But i am getting a date which does have a changed time but the timezone it displays is still "IST". i want the timezone should be displayed as "GMT". I used a Date object to get the final date after trying several conversions, which gave the converted date but the time zone was still "IST" in the output. I then tried with DateTime object(Joda Time) : Date dateIndia = new Date(); DateTime dateTime = new DateTime(dateIndia); DateTimeZone timeZone = DateTimeZone.forID("GMT"); DateTime date_UtcGmt = dateTime.toDateTime(timeZone); System.out.println("dateIndia : " + dateIndia); System.out.println("dateTime : " + dateTime); System.out.println("date_UtcGmt : " + date_UtcGmt); System.out.println("date_UtcGmt.toDate : " + date_UtcGmt.toDate()); It is showing me the following output : dateIndia : Thu Sep 04 15:49:50 IST 2014 dateTime : 2014-09-04T15:49:50.152+05:30 date_UtcGmt : 2014-09-04T10:19:50.152Z date_UtcGmt.toDate : Thu Sep 04 15:49:50 IST 2014 Now i have date_UtcGmt in GMT format but when i convert it to date, it is again in IST format. I want a date object which shows GMT as its time zone. Can i change the display format of date_UtcGmt object? What should i do?
answer count: 3
has answer: http://stackoverflow.com/a/25664169
tagged with: java

http://stackoverflow.com/a/25554658
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25553113
downvote count: 0
has comment: http://stackoverflow.com/comment/39905665
accepted answer of: http://stackoverflow.com/q/25553113
has body: JAXB does not require annotations. It can be configured externally. Consider: http://blog.bdoughan.com/2010/12/extending-jaxb-representing-annotations.html Also, I've found for many cases, the default (i.e. no annotations) work pretty well. So, you will likely not have a large burden to boot strap you code. If you have a common "root" object that you're using, a single XmlRootElement starts the entire engine going, and even that isn't completely required. You'll need to be careful of cyclic graphs in the your beans, but these can be managed as well with JAXB.
type: Answer
has comment: http://stackoverflow.com/comment/39909836
score: 2

http://stackoverflow.com/q/25664891
downvote count: 0
tagged with: web-applications
linked to: http://stackoverflow.com/q/728812
has answer: http://stackoverflow.com/a/25664987
favorite count: 0
type: Question
upvote count: 4
has title: Limit number of users accessing a java web application
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25665128
score: 4
tagged with: java
has body: My problem same as Limit number of users accessing a web ASP .NET application but i m looking a solution in java6 tomcat7 and struts 2 Requirement: only N user can login at a time. same user can not login from another system / browser. if N+1 user try to login then display message and reject. How to handle if user will not log out properly (close the browser / session timeout / network issue / etc..) i m thinking use a static map and makes an entry for login and logout. Could you please provide any suggestion/idea ? Thanks -Jiggi

http://stackoverflow.com/a/77382467
score: 0
answers question: http://stackoverflow.com/q/25600298
has body: If you add the archetypeGroupId property, your invocation will succeed without the error. mkdir loms echo hi &gt;loms/README.md mvn archetype:generate \ -DarchetypeGroupId=org.apache.maven.archetypes \ -DarchetypeArtifactId=maven-archetype-webapp \ -DgroupId=org.reaver.devs -DartifactId=loms \ -DinteractiveMode=false tree loms Result: loms ├── pom.xml ├── README.md └── src └── main └── webapp ├── index.jsp └── WEB-INF └── web.xml
type: Answer

jar
tags question: http://stackoverflow.com/q/25647845
tags question: http://stackoverflow.com/q/25682020
tags question: http://stackoverflow.com/q/25661420
tag name: jar
tags question: http://stackoverflow.com/q/25624065
tags question: http://stackoverflow.com/q/25602172
tags question: http://stackoverflow.com/q/25710421
tags question: http://stackoverflow.com/q/25578876
tags question: http://stackoverflow.com/q/25635887
tags question: http://stackoverflow.com/q/25642814
tags question: http://stackoverflow.com/q/25635636
tags question: http://stackoverflow.com/q/25565512
tags question: http://stackoverflow.com/q/25683000
tags question: http://stackoverflow.com/q/25607834
tags question: http://stackoverflow.com/q/25711304
tags question: http://stackoverflow.com/q/25671262
tags question: http://stackoverflow.com/q/25632112
tags question: http://stackoverflow.com/q/25630707
tags question: http://stackoverflow.com/q/25711137
tags question: http://stackoverflow.com/q/25586038
tags question: http://stackoverflow.com/q/25569655
tags question: http://stackoverflow.com/q/25675138
tags question: http://stackoverflow.com/q/25601190
tags question: http://stackoverflow.com/q/25699919
tags question: http://stackoverflow.com/q/25693059
tags question: http://stackoverflow.com/q/25653371
tags question: http://stackoverflow.com/q/25623605
tags question: http://stackoverflow.com/q/25593843
type: Tag
tags question: http://stackoverflow.com/q/25641786
tags question: http://stackoverflow.com/q/25640276
tags question: http://stackoverflow.com/q/25701694
tags question: http://stackoverflow.com/q/25587782
tags question: http://stackoverflow.com/q/25708596
tags question: http://stackoverflow.com/q/25552499
tags question: http://stackoverflow.com/q/25574877
tags question: http://stackoverflow.com/q/25597589
tags question: http://stackoverflow.com/q/25596357
tags question: http://stackoverflow.com/q/25552704
tags question: http://stackoverflow.com/q/25607822
tags question: http://stackoverflow.com/q/25644798
tags question: http://stackoverflow.com/q/25596619
tags question: http://stackoverflow.com/q/25575173
tags question: http://stackoverflow.com/q/25708033
tags question: http://stackoverflow.com/q/25663364
tags question: http://stackoverflow.com/q/25595192
tags question: http://stackoverflow.com/q/25554346
tags question: http://stackoverflow.com/q/25667759
tags question: http://stackoverflow.com/q/25663882
tags question: http://stackoverflow.com/q/25665867

http://stackoverflow.com/a/25708171
answers question: http://stackoverflow.com/q/25708024
type: Answer
has body: There is a problem with your pattern. Try this: Pattern.compile("goto\\(&amp;#39;(\\w+)&amp;#39;\\)", Pattern.MULTILINE|Pattern.DOTALL); Also in printing the result, you can try : System.out.println(m.group(1) + " ( from " + str.substring(m.toMatchResult().start(), m.toMatchResult().end()) + " )"); the output is like this: billpay (from goto(&amp;#39;billpay&amp;#39;);) findmyinfo (from goto(&amp;#39;findmyinfo&amp;#39;);)
score: 0

http://stackoverflow.com/comment/40121974
score: 0
comment on: http://stackoverflow.com/q/25673433
has text: My previous comment still stands. Application, servlet, any backend process.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25685516
tagged with: http://stackoverflow.com/tag/csv
has title: Java :Exporting output into files and storing in a Auto generated Folder
has answer: http://stackoverflow.com/a/25685990
tagged with: export-to-csv
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: java
has body: I have an output in CSV format :PSD_CSV , i wish to export this generated output into a file with separated by semicolon instead of comma also i wish to generate a folder with the name of "Study_UID" of each particular study which consists of the file PSD_CSV I would like to obtain this result in java ,any hints are greatly appreciated .
tagged with: directory
type: Question
has answer: http://stackoverflow.com/a/25686161

http://stackoverflow.com/q/25583078
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25583275
type: UnansweredQuestion
score: -3
tagged with: regex
answer count: 4
has answer: http://stackoverflow.com/a/25583377
has answer: http://stackoverflow.com/a/25583299
has comment: http://stackoverflow.com/comment/39957882
has comment: http://stackoverflow.com/comment/39968352
has answer: http://stackoverflow.com/a/25583151
downvote count: 4
has title: Java regular expression extract data
tagged with: java
upvote count: 1
has body: I have the following String: String s = "ddddddddddd@Type={aaaa}ddddddddddddddddd@Type={dddddddddd}" How would I use Java regular expressions to extract it to: Type=aaaa Type=dddddddddd

http://stackoverflow.com/comment/40046555
comment on: http://stackoverflow.com/q/25630990
score: 0
has text: I disagree with those voting to close this as "too broad". It's a question about a design pattern (or anti-pattern) with a well-known answer that @Kayaman has given a good answer to. I could see an argument, perhaps, that it might belong on programmers rather than here.
type: Comment
type: QuestionComment

eclipse
tags question: http://stackoverflow.com/q/25673755
tags question: http://stackoverflow.com/q/25681072
tags question: http://stackoverflow.com/q/25598254
tags question: http://stackoverflow.com/q/25558839
tags question: http://stackoverflow.com/q/25624490
tags question: http://stackoverflow.com/q/25672157
tags question: http://stackoverflow.com/q/25555172
tags question: http://stackoverflow.com/q/25652892
tags question: http://stackoverflow.com/q/25581314
tags question: http://stackoverflow.com/q/25595703
tag name: eclipse
tags question: http://stackoverflow.com/q/25612424
tags question: http://stackoverflow.com/q/25575659
tags question: http://stackoverflow.com/q/25640364
tags question: http://stackoverflow.com/q/25646779
tags question: http://stackoverflow.com/q/25689509
tags question: http://stackoverflow.com/q/25617201
tags question: http://stackoverflow.com/q/25555671
tags question: http://stackoverflow.com/q/25554868
tags question: http://stackoverflow.com/q/25659330
tags question: http://stackoverflow.com/q/25635636
tags question: http://stackoverflow.com/q/25712499
tags question: http://stackoverflow.com/q/25686563
tags question: http://stackoverflow.com/q/25679614
tags question: http://stackoverflow.com/q/25646290
tags question: http://stackoverflow.com/q/25608493
tags question: http://stackoverflow.com/q/25618315
tags question: http://stackoverflow.com/q/25589963
tags question: http://stackoverflow.com/q/25630361
tags question: http://stackoverflow.com/q/25646802
tags question: http://stackoverflow.com/q/25712474
tags question: http://stackoverflow.com/q/25675672
tags question: http://stackoverflow.com/q/25678150
tags question: http://stackoverflow.com/q/25679639
tags question: http://stackoverflow.com/q/25691455
tags question: http://stackoverflow.com/q/25694602
tags question: http://stackoverflow.com/q/25572149
tags question: http://stackoverflow.com/q/25697478
tags question: http://stackoverflow.com/q/25637064
tags question: http://stackoverflow.com/q/25566643
tags question: http://stackoverflow.com/q/25565596
tags question: http://stackoverflow.com/q/25555837
tags question: http://stackoverflow.com/q/25552890
tags question: http://stackoverflow.com/q/25699441
tags question: http://stackoverflow.com/q/25591762
tags question: http://stackoverflow.com/q/25597424
tags question: http://stackoverflow.com/q/25607822
tags question: http://stackoverflow.com/q/25601522
tags question: http://stackoverflow.com/q/25710543
tags question: http://stackoverflow.com/q/25596619
tags question: http://stackoverflow.com/q/25607632
tags question: http://stackoverflow.com/q/25644062
tags question: http://stackoverflow.com/q/25596514
tags question: http://stackoverflow.com/q/25585955
tags question: http://stackoverflow.com/q/25698759
tags question: http://stackoverflow.com/q/25605898
tags question: http://stackoverflow.com/q/25636822
tags question: http://stackoverflow.com/q/25593905
tags question: http://stackoverflow.com/q/25708873
tags question: http://stackoverflow.com/q/25667402
tags question: http://stackoverflow.com/q/25663364
tags question: http://stackoverflow.com/q/25591365
tags question: http://stackoverflow.com/q/25606052
tags question: http://stackoverflow.com/q/25588969
tags question: http://stackoverflow.com/q/25600689
tags question: http://stackoverflow.com/q/25609538
tags question: http://stackoverflow.com/q/25628921
tags question: http://stackoverflow.com/q/25635278
tags question: http://stackoverflow.com/q/25577900
tags question: http://stackoverflow.com/q/25690222
tags question: http://stackoverflow.com/q/25687274
tags question: http://stackoverflow.com/q/25596179
tags question: http://stackoverflow.com/q/25612117
tags question: http://stackoverflow.com/q/25693059
tags question: http://stackoverflow.com/q/25638500
tags question: http://stackoverflow.com/q/25560612
tags question: http://stackoverflow.com/q/25705800
tags question: http://stackoverflow.com/q/25615228
tags question: http://stackoverflow.com/q/25593688
tags question: http://stackoverflow.com/q/25611528

http://stackoverflow.com/q/25593313
tagged with: arrays
has body: I am writing a recursive method that, instead of carrying out a binary search algorithm, splits an array into three and uses a trinary search algorithm. I am fairly positive that my recursive case is correct, yet there seems to be a problem with my base case. The base case, which is made for if the array contains two or fewer values, is supposed to check non-recursively if the value is in the array and return the index. IF the value is not found, THEN it returns -1. For reasons I can't figure out, this method is returning -1 no matter what. Regardless of the size of the array, or whether or not the array contains the value. Here is the method. public static int trinarySearch(int[] array, int x, int low, int high) { if (high - low &lt; 3) { //BASE CASE. for (int i = low; i &lt; high; i++) { if (array[i] == x) { return i; } } return -1; } else { //RECURSIVE CASE. int firstThird = low + (high - low) / 3; int secondThird = low + 2 * (high - low) / 3; if (x &lt;= array[firstThird]) { return trinarySearch(array, x, low, firstThird - 1); } else if (x &lt;= array[secondThird]) { return trinarySearch(array, x, firstThird + 1, secondThird - 1); } else { // must be (x &gt; array[secondThird]) return trinarySearch(array, x, secondThird + 1, high); } } } In my test code I am simply setting up an array as int[] array = {1, 2, .....} Let's say I search for the int 2, and it is in the array. I set up an array in the test code and call the method as trinarySearch(array, 2, 0, array.length-1). It prints -1 every time. Is there something wrong with the method, or am I simply setting up my test code wrong?
has title: using recursive method for trinary search
tagged with: recursion
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39978464
has answer: http://stackoverflow.com/a/25593394
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25599308
tagged with: java
has comment: http://stackoverflow.com/comment/39976519
has answer: http://stackoverflow.com/a/25594420
favorite count: 0
type: Question
tagged with: algorithm
type: UnansweredQuestion

http://stackoverflow.com/comment/39982286
has text: I process the Audio when the data is uploaded. The graphs will be static, and based on this processed audio data.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25577852
type: Comment

string
tags question: http://stackoverflow.com/q/25580387
tags question: http://stackoverflow.com/q/25614666
tags question: http://stackoverflow.com/q/25580754
tags question: http://stackoverflow.com/q/25595097
type: Tag
tags question: http://stackoverflow.com/q/25598626
tags question: http://stackoverflow.com/q/25555315
tags question: http://stackoverflow.com/q/25582560
tags question: http://stackoverflow.com/q/25598023
tags question: http://stackoverflow.com/q/25560332
tags question: http://stackoverflow.com/q/25634898
tags question: http://stackoverflow.com/q/25625928
tags question: http://stackoverflow.com/q/25597683
tags question: http://stackoverflow.com/q/25681831
tags question: http://stackoverflow.com/q/25609720
tags question: http://stackoverflow.com/q/25579409
tags question: http://stackoverflow.com/q/25696739
tags question: http://stackoverflow.com/q/25657440
tags question: http://stackoverflow.com/q/25696524
tags question: http://stackoverflow.com/q/25672796
tags question: http://stackoverflow.com/q/25669160
tags question: http://stackoverflow.com/q/25580134
tags question: http://stackoverflow.com/q/25671827
tags question: http://stackoverflow.com/q/25668116
tags question: http://stackoverflow.com/q/25608827
tags question: http://stackoverflow.com/q/25602837
tags question: http://stackoverflow.com/q/25641573
tags question: http://stackoverflow.com/q/25675173
tags question: http://stackoverflow.com/q/25670401
tags question: http://stackoverflow.com/q/25683816
tags question: http://stackoverflow.com/q/25575814
tags question: http://stackoverflow.com/q/25569484
tags question: http://stackoverflow.com/q/25691415
tags question: http://stackoverflow.com/q/25669445
tags question: http://stackoverflow.com/q/25680258
tags question: http://stackoverflow.com/q/25567738
tags question: http://stackoverflow.com/q/25636907
tags question: http://stackoverflow.com/q/25601812
tags question: http://stackoverflow.com/q/25656426
tags question: http://stackoverflow.com/q/25699976
tags question: http://stackoverflow.com/q/25584042
tags question: http://stackoverflow.com/q/25661064
tags question: http://stackoverflow.com/q/25634227
tags question: http://stackoverflow.com/q/25649195
tags question: http://stackoverflow.com/q/25583855
tags question: http://stackoverflow.com/q/25609058
tags question: http://stackoverflow.com/q/25592776
tags question: http://stackoverflow.com/q/25564627
tags question: http://stackoverflow.com/q/25680617
tags question: http://stackoverflow.com/q/25659530
tags question: http://stackoverflow.com/q/25696772
tags question: http://stackoverflow.com/q/25684729
tags question: http://stackoverflow.com/q/25622793
tags question: http://stackoverflow.com/q/25564252
tags question: http://stackoverflow.com/q/25622344
tags question: http://stackoverflow.com/q/25705777
tags question: http://stackoverflow.com/q/25594289
tags question: http://stackoverflow.com/q/25611178
tags question: http://stackoverflow.com/q/25608537
tags question: http://stackoverflow.com/q/25703746
tags question: http://stackoverflow.com/q/25557088
tags question: http://stackoverflow.com/q/25565171
tags question: http://stackoverflow.com/q/25702850
tags question: http://stackoverflow.com/q/25710648
tag name: string
tags question: http://stackoverflow.com/q/25629055
tags question: http://stackoverflow.com/q/25558488
tags question: http://stackoverflow.com/q/25690898
tags question: http://stackoverflow.com/q/25676854
tags question: http://stackoverflow.com/q/25591490
tags question: http://stackoverflow.com/q/25554846
tags question: http://stackoverflow.com/q/25566232
tags question: http://stackoverflow.com/q/25697513
tags question: http://stackoverflow.com/q/25663007
tags question: http://stackoverflow.com/q/25679521
tags question: http://stackoverflow.com/q/25607832
tags question: http://stackoverflow.com/q/25656893
tags question: http://stackoverflow.com/q/25617866
tags question: http://stackoverflow.com/q/25578325
tags question: http://stackoverflow.com/q/25615903

http://stackoverflow.com/a/25682770
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25603869
accepted answer of: http://stackoverflow.com/q/25603869
score: 1
type: AcceptedAnswer
has body: Finally found the answer for this. ACLMessage msg= receive(); String[] addressArr = msg.getSender().getAddressesArray(); System.out.println(addressArr[0]); 1st element of the array will have the value of the address of the agent we receiving a message from
downvote count: 0

javafx
tags question: http://stackoverflow.com/q/25649790
tags question: http://stackoverflow.com/q/25604756
tags question: http://stackoverflow.com/q/25663569
tags question: http://stackoverflow.com/q/25599423
tags question: http://stackoverflow.com/q/25656094
tags question: http://stackoverflow.com/q/25639670
type: Tag
tags question: http://stackoverflow.com/q/25698557
tags question: http://stackoverflow.com/q/25646959
tags question: http://stackoverflow.com/q/25705847
tags question: http://stackoverflow.com/q/25612493
tags question: http://stackoverflow.com/q/25652993
tags question: http://stackoverflow.com/q/25614188
tags question: http://stackoverflow.com/q/25648312
tags question: http://stackoverflow.com/q/25599275
tags question: http://stackoverflow.com/q/25561119
tags question: http://stackoverflow.com/q/25701533
tags question: http://stackoverflow.com/q/25570803
tags question: http://stackoverflow.com/q/25697867
tags question: http://stackoverflow.com/q/25663573
tags question: http://stackoverflow.com/q/25678242
tags question: http://stackoverflow.com/q/25603773
tags question: http://stackoverflow.com/q/25650913
tags question: http://stackoverflow.com/q/25704312
tags question: http://stackoverflow.com/q/25689277
tags question: http://stackoverflow.com/q/25586656
tags question: http://stackoverflow.com/q/25589447
tags question: http://stackoverflow.com/q/25602478
tags question: http://stackoverflow.com/q/25622515
tags question: http://stackoverflow.com/q/25658700
tags question: http://stackoverflow.com/q/25711103
tag name: javafx
tags question: http://stackoverflow.com/q/25686624
tags question: http://stackoverflow.com/q/25708949
tags question: http://stackoverflow.com/q/25673115
tags question: http://stackoverflow.com/q/25690790
tags question: http://stackoverflow.com/q/25555717
tags question: http://stackoverflow.com/q/25635377
tags question: http://stackoverflow.com/q/25701087
tags question: http://stackoverflow.com/q/25601388
tags question: http://stackoverflow.com/q/25595677
tags question: http://stackoverflow.com/q/25567398
tags question: http://stackoverflow.com/q/25647509
tags question: http://stackoverflow.com/q/25623893

http://stackoverflow.com/comment/52926915
comment on: http://stackoverflow.com/a/25650321
type: AnswerComment
has text: well, what is "singleton" in the world of generics? `G` and `G` are two different types; it is legit to ask for a singleton per type. Erasure is not an excuse in a DI framework (that's somehow worth $100M:)
score: 1
type: Comment

http://stackoverflow.com/comment/40133267
comment on: http://stackoverflow.com/q/25679618
score: 1
has text: You never initialize `ArSp`. You say `ArSp[0] = "A";` but at that point `ArSp[0]` doesn't exist. Also, if you get errors, at least tell us what they are and/or post your logcat output.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25647834
tagged with: mongodb-query
score: 0
tagged with: mongodb
tagged with: spring-mongodb
type: UnansweredQuestion
answer count: 1
tagged with: spring-data
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25655543
has title: Query an element of an array with exactly matching fields MongoDB in Java
has body: I would like to query a one/more matching fields of an array elements(can include subdocuments too) that is into document. For example: My collection includes documents below: { "_id": 1, "index": 1, "elements":[ { "name":"test", "date":"Mon Sep 01 01:00:00 EEST 2014" , "tag":1 }, { "name": "test2", "date": "Mon Sep 01 01:00:00 EEST 2014", "tag": 2 }, { "name": "test", "date": "Mon Sep 01 02:00:00 EEST 2014", "tag": 3 } ] }, { "_id":2, "index":2, "elements":[ { "name":"test", "date":"Mon Sep 01 01:00:00 EEST 2014" , "tag":1 }, { "name": "test2", "date": "Mon Sep 01 01:00:00 EEST 2014", "tag":2 }, { "name":"test", "date":"Mon Sep 01 01:10:00 EEST 2014", "tag":3 } ] }, { "_id": 3, "index": 3, "elements": [ { "name": "test", "date": "Mon Sep 01 01:00:00 EEST 2014", "tag":1 }, { "name": "test2", "date": "Mon Sep 01 01:00:00 EEST 2014", "tag":2 }, { "name": "test", "date": "Mon Sep 01 01:10:00 EEST 2014", "tag":3 } ] } I want my query result to return me a document like below: { "_id":1, "index": 1, "elements":[ { "name":"test", "date":"Mon Sep 01 02:00:00 EEST 2014" , "tag":3 } ] } To provide this I wrote a query Date dCriteria = new SimpleDateFormat("dd/MM/yy HH:mm:ss").parse("01/09/2014 05:00:00"); Query find = new Query( Criteria.where("index").is(3) ); //To find matching documents find.fields().elemMatch( "elements", Criteria.where("name").is("test").and("date").gte(dCriteria))); mongotemplate.findOne( find, Document.class ); Which means in MongoDB shell command as: db.collection.find( { "index": 3 }, { "elements": { "$elemMatch": { "name": "test", "date": { "$gte": { "$date":"2014-09-01T02:00:000Z" } } } } ) But it return the following result: { "_id": 0, "index": 0, "elements":[ { "name": "test", "date": "Mon Sep 01 01:00:00 EEST 2014", "tag":1 } ] } It is ok to omit _id and index fileds but it returns first macting element of array due to matching criteria , either matching "name":"test" or "date" is greater than equal dCriteria, but what I want is to match both …

http://stackoverflow.com/comment/40098515
type: AnswerComment
comment on: http://stackoverflow.com/a/25660093
has text: its works!!! thanks. could you please let me know what "/" and "/*" really means in springSecurityFilterChain ?
type: Comment
score: 0

http://stackoverflow.com/comment/39948893
score: 0
type: Comment
has text: Nothing is allowed outside of classes. Are you confusing constructors with classes? Now I'm not trying to be rude (but I am blunt), but it sounds like you need to read or re-read some of your text to gain an understanding of this stuff, since it looks like you're doing a bit of guessing. The books won't lead you astray, and the study time won't be wasted. Otherwise, your best bet is to try, to experiment, to see what works and what doesn't. The more code you write, the better you'll become.
type: AnswerComment
comment on: http://stackoverflow.com/a/25577603

http://stackoverflow.com/q/25566943
has answer: http://stackoverflow.com/a/25568052
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39933618
tagged with: list
tagged with: groovy
downvote count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/25605596
tagged with: java
upvote count: 4
possible better answer: http://stackoverflow.com/a/25567250
has answer: http://stackoverflow.com/a/25567250
type: Question
has title: How can I comfortably fill a List with new Objects in Groovy?
has comment: http://stackoverflow.com/comment/39929577
has body: I want to create a List with 10 different objects of a certain class in Groovy. In Java there is Arrays.fill but I'm certain there is a much more elegant way in Groovy. I tried this: def mylist = [new MyClass()]*10; But that gives me the same reference for every Item in the List.
has answer: http://stackoverflow.com/a/25605596
score: 4
favorite count: 0

http://stackoverflow.com/q/25613743
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25613771
tagged with: swing
has body: I have a java swing gui program and when I click a toggle button a timer begins but I want to be able to click the same button and the timer stops and right now it won't let me click on it again. This is in my timer class public void runningClock(){ isPaused = false; while(!isPaused){ incrementTime(); System.out.println("Timer Current Time " + getTime()); time.setText(""+ getTime()); try{Thread.sleep(1000);} catch(Exception e){} } } public void pausedClock(){ isPaused=true; System.out.println("Timer Current Time " + getTime()); time.setText(""+ getTime()); try{Thread.sleep(1000);} catch(Exception e){} } and this is in my main class private void btnRunActionPerformed(java.awt.event.ActionEvent evt) { if(btnRun.getText().equals("Run")){ System.out.println("Run Button Clicked"); btnRun.setText("Pause"); test.runningClock(); } else if(btnRun.getText().equals("Pause")){ System.out.println("Pause Button Clicked"); btnRun.setText("Run"); test.pausedClock(); } }
type: Question
linked to: http://stackoverflow.com/q/25592688
has answer: http://stackoverflow.com/a/25615443
tagged with: java
has comment: http://stackoverflow.com/comment/40014203
has title: Why is my button not clickable? (Java)
tagged with: event-dispatch-thread
score: 0
answer count: 2
tagged with: thread-sleep

http://stackoverflow.com/a/25660967
type: Answer
has body: First time seeing Selenium; and it's yucky. Only 3 valid options for "captureNetworkTraffic" in which an Enum would properly restrict the API yet an unrestricted string is all that is accepted. Still, selenium doesn't do any filtering of the data (besides topically retrieving content) and simply passes it to you for your own (mis)handling. So, what you're wanting is essentially answered here: How to parse JSON in Java
answers question: http://stackoverflow.com/q/25660433
score: 0
accepted answer of: http://stackoverflow.com/q/25660433
type: AcceptedAnswer

http://stackoverflow.com/q/25668117
has answer: http://stackoverflow.com/a/25668588
score: 6
upvote count: 6
answer count: 4
has answer: http://stackoverflow.com/a/25668168
has title: Java initial assignment
type: AnsweredQuestion
has body: In my previous years of development in C++, I know that it was a convention to always initialize your variables with something. I've carried that convention with me to Java, and really any other programming language I use. I use IntelliJ IDEA, and I am completely happy with it, and usually follow its programming guidelines and warnings, however I got this warning: public String getText(By by) { String text = null; // Variable `text` initializer `null` is redundant WebElement ele = findElement(by); highlightIfDemoMode(ele); String tagName = ele.getTagName(); if (tagName.equals("input") || tagName.equals("select")) // For field elements, the text is actually held in values, not the text. text = ele.getAttribute("value"); else text = ele.getText(); return text; } Now obviously, in Java, String text; // is the *exact* same thing as.. String text = null; Considering IntelliJ is very good at following programming conventions, should I neglect that convention of mine to not initialize my variables like this in Java? I feel it's much cleaner, but if Java conventions tell me not to, i won't. Could somebody tell me if it's better practice to initialize, or just infer that it's null
tagged with: java
downvote count: 0
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25668170
has answer: http://stackoverflow.com/a/25668170
tagged with: intellij-idea
possible better answer: http://stackoverflow.com/a/25668168
has answer: http://stackoverflow.com/a/25668270

http://stackoverflow.com/comment/39979679
has text: Is there a PK contraint created for the ID? If there is one, then it is unique, because PKs are implicitely unique (otherwise, they would not be PKs). The answer from Billy Frost seems to indicate that Hibernate should generate a unique constraint for a OneToOne by default. It seems it doesn't. So, add unique = true, and it will, or define the schema by yourself.
comment on: http://stackoverflow.com/a/25595046
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/25668707
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40114002
answer count: 3
has body: This is a modified example from the book, Head First Java. It's a kind of Battleship game where a 3 element array is being used as the battleship. The user has to guess these 3 locations. Currently, I've hard-coded the values of the ship location to 2,3,4. When the user guesses the correct location "Hit" is printed. If not then "Miss" is printed. If a user guesses all 3 locations then "Kill" is printed. But I have a problem. Currently if the user enters the same location multiple times, it still gives a hit. I tried to fix this by changing the value of a variable that has already been hit (int cell) to "-1". But for some reason this didn't fix it too. Please tell me what I am doing wrong. public class Game { public static void main(String[] args) { // TODO Auto-generated method stub int [] location = {2,3,4}; SimpleDotCom firstGame = new SimpleDotCom(); firstGame.setLocation(location); firstGame.checkYourself("2"); firstGame.checkYourself("2"); //firstGame.checkYourself("2"); } } public class SimpleDotCom { int [] loc = null; int numOfHits = 0; void setLocation (int [] cellLocation){ loc = cellLocation; } void checkYourself(String userGuess){ int guess = Integer.parseInt(userGuess); String result = "Miss"; for(int cell:loc){ if (guess == cell){ result = "Hit"; numOfHits++; cell = -1; break; } if (numOfHits==loc.length){ result = "Kill"; } } System.out.print("Result: " + result); System.out.println(" ** Num of Hits: " + numOfHits); } }
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40113565
has comment: http://stackoverflow.com/comment/40113723
type: Question
has answer: http://stackoverflow.com/a/25668890
has answer: http://stackoverflow.com/a/25668912
possible better answer: http://stackoverflow.com/a/25668862
has comment: http://stackoverflow.com/comment/40113441
has comment: http://stackoverflow.com/comment/40113479
downvote count: 0
has answer: http://stackoverflow.com/a/25668862
has title: Some issue with an enhanced for loop-SimpleDotCom
upvote count: 1
accepted answer: http://stackoverflow.com/a/25668890

http://stackoverflow.com/a/25606677
upvote count: 33
score: 33
has body: To return the first element in the list which matches the given predicate: MyObject res = CollectionUtils.find(myList, new Predicate&lt;MyObject&gt;() { @Override public boolean evaluate(MyObject o) { return o.getValue() &gt;= 1 &amp;&amp; o.getValue() &lt;= 5; } }); To filter the list so that it only contains elements matching the predicate: CollectionUtils.filter(myList, new Predicate&lt;MyObject&gt;() { @Override public boolean evaluate(MyObject o) { return o.getValue() &gt;= 1 &amp;&amp; o.getValue() &lt;= 5; } }); You can notice that the Predicate&lt;MyObject&gt; is the same.
has comment: http://stackoverflow.com/comment/40001049
type: Answer
has comment: http://stackoverflow.com/comment/40001094
has comment: http://stackoverflow.com/comment/40002533
has comment: http://stackoverflow.com/comment/40001034
accepted answer of: http://stackoverflow.com/q/25606563
has comment: http://stackoverflow.com/comment/40002474
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40002050
answers question: http://stackoverflow.com/q/25606563
has comment: http://stackoverflow.com/comment/40001783
has comment: http://stackoverflow.com/comment/40001852

http://stackoverflow.com/comment/40190459
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25710612
has text: Fixed - Apparently there was an issue with the name. I rename the file and the jar works... strange. I'll award you though

http://stackoverflow.com/comment/39944819
comment on: http://stackoverflow.com/a/25575362
type: Comment
score: 0
has text: Could you please add some explanation, such as *why* this works, and what the OP did that was wrong?
type: AnswerComment

http://stackoverflow.com/comment/40167095
type: Comment
comment on: http://stackoverflow.com/a/25671457
has text: Oh yeah you were correct. It was the header size (http://www.codeproject.com/Articles/8295/MPEG-Audio-Frame-Header). The code I unplugged checks that it is either EOF or next header after the frame (after the last frame, there is some clutter)? With this I could get out a WAV that sounded a bit better, but still unplayable by other than VLC. I'm unsure if it is the rest of MP2 encoding still faulty or just the WAV encoding that is messed up. Thank you.
type: AnswerComment
score: 0

http://stackoverflow.com/a/25626224
score: 3
has body: The Node object is not what Neo4j stores in the "object cache", so you are not going to gain much insight into the caching of Neo4j by looking at those instances. The implementations of Node that Neo4j gives you are instances of a class called NodeProxy, and are as small as they can possibly be (two fields: internal id and reference to the database). These just serve as your handle of the node for performing operations around that node in the database. The objects stored in the "object cache" are instances of a class called NodeImpl (and despite the name they do not implement the Node interface). The NodeImpl objects have the shape that's outlined on the 15th slide (with page number 9 within the slide) in that presentation. Well, it roughly has that shape, Neo4j has evolved since I made those slides. Neo4j evolving has also changed the number of bytes that node records occupy on disk. Neo4j 2.0 and later have slightly larger node records than what those slides present. If you are interested in looking at the layout of those records, you should look at the NodeRecord class, then start from NodeStore class and "downwards" into its dependencies to find the memory mapping. Besides looking at the wrong object for seeing the difference between different cache approaches in Neo4j your approach of measuring is flawed. Comparing the addresses of objects does not tell you anything about the size of those objects. The JVM makes no guarantees that two objects allocated one after the other (in time) will reside adjacently in memory, and even if the JVM did utilise such an allocation policy, Neo4j might have allocated multiple objects in between the allocations of the two objects you are comparing. Then there is the garbage collector, which might have moved the objects around in between you getting the address of one object and you getting the address of the next object. Thus looking at the addresses of objects in Java is pretty much never useful for anything. For a better approa…
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25612552
downvote count: 0
has comment: http://stackoverflow.com/comment/116846872
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25612552

http://stackoverflow.com/q/25624458
has comment: http://stackoverflow.com/comment/40033411
has body: Is there any way to disable browser back button using Java code? Javascript is not reliable in all browsers.
tagged with: java
has title: Is there any way to disable browser back button using java code
possible better answer: http://stackoverflow.com/a/25625234
has answer: http://stackoverflow.com/a/25625234
type: AnsweredQuestion
answer count: 3
has answer: http://stackoverflow.com/a/25624640
has answer: http://stackoverflow.com/a/25624476
tagged with: javascript
upvote count: 1
score: -7
has comment: http://stackoverflow.com/comment/40033364
has comment: http://stackoverflow.com/comment/40036238
favorite count: 0
type: Question
downvote count: 8
accepted answer: http://stackoverflow.com/a/25624476

http://stackoverflow.com/q/25561741
has comment: http://stackoverflow.com/comment/40883845
tagged with: java
has comment: http://stackoverflow.com/comment/45989764
downvote count: 0
tagged with: websocket
upvote count: 10
favorite count: 0
type: Question
has title: Send Message to all clients via SimpMessagingTemplate in ServletContextListener
has answer: http://stackoverflow.com/a/28862274
has answer: http://stackoverflow.com/a/59628032
possible better answer: http://stackoverflow.com/a/59628032
tagged with: spring-websocket
score: 10
tagged with: spring
has body: I'm using the Spring framework and I have a working websocket controller that looks like this: @Controller public class GreetingController { @MessageMapping("/hello") @SendTo("/topic/greetings") public Greeting greeting(HelloMessage message) throws InterruptedException { return new Greeting("Hello, " + message.getName() + "!"); } } I also have this configuration: @Configuration @EnableWebSocketMessageBroker public class HelloWebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(MessageBrokerRegistry config) { config.enableSimpleBroker("/topic"); config.setApplicationDestinationPrefixes("/app"); } public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/hello").withSockJS(); } } That part works great! I can successfully send and receive messages between two or more browsers using Stomp.js. Here's the part that doesn't work. I have implemented a ServletContextListener that contains a custom object that, for simplicity sake, I have called 'notifier'. The notifier listens for certain events to happen on the server-side. It then calls the 'notify' method, which is supposed to send details about the event to all clients. It doesn't work, though. @WebListener public class MessageListener implements ServletContextListener, Notifiable { private Notifier notifier; @Autowired private SimpMessagingTemplate messageSender; public MessageListener() { notifier = new Notifier(this); } public void contextInitialized(ServletContextEvent contextEvent) { WebApplicationContextUtils .getRequiredWebApplicationContext(contextEvent.getServletContext()) .getAutowireCapableBeanFactory() .autowireBean(this); notifier.start(); } public void contextDestroyed(ServletContextEvent contextEvent) { notifier.stop(); } public void notify(NotifyEvent event) { messageSender.convertAndSend("/topic/greetings", new Greeting("Hello, " + event.subject + "!")); } } I do not get an exception. The SimpMessagingTemplate ha…
tagged with: spring-mvc
accepted answer: http://stackoverflow.com/a/28862274
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/38919790
answer count: 2

http://stackoverflow.com/comment/40184849
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25707576
has text: possible duplicate of [Java operator precedence guidelines](http://stackoverflow.com/questions/2137690/java-operator-precedence-guidelines)
type: Comment

http://stackoverflow.com/comment/39966170
comment on: http://stackoverflow.com/a/25587720
score: 0
type: AnswerComment
has text: But when I press enter after submitting some text, the program does not end. The cursor simply moves down a line and waits for me to infinity type more text.
type: Comment

http://stackoverflow.com/q/25593454
favorite count: 0
tagged with: android-ndk
type: Question
has answer: http://stackoverflow.com/a/25601229
answer count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/63555829
tagged with: http://stackoverflow.com/tag/c
has title: c JNI call java function
downvote count: 0
upvote count: 1
score: 1
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25600781
has body: My first function code in c jni is void fun1() { jmethodID java_fun = (*global_env)-&gt;GetMethodID(global_env,cls_Env, "test1", "()V"); (*global_env)-&gt;CallVoidMethod(global_env,(*global_obj), java_fun); } And my second is void fun2(int x) { jmethodID java_fun = (*global_env)-&gt;GetMethodID(global_env,cls_Env, "test2", "([I)V"); (*global_env)-&gt;CallVoidMethod(global_env,(*global_obj), java_fun,(int)x); } In my java side the code for first c function is private void test1() { System.out.printf("test1"); callfunction(); } void callfunction() { System.out.printf("how i can get here??"); } The first question is how can i get to callfunction() from C call? Now the second java code for second c function is public int var1; private void test2(int x) { System.out.printf("test2"); var1=x; } The second question is how can i save my data from c side in java side? Thanks

http://stackoverflow.com/q/25611099
has title: What is "syntactically parallel elements" in Java?
has comment: http://stackoverflow.com/comment/40009329
favorite count: 0
type: Question
upvote count: 5
score: 4
has body: There is a rule "4.5.2 Indent continuation lines at least +4 spaces" in the Google Java Style Guide which says: In general, two continuation lines use the same indentation level if and only if they begin with syntactically parallel elements. Could someone explain what does "syntactically parallel elements" mean and provide some examples for this case?
has comment: http://stackoverflow.com/comment/40008933
has comment: http://stackoverflow.com/comment/40008979
tagged with: checkstyle
type: AnsweredQuestion
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25639920
possible better answer: http://stackoverflow.com/a/25639920
has answer: http://stackoverflow.com/a/25626943
accepted answer: http://stackoverflow.com/a/25626943
downvote count: 1

http://stackoverflow.com/comment/40099377
type: Comment
score: 1
type: QuestionComment
has text: i would say try reverse engineer it.. Serializer serializer = new Persister(); File result = new File("e:\\example.xml"); serializer.write(groupList, result); You will see what is going wrong with your element to xml mapping(i tried it already). Make sure you create two or three elements in your list. CHEERS !!
comment on: http://stackoverflow.com/q/25660361

http://stackoverflow.com/q/25602141
has answer: http://stackoverflow.com/a/25710399
has body: I am new to openIMAJ and I want to process some pictures using it. There are a lot of tutorial available but they all tell using Maven. Does anyone know from where I can download the jar files of openIMAJ to directly use in my Java project? Thanks!
accepted answer: http://stackoverflow.com/a/25710399
type: AnsweredQuestion
score: 0
tagged with: openimaj
answer count: 3
linked to: http://stackoverflow.com/q/31553141
tagged with: java
type: Question
has title: OpenIMAJ Jar Files
has answer: http://stackoverflow.com/a/25951950
possible better answer: http://stackoverflow.com/a/25951950
has answer: http://stackoverflow.com/a/25651415

http://stackoverflow.com/a/25606254
answers question: http://stackoverflow.com/q/25605981
type: Answer
score: 2
has body: you have to try and catch FileNotFoundException and see the code below. public FileReader(String fileName) throws FileNotFoundException { super(new FileInputStream(fileName)); } you can modify it like following try { CSVReader reader = new CSVReader(new FileReader(csvPath)); } catch (FileNotFoundException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/40000167
upvote count: 2
has comment: http://stackoverflow.com/comment/40000235
downvote count: 0

http://stackoverflow.com/comment/39953692
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25580593
has text: What's the problem? **Be specific**. What do you expect to happen? What actually happens?
type: Comment

http://stackoverflow.com/q/25581363
tagged with: spring
has title: CXF Timeout not working
type: AnsweredQuestion
tagged with: cxf
tagged with: java
downvote count: 0
answer count: 1
score: 1
has body: I created a web service client using cxf configured through Spring as shown below: &lt;!-- HTTP Conduit --&gt; &lt;http-conf:conduit name="*.http-conduit"&gt; &lt;http-conf:client ConnectionTimeout="30000" ReceiveTimeout="30000" /&gt; &lt;/http-conf:conduit&gt; &lt;!-- Client Proxies --&gt; &lt;jaxws:client name="wsClient" serviceName="..." serviceClass="..." address="..." wsdlLocation="..."&gt; &lt;/jaxws:client&gt; Now when the service is up, everything's working OK, But the problem is, when the service is down timeout values in the HTTPConduit are being ignored and I get the following error after 1 second: org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:570) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:479) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:136) Caused by: java.net.ConnectException: Tried all: '1' addresses, but could not connect over HTTP to server: '192.168.80.55', port: '24004' at weblogic.net.http.HttpClient.openServer(HttpClient.java:333) at weblogic.net.http.HttpClient.openServer(HttpClient.java:425) at weblogic.net.http.HttpClient.New(HttpClient.java:252) at weblogic.net.http.HttpURLConnection.connect(HttpURLConnection.java:213) at weblogic.net.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:279) at org.apache.cxf.transport.http.HTTPCon2014-08-30 13:06:59 ERROR: javax.xml.ws.WebServiceException: Could not send Message. Any clue why the consumer doesn't stay for the timeout duration before raising this…
upvote count: 1
tagged with: web-services
favorite count: 0
type: Question
tagged with: weblogic
accepted answer: http://stackoverflow.com/a/25584414
has answer: http://stackoverflow.com/a/25584414

http://stackoverflow.com/q/25658904
tagged with: guice
has answer: http://stackoverflow.com/a/25661663
tagged with: guice-3
score: 2
type: AnsweredQuestion
has body: Here is how my StatusMapper interface looks like: public interface StatusMapper&lt;T extends Throwable&gt; { Status map(final T exception); } And here is my MapBinder: TypeLiteral&lt;Class&lt;? extends Throwable&gt;&gt; exceptionType = new TypeLiteral&lt;Class&lt;? extends Throwable&gt;&gt;() { }; TypeLiteral&lt;StatusMapper&lt;? extends Throwable&gt;&gt; mapperType = new TypeLiteral&lt;StatusMapper&lt;? extends Throwable&gt;&gt;() { }; MapBinder&lt;Class&lt;? extends Throwable&gt;, StatusMapper&lt;? extends Throwable&gt;&gt; exceptionBinder = MapBinder.newMapBinder(binder(), exceptionType, mapperType); exceptionBinder.addBinding(IOException.class).to(IOExceptionMapper.class); exceptionBinder.addBinding(SQLException.class).to(SQLExceptionMapper.class); ... This is how one of these ExceptionMappers looks like: (simplified) public class IOExceptionMapper implements StatusMapper&lt;IOException&gt; { @SuppressWarnings("unused") private static final Logger logger = LoggerFactory.getLogger(IOExceptionMapper.class); @Override public Status map(final IOException exception) { return new Status(100); } } This works fine so far but I have to take care that IOException binds to IOExceptionMapper. If I bind exceptionBinder.addBinding(IOException.class).to(SQLExceptionMapper.class); the typechecker (compiler) does not complain but it breaks the whole app - any hints? [Update] According to The111's answer I created ExceptionBinder public class ExceptionBinder { private final MapBinder&lt;Class&lt;? extends Throwable&gt;, StatusMapper&lt;? extends Throwable&gt;&gt; exceptionBinder; public ExceptionBinder(final Binder binder) { final TypeLiteral&lt;Class&lt;? extends Throwable&gt;&gt; exceptionType; final TypeLiteral&lt;StatusMapper&lt;? extends Throwable&gt;&gt; mapperType; exceptionType = new TypeLiteral&lt;Class&lt;? extends Throwable&gt;&gt;() {}; mapperType = new TypeLiteral&lt;StatusMapper&lt;? extends Throwable&gt;&gt;() {}; exceptionBinder = MapBinder.newMapBinder(binder, ex…
tagged with: java
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/416540
favorite count: 0
type: Question
has title: How to make Guice MapBinder really typesafe?
accepted answer: http://stackoverflow.com/a/25661663
upvote count: 2

http://stackoverflow.com/a/25651315
has comment: http://stackoverflow.com/comment/40082225
has comment: http://stackoverflow.com/comment/41203011
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: An example Matrix class with n x m constructor: public class Matrix extends ArrayList&lt;ArrayList&lt;Boolean&gt;&gt; { private static final long serialVersionUID = 1L; public Matrix(int rowNum, int colNum) { super(rowNum); for (int row=0; row&lt;rowNum; row++) { ArrayList&lt;Boolean&gt; rowList = new ArrayList&lt;Boolean&gt;(colNum); add(rowList); for (int col=0; col&lt;colNum; col++) { rowList.add(false); } } } public void set(int row, int col, Boolean value) { get(row).set(col, value); } public Boolean get(int row, int col) { return get(row).get(col); } }
answers question: http://stackoverflow.com/q/25650870

http://stackoverflow.com/comment/39925857
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25564349
has text: Hi @JoopEggen Eggen. I wind up the same. The only difference is that I'll be using a [FileChooser](http://docs.oracle.com/javafx/2/api/javafx/stage/FileChooser.html), but still the same problem. I don't really mind what I'll be using, FileChooser or the swing JFileChooser, I just want to `documentName.setText(file.getName());` from the controller with the FileChooser being retrieved from another class.
score: 0

http://stackoverflow.com/a/25600162
has comment: http://stackoverflow.com/comment/39989697
score: 0
answers question: http://stackoverflow.com/q/25599991
type: Answer
has body: Variables are stored in memory, that is, they have some value and that value is stored at some memory address. Note that : that value CAN be later changed by us. Now let us see methods,each method also is stored somewhere. When we invoke that the method, its address is resolved and then the instruction stored at that address is executed. BUT, as we change the value of the variable, note that the value of the address at which the method is stored cannot be altered by us. It is internally handled. Hence, there is no such thing as INITIALIZATION of methods.
has comment: http://stackoverflow.com/comment/39989153
has comment: http://stackoverflow.com/comment/39989375
has comment: http://stackoverflow.com/comment/39989565

http://stackoverflow.com/comment/39949581
comment on: http://stackoverflow.com/q/25578334
type: Comment
has text: I assume that the images are from Deitel's How to Program Java, 9th edition. If so, what chapter? And where are the images relative to your class files?
score: 0
type: QuestionComment

http://stackoverflow.com/a/25646576
type: Answer
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25644778
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25644778
has body: This happens because Swing isn't thread-safe? No, this happens because you are adding components to an already displayed container, causing the components hierarchy be invalidated. See Container#add(Component comp) docs. I don't know if I to need use revalidate(), repaint() or something else to refresh JPanel. Yes, as per previous point. The tipical sequence in this case is: panel.add(someComponent); panel.revalidate(); panel.repaint(); Is there another way to accomplish this? Yes, it is. As I've stated in my comment, IMHO CardLayout is the proper way to go through. See How to Use CardLayout tutorial. In a nutshell: Keep your panel with radio buttons. Have two different panels: one for films and another one for TV series. Have another JPanel with CardLayout. Add these two panels (or many as needed) as cards. On radio buttons change just switch the right "card" for the card layout panel.

http://stackoverflow.com/comment/39950968
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/25579247
has text: it is because you create a `new` int that makes it another object. a would retain its value and b will have a `new int`
type: Comment

http://stackoverflow.com/q/25560324
downvote count: 1
has body: Problem statement I have another thread on this, but I can't seem to locate it. Basically, I have a Black Jack game. The user is given two random cards (then those cards are added together, and display the total). Then it prompts user if they want another card (They pretty much will want to have a total lower than 21). If they choose "yes," they are given a random card number (they can keep getting a card, but should avoid going over 21), but if they choose "no," the game stops. Here's the output I should get: [blackjackoutput.jpg] And here's what I'm getting: [output1.jpg] Source code: public class BlackJackGame { public static void main(String[] args) { int randomnum1 = (int) (1 + Math.random() * 10); int randomnum2 = (int) (1 + Math.random() * 10); int total; char anotherCard = 'y'; char playAgain; Scanner input = new Scanner(System.in); // Prints cards player starts off with System.out.println("First cards: " + randomnum1 + ", " + randomnum2); // Sum of the 2 cards total = randomnum1 + randomnum2; // Prints Total System.out.println("Total: " + total); // Do While Loop that asks question to get lower than 21 or terminate. while (anotherCard != 'n') { if (total &lt;= 21) { System.out.print("Do you want another card? (y/n): "); anotherCard = input.next().charAt(0); int randomnum3 = (int) (1 + Math.random() * 10); System.out.println("Card: " + randomnum3); total += randomnum3; System.out.println("Total: " + total); } else if (total &gt; 21) { System.out.println("BUST."); System.out.print("Would you like to play again? (y/n): "); playAgain = input.next().charAt(0); } } } } Issue When I reach to 21, I choose "no," to stop the program. But, it continues to display the next card and the updated total. When I "BUST." (Or go over 21). It'll ask me if I want to play. And on separate occasions, I choose "y" and it says "Bust." and asks me if I want to play again (it loops, says "BUST.", and asks me the same question, without being able to end the program). Same thing if I c…
favorite count: 0
has answer: http://stackoverflow.com/a/25560364
has comment: http://stackoverflow.com/comment/39915158
tagged with: java
has comment: http://stackoverflow.com/comment/39915179
score: -1
linked to: http://stackoverflow.com/q/25554213
type: Question
tagged with: blackjack
has title: Black Jack Game in Java
upvote count: 0
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39915776

http://stackoverflow.com/comment/52468430
type: AnswerComment
has text: Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.
comment on: http://stackoverflow.com/a/32295738
score: 1
type: Comment

public-key-encryption
tags question: http://stackoverflow.com/q/25622894
type: Tag
tag name: public-key-encryption

http://stackoverflow.com/q/25695219
answer count: 0
tagged with: canvas
has comment: http://stackoverflow.com/comment/40163717
type: UnansweredQuestion
tagged with: swing
tagged with: doublebuffered
has body: Okay so for a project I'm creating I've decided to create a JFrame and have a menu which when options are clicked will open up a canvas in the center of the JFrame. Since the rendering is all been done on a canvas I have double buffered it. Now when I first press the button and the canvas opens up it works perfectly no problems and the screen is double buffered however when I go back to the menu and reopen the canvas I get an error. A thread is created as soon as the application is created so that's why I have used the if statement as I was getting an error when the buffer was attempting to be created with 0 height and 0 width since the canvas hadn't been added to the JFrame yet. Here's the code to create the buffer: public BufferStrategy createBuffer(){ if(this.getWidth() &gt; 0 &amp;&amp; this.getHeight() &gt; 0){ image = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(2); return bs; } }else{ return bs; } return bs; This is the code in the run() method for which I use that buffer: if (shouldRender) { Graphics g = null; BufferStrategy bs = createBuffers(); if(bs != null){ g = bs.getDrawGraphics(); render(g, bs); frames++; } } In the render() method I then call g.dispose() and bs.show(). This is the error I am getting when I reopen the canvas: Exception in thread "Thread-2" java.lang.IllegalStateException: Buffers have not been created at sun.awt.windows.WComponentPeer.getBackBuffer(Unknown Source) at java.awt.Component$FlipBufferStrategy.getBackBuffer(Unknown Source) at java.awt.Component$FlipBufferStrategy.flip(Unknown Source) at java.awt.Component$FlipBufferStrategy.show(Unknown Source) at Launcher.render(Launcher.java:106) at Launcher.run(Launcher.java:78) at java.lang.Thread.run(Unknown Source) I have tried creating a BufferStrategy of (1) and it returned no errors but whenever I use 2 or more I get an error. I also tried checking the BufferCapabilities and when I ran the g…
has comment: http://stackoverflow.com/comment/40166504
tagged with: java
has title: Buffers not creating when canvas reopened
type: Question
has comment: http://stackoverflow.com/comment/40172878
score: 0

http://stackoverflow.com/comment/40076970
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25648180
has text: @DavidConrad it's not there, but it should replace `if(dome%3==0)`
score: 0

http://stackoverflow.com/q/25705441
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40180767
has answer: http://stackoverflow.com/a/25705482
tagged with: operators
has title: returning the first digit of an integer in an array
answer count: 4
has body: I have a method and I am interested in knowing how it actually works. I have searched the internet, but to no avail. This method when used returns the first digit of an entered integer in to an array. What puzzles me is the divide AND operator. I know that the operator divides an operand on the left with the operator on the right and applies the answer to the left side. Here is the method: public static int firstDigit(int index) { while (index &gt; 9) index /= 10; return (index); } In my program when an integer is entered, say 100 it reads out the number 1, as its the first number of the entered integer. shouldn't this answer be 10, because index = 100 /= 10 = 10? Sorry if im doing it wrong, i'm new here and at programming, i did a considerable amount of research before i asked this question.
tagged with: arrays
has comment: http://stackoverflow.com/comment/40180793
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25705474
has answer: http://stackoverflow.com/a/25705463
type: Question
has answer: http://stackoverflow.com/a/25705458

http://stackoverflow.com/a/76254468
accepted answer of: http://stackoverflow.com/q/25649326
score: 2
has comment: http://stackoverflow.com/comment/134484639
answers question: http://stackoverflow.com/q/25649326
has body: As an addition to ukchaudhary's answer: So I assume its not possible to call an Oracle function using StoredProcedureQuery? Yes, exactly. Oracle has both stored procedures and functions. StoredProcedureQuery can be used to call stored procedures, but it cannot call stored functions, at least not on Oracle (hence the name). To call a function, JPA offers the FUNCTION keyword in JPA. This allows invoking a function from inside a JPQL query. For example, a function "hasGoodCredit" is called like this: SELECT c FROM Customer c WHERE FUNCTION(‘hasGoodCredit’, c.balance, c.creditLimit) See JPA specification, Invocation of Predefined and User-defined Database Functions. However, FUNCTION only works inside a regular JPQL statement (SELECT, UPDATE, DELETE etc.), so it cannot be used for Oracle functions which perform data manipulation (DML), as these can only be invoked separately. Therefore, such functions cannot be invoked via JPA. You will have to use JDBC or a native query.
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40042763
type: Comment
has text: Would you happen to have an example of how to do this via ajax?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25572714

http://stackoverflow.com/comment/40086743
comment on: http://stackoverflow.com/q/25653672
score: 1
type: Comment
has text: Are you sure the Strings you're passing parse through the grammar specced at http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#BigDecimal(java.lang.String) ?
type: QuestionComment

http://stackoverflow.com/q/25679372
downvote count: 0
has answer: http://stackoverflow.com/a/25679516
has answer: http://stackoverflow.com/a/25680352
upvote count: 1
has comment: http://stackoverflow.com/comment/40133077
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40132832
has comment: http://stackoverflow.com/comment/40132698
has body: I am trying to retrieve records from oracle database for the SQL query - SELECT data FROM test where id = ?; Here is my code to retrieve the data - public static String retrieveData(String id) throws IOException { String result = ""; Connection connection = null; PreparedStatement ps = null; ResultSet rs = null; try { String sql = "SELECT data FROM test where id = ?"; connection = getDBConnection(); //this method gets the db connection ps = connection.prepareStatement(sql); ps.setString(1, id); rs = ps.executeQuery(); while(rs.next()) { result = result + rs.getString("data"); } } catch (SQLException e) { e.printStackTrace(); } finally { closeDBConnection(); //closes db connection } return result; } When I invoke the retrieveData in the main method, it returns null. When I debug, the resultSet is empty. I am guessing the reason is I am passing my id as String, but perhaps Oracle doesn't understand something like - SELECT data FROM test where id = "1234567890"; Can someone please guide me how do I fix this? I have tried way too many things, but I can't seem to fetch the data from the db for this id. I also tried converting the id to long using Long.valueOf(String s).longValue(); and setting this as the placeholder in ps.setLong, but it didn't help. Please advise.
accepted answer: http://stackoverflow.com/a/25679833
has comment: http://stackoverflow.com/comment/40132693
has comment: http://stackoverflow.com/comment/40132631
has answer: http://stackoverflow.com/a/25680069
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40132656
has comment: http://stackoverflow.com/comment/40132848
has title: Prepared statement not returning results for string numbers
has comment: http://stackoverflow.com/comment/40132977
tagged with: jdbc
has answer: http://stackoverflow.com/a/25679833
answer count: 4
possible better answer: http://stackoverflow.com/a/25679516
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40132734
has comment: http://stackoverflow.com/comment/40132708

http://stackoverflow.com/comment/39900435
comment on: http://stackoverflow.com/a/25552638
score: 0
has text: +1 for correctness. But I'd also recommend not writing code like this.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25604081
has body: I know that spring data rest will export your repositories as REST services..but i want to know advantages of that over use of spring data jpa.
type: Question
has answer: http://stackoverflow.com/a/25611151
upvote count: 1
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25610213
tagged with: spring-data-jpa
answer count: 2
tagged with: spring-data-rest
has answer: http://stackoverflow.com/a/25610213
score: 1
tagged with: java
downvote count: 0
tagged with: spring-data
possible better answer: http://stackoverflow.com/a/25611151
has title: What are the advantages of using Spring Data REST over Spring Data JPA?
favorite count: 0

http://stackoverflow.com/comment/39930317
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25567738
type: Comment
has text: So does the compiler know all can happen in getConst()? How can it decide to inline when some other things can happen? Does it inspect the method to see that only switch statement acts? What if I put a paramter which value is not available at compile time? I think using a parameter set elsewhere is good. Isn't? Or will the compiler bother itself going to discover where I set it?

http://stackoverflow.com/comment/39913102
has text: You really need to start by learning basics. Even a simple game engine is a complex piece of software, and you don't have the expertise yet. Start with simpler projects and work your way up.
comment on: http://stackoverflow.com/q/25559190
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/a/28804728
type: Answer
answers question: http://stackoverflow.com/q/25657946
score: 0
has body: In windows javac appears to be in .exe format which implies that it is platform dependent. Every platform has different java compiler.

http://stackoverflow.com/a/25668969
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/40114116
answers question: http://stackoverflow.com/q/25668920
has body: This line System.out.println("The value of ch is : " + ch); Will print out The value of ch is : //And the hash code of your array, which is just an object in Java If you want meaningful data, use the Arrays.toString() overloaded method... System.out.println("The value of ch is : " + Arrays.toString(ch)); Take a look at the Javadocs for the Array.toString() method to see when it may be useful in your case.
has comment: http://stackoverflow.com/comment/40114145

http://stackoverflow.com/comment/39950762
has text: Thanks Zahorak for the reply. But my question was more around replicated cache instead of distributed cache. I think replicated caches wont scale much as compared to distributed cache. So better is to use either LB sticky session or distributed cache as you pointed out.
comment on: http://stackoverflow.com/a/25577451
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25556532
downvote count: 0
has comment: http://stackoverflow.com/comment/39909792
answers question: http://stackoverflow.com/q/25556425
has comment: http://stackoverflow.com/comment/40041401
score: 3
has comment: http://stackoverflow.com/comment/39934636
accepted answer of: http://stackoverflow.com/q/25556425
type: Answer
has comment: http://stackoverflow.com/comment/39909264
has body: Go to Window > Preferences > Java > Code Style > Formatter > Edit > Braces > Array initializers and set it to Same line.
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/25582730
type: Question
has answer: http://stackoverflow.com/a/25906048
has body: I got the following List&lt;ColumnFamilyDefinition&gt; data from Cassandra ThriftCfDef[ keyspace=sample_data, name=application_data, columnType=STANDARD, comparatorType=me.prettyprint.hector.api.ddl.ComparatorType@757e1d2f, subComparatorType=&lt;null&gt;, comparatorTypeAlias=, subComparatorTypeAlias=, comment=, rowCacheSize=0.0, rowCacheSavePeriodInSeconds=0, keyCacheSize=0.0, readRepairChance=0.1, columnMetadata=[ ThriftColumnDef[ name=java.nio.HeapByteBuffer[ pos=3208lim=3216cap=14616 ], validationClass=org.apache.cassandra.db.marshal.UTF8Type, indexType=&lt;null&gt;, indexName=&lt;null&gt; ], ThriftColumnDef[ name=java.nio.HeapByteBuffer[ pos=3271lim=3280cap=14616 ], validationClass=org.apache.cassandra.db.marshal.UTF8Type, indexType=&lt;null&gt;, indexName=&lt;null&gt; ] ], gcGraceSeconds=864000, keyValidationClass=org.apache.cassandra.db.marshal.UTF8Type, keyValidationAlias=, defaultValidationClass=org.apache.cassandra.db.marshal.BytesType, id=3656, maxCompactionThreshold=32, minCompactionThreshold=4, memtableOperationsInMillions=0.0, memtableThroughputInMb=0, memtableFlushAfterMins=0, keyCacheSavePeriodInSeconds=0, replicateOnWrite=true, compactionStrategy=org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy, compactionStrategyOptions={ }, compressionOptions={ sstable_compression=org.apache.cassandra.io.compress.SnappyCompressor }, mergeShardsChance=0.0, rowCacheProvider=&lt;null&gt;, keyAlias=&lt;null&gt;, rowCacheKeysToSave=0 ] I am getting the below error because of ThriftColumnDef HttpMessageNotWritableException : Could not write JSON: (was java.nio.BufferUnderflowException) (through reference chain: java.util.HashMap["sample_data"]-&gt;java.util.UnmodifiableRandomAccessList[2]-&gt;me.prettyprint.cassandra.service.ThriftCfDef["columnMetadata"]-&gt;java.util.ArrayList[0]-&gt;me.prettyprint.cassandra.service.ThriftColumnDef["name"]-&gt;java.nio.HeapByteBuffer["long"]); nested exception is org.codehaus.jackson.map.JsonMappingException: (was java.ni…
answer count: 1
tagged with: jackson
tagged with: spring
accepted answer: http://stackoverflow.com/a/25906048
type: AnsweredQuestion
tagged with: cassandra
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: HttpMessageNotWritableException because of org.codehaus.jackson.map.JsonMappingException while converting java.util.UnmodifiableRandomAccessList

http://stackoverflow.com/q/25602172
has comment: http://stackoverflow.com/comment/39993376
has body: I have an application that whenever I load in any image or update the JTextArea it always places the new object / text in the top left of the frame instead of simply updating whatever object it is supposed to be updating.. I am completely dumbfounded to why it is updating the screen in this way, does anyone have any hints or tips as to how to change this? Below is the code for adding a jLabel into a jTabbedFrame JLabel tempJLabel = new javax.swing.JLabel(); //tempJLabel.setLocation(1200,1200); BufferedImage img = scaleImage(getStoredProductImage(photoDir[i]), 190); //scale down found image to whatever is needed String filename = photoDir[i].getName(); Image tempImage = new Image(img,photoDir[i].getName(),photoDir[i],figureSaveDir(gtinTextBox.getText(), uidTextBox.getText()),tFrame,tempJLabel); //create ImageObj for later use if(filename.length()&gt;20){ tFrame.addTab(photoDir[i].getName().substring(15,19), tempJLabel); tempJLabel.setIcon(new ImageIcon(tempImage.getImg())); } Unsure if I should also append information of the GUI construction...
has comment: http://stackoverflow.com/comment/40010892
type: Question
tagged with: jlabel
tagged with: graphical-programming
type: UnansweredQuestion
tagged with: jtextpane
answer count: 1
tagged with: jar
has title: Graphical anomalies when imports images and updating jLabels / jTextArea
score: 0
has comment: http://stackoverflow.com/comment/39995983
has comment: http://stackoverflow.com/comment/40000081
tagged with: java
has answer: http://stackoverflow.com/a/25612383

http://stackoverflow.com/comment/40191881
type: QuestionComment
has text: I am, but I'm trying to figure out a better way, because this seems to happen a lot, and there are tons of syso's throughout the code base.
comment on: http://stackoverflow.com/q/25711648
type: Comment
score: 0

http://stackoverflow.com/comment/40047357
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25631396
has text: Makes much more sense, thank you! My last and final question. The line Elements tdElements = document.select("td"); is grabbing all the td in the table correct? (the real one has multiple tr and td) Could I use this to grab al the tr?

http://stackoverflow.com/a/25703830
has body: String[] tokensVal = str.split(":"); String key = tokensVal[0].trim(); String value = tokensVal[1].trim();
has comment: http://stackoverflow.com/comment/40177786
has comment: http://stackoverflow.com/comment/40177655
downvote count: 1
score: -1
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25703746

http://stackoverflow.com/q/25661449
has answer: http://stackoverflow.com/a/25661971
type: Question
has comment: http://stackoverflow.com/comment/40100769
has comment: http://stackoverflow.com/comment/40102349
type: UnansweredQuestion
has body: I have a similar example like this: http://www.java2s.com/Tutorial/Java/0300__SWT-2D-Graphics/CreatefilledrectanglesusingthefillRectanglemethods.htm All I want to do now is make that red rectangle "punch out" the window, so that I can see what is behind it
has comment: http://stackoverflow.com/comment/40101261
score: 0
has comment: http://stackoverflow.com/comment/40100724
has comment: http://stackoverflow.com/comment/40101168
tagged with: java
has comment: http://stackoverflow.com/comment/40101007
tagged with: swt
answer count: 1
has title: Java, SWT, make the window (shell) transparent in part

http://stackoverflow.com/comment/39906475
type: Comment
score: 0
has text: Write a log wrapper, or use an existing one.
type: QuestionComment
comment on: http://stackoverflow.com/q/25555488

netbeans
tags question: http://stackoverflow.com/q/25595958
tags question: http://stackoverflow.com/q/25567145
tags question: http://stackoverflow.com/q/25684352
tags question: http://stackoverflow.com/q/25626339
tags question: http://stackoverflow.com/q/25583324
tags question: http://stackoverflow.com/q/25649116
tags question: http://stackoverflow.com/q/25700696
tags question: http://stackoverflow.com/q/25671865
tags question: http://stackoverflow.com/q/25690164
tags question: http://stackoverflow.com/q/25702200
tags question: http://stackoverflow.com/q/25569604
tags question: http://stackoverflow.com/q/25664908
tags question: http://stackoverflow.com/q/25585365
tags question: http://stackoverflow.com/q/25612424
tags question: http://stackoverflow.com/q/25691914
tags question: http://stackoverflow.com/q/25704522
tags question: http://stackoverflow.com/q/25703243
tags question: http://stackoverflow.com/q/25577979
tags question: http://stackoverflow.com/q/25683537
tags question: http://stackoverflow.com/q/25708348
tags question: http://stackoverflow.com/q/25710578
tags question: http://stackoverflow.com/q/25609251
tags question: http://stackoverflow.com/q/25689808
tags question: http://stackoverflow.com/q/25555512
tags question: http://stackoverflow.com/q/25644798
tags question: http://stackoverflow.com/q/25639828
tags question: http://stackoverflow.com/q/25666420
tags question: http://stackoverflow.com/q/25674798
tags question: http://stackoverflow.com/q/25606777
tags question: http://stackoverflow.com/q/25611609
tags question: http://stackoverflow.com/q/25586038
tags question: http://stackoverflow.com/q/25555711
tags question: http://stackoverflow.com/q/25612997
tags question: http://stackoverflow.com/q/25689842
tags question: http://stackoverflow.com/q/25648587
tags question: http://stackoverflow.com/q/25572243
type: Tag
tag name: netbeans
tags question: http://stackoverflow.com/q/25703742
tags question: http://stackoverflow.com/q/25646959
tags question: http://stackoverflow.com/q/25619012
tags question: http://stackoverflow.com/q/25572641
tags question: http://stackoverflow.com/q/25585292
tags question: http://stackoverflow.com/q/25643370
tags question: http://stackoverflow.com/q/25613986
tags question: http://stackoverflow.com/q/25676873
tags question: http://stackoverflow.com/q/25638716
tags question: http://stackoverflow.com/q/25700311
tags question: http://stackoverflow.com/q/25608839
tags question: http://stackoverflow.com/q/25679284
tags question: http://stackoverflow.com/q/25559614

http://stackoverflow.com/a/25642329
answers question: http://stackoverflow.com/q/25642244
type: Answer
score: 2
upvote count: 2
has body: Use Pattern.quote(rs.getString("rs_name")) to automatically escape control characters. Beware of nulls.
downvote count: 0

http://stackoverflow.com/comment/40108497
has text: Have you tried with the power source options available in your lappy?As mentioned by @AlexisLeclerc
comment on: http://stackoverflow.com/q/25665353
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/40201823
comment on: http://stackoverflow.com/a/25711869
has text: Perhaps. I'm not saying I never mark a class static. I use them for objects that don't change state. But I have encountered other troubles when there are static classes around (in testing for example) and so I typically use a design pattern and don't mark objects static. Software should be open to extension and closed to modification... I've also inherited projects where everything was marked static which made the software difficult to extend. So I avoid them but certainly understand they are useful sometimes.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25596392
type: Question
has comment: http://stackoverflow.com/comment/39982068
tagged with: robovm
tagged with: java
linked to: http://stackoverflow.com/q/10382929
has comment: http://stackoverflow.com/comment/39983460
has comment: http://stackoverflow.com/comment/39982190
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39982131
duplicate of: http://stackoverflow.com/q/10382929
has comment: http://stackoverflow.com/comment/39982205
has comment: http://stackoverflow.com/comment/39982099
tagged with: libgdx
answer count: 0
downvote count: 0
upvote count: 1
type: UnansweredQuestion
has title: Robovm mac issue, Unsupported major.minor version 51.0
has body: I have been trying to set up my mac environment for a while now but am having trouble importing my project using gradle. I've been following all the instructions and I have read through both of these forums (http://badlogicgames.com/forum/viewtopic.php?f=11&amp;t=14168, http://badlogicgames.com/forum/viewtopic.php?f=11&amp;t=13419), but I still cannot figure out what the problem is. When I try to build the gradle project I am receiving this error: com/github/jtakakura/gradle/plugins/robovm/RoboVMPlugin : Unsupported major.minor version 51.0 From what I have read that means there is something wrong with the JDK I am using. I have downloaded and re-downloaded JDK 7 and made sure that eclipse is using it I have my compiler setting to 1.7, I have also tried it at 1.6 and it still does not work. I have the JAVA_HOME path set as follows: $ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home and this is what I get for the Java version: $ java -version java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode) Looking at the two threads that I linked, I think I addressed most of the issues yet I still see that error. I am relatively new to using MACs so maybe there is a glaring omission on my part. Also, I was just trying to run a plain robovm iOS project and I recieved this error: Plug-in org.robovm.eclipse.ui was unable to load class org.robovm.eclipse.internal.NewCocoaTouchProjectWizard. An error occurred while automatically activating bundle org.robovm.eclipse.ui Not sure what it means. Note: I have seen a few StackOverflow topics relating to this but I feel like I have addressed the issues presented in them and yet still have this error. Edit: As I mentioned in my note. I have already addressed the JDK issue which my post elaborates on. To the best of my knowledge I have J2SE 7 enabled yet I still have the error. So I was wondering if I could have missed someth…

http://stackoverflow.com/a/27611703
has comment: http://stackoverflow.com/comment/80322865
has comment: http://stackoverflow.com/comment/80320251
has body: I expect you mean build variables injected by Build User Vars Plugin into build. If you are interested in reading static jobs configuration (from system groovy script for instance), use job.getBuildWrappersList().get(org.jenkinsci.plugins.builduser.BuildUser.class) to get user configured instance of BuildUser. In case of Build User Vars Plugin there is not much configuration to read, though. If you would like to access actual variable values injected into the build process (from a BuildStep for instance), call build.getEnvironment(TaskListener) to get populated EnvVars instance with all variables. Note that these variables are not available outside of build context.
type: Answer
answers question: http://stackoverflow.com/q/25661386
score: 0

http://stackoverflow.com/comment/39960356
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25584396
type: AnswerComment
has text: are you able to explain how this code would work exactly. like after reading the file? why does it say class Variable needs to be in a separate file even though i removed public from it.

http://stackoverflow.com/comment/40117573
has text: Remove + Add = refresh, since it's not the same object
score: 0
comment on: http://stackoverflow.com/a/25668294
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25576538
type: Question
has answer: http://stackoverflow.com/a/25579554
tagged with: jooq
tagged with: code-generation
tagged with: maven
score: 13
upvote count: 13
type: AnsweredQuestion
has body: Looking at the jOOQ example of the Maven plugin configuration for the code generator (near the end of the configuration), I see that the target directory for the generated files is target/generated-sources/jooq. Since the generator produces Java code, do you know why the suggestion here isn't a subfolder of /src, but instead a completely separated one? Is there any reason for this? Is it a best practice or something?
has title: Why does jOOQ suggest to put generated code under "/target" and not under "/src"?
tagged with: sql
tagged with: java
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25579554
favorite count: 0

http://stackoverflow.com/comment/40007993
comment on: http://stackoverflow.com/q/25610537
score: 0
type: QuestionComment
has text: Constructor `public MyArrayList(E[] objects)` could simply call `super(objects);` instead of doing the same like the super class constructor.
type: Comment

http://stackoverflow.com/q/25613323
has comment: http://stackoverflow.com/comment/40013060
has title: Getting today's UNIX timestamp with Calendar
has comment: http://stackoverflow.com/comment/40012891
has comment: http://stackoverflow.com/comment/40013006
answer count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40013262
has comment: http://stackoverflow.com/comment/40012939
has comment: http://stackoverflow.com/comment/40012989
has answer: http://stackoverflow.com/a/25613538
type: Question
has answer: http://stackoverflow.com/a/25616004
has body: I'm trying to get today's UNIX timestamp (seconds elapsed since 01/01/1970) at 00:00:00 with Java's Calendar: public long getTodayTimestamp() { Calendar c = Calendar.getInstance(Locale.getDefault()); c.setTimeInMillis(System.currentTimeMillis()); c.set( c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH), 0, 0, 0 ); return c.getTimeInMillis()/1000; } The problem is it returns 1409608800 for today (September 1st), but when I try to convert it with some converter (for example http://www.onlineconversion.com/unix_time.htm) I get Mon, 01 Sep 2014 22:00:00 GMT which is midnight September 2nd my local time. Basically the method is returning the timestamp 24 hours ahead of what I need. Where did I screw up?
has comment: http://stackoverflow.com/comment/40013267
has comment: http://stackoverflow.com/comment/40012874
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40013243
has answer: http://stackoverflow.com/a/25613519

http://stackoverflow.com/q/25644210
tagged with: spring-mvc
answer count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40072227
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40071833
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40070380
favorite count: 0
type: Question
has title: How to get the errors message with spring mvc in tomcat's catalina.out
tagged with: exception
type: UnansweredQuestion
has body: I request a test link https://terran.gamebox.com/facebook/issueOrder.jhtml?amount=5&amp;gameId=1&amp;serverId=1&amp;role=role I can see the message in page but the exception did not show in catalina.out This is my configure file &lt;bean id="exceptionResolver" class="com.gamebox.HandlerException"&gt; HandlerException implements HandlerExceptionResolver I must point that I can get the other controller's exception such as null pointer exception I guess it's a spring internal exception, but I need capture all exception in catalina.out file. I create a @Service dependence in a @Controller, then delete the @Service's class file. When I started the tomcat, everything is OK, I request this controller, I got the exception message, but the catalina.out show nothing. The tomcat ran in Run mode. I paste the response message, because this mvc's action will fix next day with this bug, but I will trace nothing in my platform when I use a ajax with mvc in future if it doesn't show in catalina.out and I will be defficult to find nothing. I am sure it involved transactionManager java.lang.ClassNotFoundException: com.gamebox.service.FacebookPayOrderService org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) java.lang.Class.getDeclaredFields0(Native Method) java.lang.Class.privateGetDeclaredFields(Class.java:2300) java.lang.Class.getDeclaredFields(Class.java:1745) org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:374) org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:322) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:846) org.springframework.beans.factory.support.Abstract…
has answer: http://stackoverflow.com/a/25654207
has answer: http://stackoverflow.com/a/25660674
tagged with: spring

http://stackoverflow.com/q/25658966
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/40096456
upvote count: 1
has comment: http://stackoverflow.com/comment/40096379
favorite count: 0
type: Question
tagged with: exception
has comment: http://stackoverflow.com/comment/40096369
has comment: http://stackoverflow.com/comment/40096244
has body: I have more than 20 category in which each category contains more than 400+ subcategories in webapplication. When I press perticular category button it throws java.lang.OutOfMemoryError. Here is java file code. In this code, I am putting subcategory data in to json object and then add it to json array. String responceObjectStr; JSONObject responseObject; for(int i=0;i&lt;category.length;i++){ responseObject = new JSONObject(); JSONArray ja = new JSONArray(); responseObject.put(category[i],Categorywisedata);//adding data to response ja.put(responseObject);//putting response object to JSONArray responceObjectStr = new String(ja.toString().getBytes("UTF-8")); out.print(responceObjectStr);//response responceObjectStr = null; responseObject = null; } Here in each category it may have 400+ subcategory. When I press the category button it shows java.lang.OutOfMemoryError. How to solve this. I don't want to increase JVM memory for this. I want Java code solution to handle this.
score: -1
has comment: http://stackoverflow.com/comment/40096219
tagged with: java.lang.class
has answer: http://stackoverflow.com/a/25659521
has title: I am facing java.lang.OutOfMemoryError in webapplication for large data
accepted answer: http://stackoverflow.com/a/25659521
has comment: http://stackoverflow.com/comment/40096313
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40096341
has comment: http://stackoverflow.com/comment/40096718
tagged with: java
linked to: http://stackoverflow.com/q/24510188
has comment: http://stackoverflow.com/comment/40096172

http://stackoverflow.com/q/25706003
type: Question
accepted answer: http://stackoverflow.com/a/25706123
has answer: http://stackoverflow.com/a/25706123
upvote count: 0
has body: I'm a new programmer and I would like to start learning programming for android . I tried to learn from the android developer but it seems hard to me so any tip about where should I start ?
tagged with: android
has title: begin android developing tips
type: AnsweredQuestion
downvote count: 4
tagged with: java
score: -4
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/40031764
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25622939
has text: Other question: if an object in your map is mutated, do you consider it a change of state for your map?

http://stackoverflow.com/q/25684900
has answer: http://stackoverflow.com/a/25684957
tagged with: android
tagged with: java
tagged with: http-headers
score: -3
possible better answer: http://stackoverflow.com/a/25685050
type: AnsweredQuestion
upvote count: 0
answer count: 2
tagged with: apache
downvote count: 3
has body: I am new to programming, please have patience - I successfully done a POST to a web service, but now I want to see the data I got back, how do that? Here is my code: try { String data = "{\"params\":{\"stopName\":\"%lauro linhares%\"}}"; CredentialsProvider credProvider = new BasicCredentialsProvider(); credProvider.setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials("WKD4N7YMA1uiM8V", "DtdTtzMLQlA0hk2C1Yi5pLyVIlAQ68")); // DefaultHttpClient http = new DefaultHttpClient(); http.setCredentialsProvider(credProvider); HttpPost post = new HttpPost("https://api.appglu.com/v1/queries/findRoutesByStopName/run"); try { post.setEntity(new StringEntity(data, "UTF8")); } catch (UnsupportedEncodingException e) { System.out.println( "UnsupportedEncoding: "+ e); } post.addHeader("Content-Type", "application/json"); post.addHeader("X-AppGlu-Environment", "staging"); HttpResponse response = http.execute(post); System.out.println("hi! This is what we get back:"+response.getStatusLine().toString()+", "+response.getEntity().toString()); //Hi! This is what we get back:HTTP/1.1 200 OK, org.apache.http.conn.BasicManagedEntity@4246cb88 // got status 200, which is good, but what can // I write next to see the //data i got back from web service ? } catch (ClientProtocolException e) { // System.out.println( "nadir Client protocol exception" + e); } catch (IOException e) { // System.out.println( "nadir IOException"+ e); }
favorite count: 0
has answer: http://stackoverflow.com/a/25685050
accepted answer: http://stackoverflow.com/a/25684957
type: Question
has title: httpclient: got status 200 amen! now what?

http://stackoverflow.com/comment/40066803
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25640526
has text: Java policies: I suppose they could be as well but I'm no expert there

http://stackoverflow.com/comment/39930247
type: Comment
score: 0
type: AnswerComment
has text: Sure, but from what OP has posted, this is the only thing i can do for now. The problem that the string is empty lies somewhere else.
comment on: http://stackoverflow.com/a/25568474

http://stackoverflow.com/q/25668402
score: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has title: Using ODWEK odconfig to connect to Infopac server
tagged with: ondemand
type: UnansweredQuestion
tagged with: java
has body: I'm working on part of migration project in which while click on search - through webservice call the PDF is pulled from ondemand server and through another webservice call PDF is taked from Infopac server ( so the pdf may come from any of the two servers ). Now part of migration the webservice used to pull pdf from Infopac is going to shutdown due to business reasons. On thing we try now is to try to connect to Infopac using ODWEK ( odconfig used for ondemand ) along with API used for ondemand. Is it possible to connect with same odconfig used for Ondemand server to Infopac server with infopac server details. Is ODWEK is specific to Ondemand? if yes then please suggest me or show me the way with some link. yes ofcourse referred to some IBM links before jumping to stackoverflow. Any of your help is appreciated! Thankyou!
answer count: 0
tagged with: mainframe

coding-style
type: Tag
tag name: coding-style
tags question: http://stackoverflow.com/q/25569862

http://stackoverflow.com/comment/40166340
comment on: http://stackoverflow.com/a/25680444
type: AnswerComment
has text: @SanKrish,do i need to include page directive <%@page session="false"%>..if i do,during runtime it shows error
score: 0
type: Comment

http://stackoverflow.com/comment/39971521
score: 0
type: QuestionComment
has text: That returned "Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - incompatible types: byte cannot be converted to byte[]" when I tried to compile it.
comment on: http://stackoverflow.com/q/25590597
type: Comment

http://stackoverflow.com/q/25567032
has comment: http://stackoverflow.com/comment/39927579
has answer: http://stackoverflow.com/a/25568062
tagged with: spring-jdbc
type: AnsweredQuestion
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39929442
tagged with: sql
has comment: http://stackoverflow.com/comment/39927701
tagged with: java
has comment: http://stackoverflow.com/comment/39927633
has answer: http://stackoverflow.com/a/25602834
accepted answer: http://stackoverflow.com/a/25602834
has body: I can't understand what wrong with it, i spent many hours trying to get my String object from method queryForList(..) and all for nothing. So here this stupid sql query: String GET_EMAIL_BY_LDAP = "select ld.LDAP_EMAIL1 from IPS.ldap ld where ld.ldap_login = ?" I have tried this also without '?' parameter and it is works perfectly. Here is the way, how I use the method: List&lt;String&gt; email = jdbcTemplate.queryForList(GET_EMAIL_BY_LDAP, String.class, userId.toUpperCase()); And this version of method also returns empty List: List&lt;String&gt; email = jdbcTemplate.queryForList(GET_EMAIL_BY_LDAP, new Object[]{userId.toUpperCase()}, String.class); P.S. getEmailById("DN270391RKA") - this is my user id parameter that passed. It hasn't spaces. Type of ld.LDAP_EMAIL1 field in table is : NVARCHAR2(381 CHAR)
type: Question
has comment: http://stackoverflow.com/comment/39927663
possible better answer: http://stackoverflow.com/a/25568062
has title: Spring JdbcTemplate with parameter returns empty List
tagged with: oracle-database

http://stackoverflow.com/a/25619603
has body: Your model structure new HashMap&lt;String,HashMap&lt;String,List&lt;PlanDAO&gt;&gt;&gt;(); should be improved; it is too noisy, you need five nested iterators in your page to do what you need, never know in which iterator you are without counting them, and, more important, even if this structure can be used to display data, it can't be used to send it back (you never know). I strongly suggest you to read the following answer: Struts2 Object Modelling That said, when dealing with Collections in a JSP you must read about two great features of OGNL: OGNL List Selection OGNL List Projection
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25617519
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40025428
has comment: http://stackoverflow.com/comment/40024645
type: Answer
accepted answer of: http://stackoverflow.com/q/25617519

http://stackoverflow.com/q/25612668
has comment: http://stackoverflow.com/comment/75349285
type: AnsweredQuestion
tagged with: installation
answer count: 1
downvote count: 0
upvote count: 1
linked to: http://stackoverflow.com/q/44142450
favorite count: 0
type: Question
has body: I am trying to install java 7 on Ubuntu 14.04 following the instructions at Installing Java 7 on Ubuntu . When I try to install java 7, I get a HTTP 404 ERROR. Does anybody know if installing java 7 using these instructions is still supported? Am I missing something that is obvious to everybody else and not to me‽ Thank you in advance for advice. I executed the following commands as per the instructions: sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer Here is the output: Reading package lists... Done Building dependency tree Reading state information... Done oracle-java7-installer is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Setting up oracle-java7-installer (7u67+7u60arm-0~webupd8~4) ... Please report to author unsupported platform 'ppc64'. Proceeding without web browser plugin support Please report to author unsupported platform 'ppc64'. Proceeding without web browser plugin support Downloading Oracle Java 7... --2014-09-01 16:26:08-- http://download.oracle.com/otn-pub/java/jdk/7u60-b19/ jdk-7u60-linux-.tar.gz Resolving download.oracle.com (download.oracle.com)... 23.62.6.106, 23.62.6.153 Connecting to download.oracle.com (download.oracle.com)|23.62.6.106|:80... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-.tar.gz [following] --2014-09-01 16:26:09-- https://edelivery.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-.tar.gz --2014-09-01 16:26:09-- https://edelivery.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-.tar.gz Resolving edelivery.oracle.com (edelivery.oracle.com)... 96.16.150.140 Connecting to edelivery.oracle.com (edelivery.oracle.com)|96.16.150.140|:443... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Locatio…
accepted answer: http://stackoverflow.com/a/25612744
score: 1
has answer: http://stackoverflow.com/a/25612744
tagged with: java
tagged with: apt
tagged with: ubuntu-14.04
tagged with: ubuntu
has title: HTTP ERROR 404 while installing java 7 on Ubuntu 14.04
linked to: http://stackoverflow.com/q/16263556

http://stackoverflow.com/a/25618028
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25617907
type: Answer
answers question: http://stackoverflow.com/q/25617907
has body: In javascript you access object properties using the dot syntax. Since your json will be parsed into javascript objects you can just do something like the following: $.each(data, function(i, obj) { myTable += "&lt;tr&gt;&lt;td&gt;"+obj.value1+"&lt;//td&gt;&lt;td&gt;"+obj.value2+"&lt;//td&gt;&lt;//tr&gt;"; }); This is assuming your object (registereduser?) has properties value1 and value2

http://stackoverflow.com/comment/40078036
score: 0
has text: @LuiggiMendoza Link-only answers are no answers, so it is appropriate as comment
comment on: http://stackoverflow.com/q/25648642
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25663403
score: 0
has body: public class DisplayData extends JFrame { private static final long serialVersionUID = -5142452052317047239L; public DisplayData() throws ErrorCondition, IOException, SAXException { JFrame f1 = new JFrame(); String nonTransientvalue; String transientvalue; JPanel nonTransientAttriPanel = null; JPanel transientAttriPanel=null; ReadXml rx=new ReadXml(); Hashtable&lt;String,String&gt; transientAttributes=rx.getTransientGuiAttributes(); Hashtable&lt;String,String&gt; nonTransientAttributes=rx.getNonTransientGuiAttributes(); Iterator&lt;Entry&lt;String,String&gt;&gt; itr=nonTransientAttributes.entrySet().iterator(); int i = -1; nonTransientAttriPanel = new JPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); while (itr.hasNext()) { Entry&lt;String, String&gt; it = itr.next(); nonTransientvalue = it.getValue(); constraints.anchor = GridBagConstraints.NORTH; constraints.insets = new Insets(10, 10, 10, 10); JLabel labelaccNo = new JLabel(nonTransientvalue); JTextField textaccNo = new JTextField(20); // add billno constraints.gridx = 0; constraints.gridy = ++i; nonTransientAttriPanel.add(labelaccNo, constraints); constraints.gridx = 1; nonTransientAttriPanel.add(textaccNo, constraints); } int j = -1; transientAttriPanel = new JPanel(new GridBagLayout()); //transientAttriPanel.set Iterator&lt;Entry&lt;String,String&gt;&gt; itr1=transientAttributes.entrySet().iterator(); while (itr1.hasNext()) { Entry&lt;String, String&gt; it1 = itr1.next(); transientvalue = it1.getValue(); //GridBagConstraints constraints = new GridBagConstraints(); constraints.anchor = GridBagConstraints.SOUTH; constraints.insets = new Insets(70, 70, 70, 70); JLabel nameLabel = new JLabel(transientvalue); JTextField textValue = new JTextField(20); // add billno constraints.gridx = 0; constraints.gridy = ++j; nonTransientAttriPanel.add(nameLabel, constraints); constraints.gridx = 1; nonTransientAttriPanel.add(textValue, constraints); } f1.setSize(350,300); f1.setVisible(true…
has comment: http://stackoverflow.com/comment/40104101
tagged with: user-interface
answer count: 0
has comment: http://stackoverflow.com/comment/40104814
tagged with: swing
type: Question
has title: how to add more than one JPanel objects in a single JFrame in swing?
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40103904
has comment: http://stackoverflow.com/comment/40103677
has comment: http://stackoverflow.com/comment/40132911

http://stackoverflow.com/a/25596012
type: Answer
answers question: http://stackoverflow.com/q/25595768
has body: Use String.substring(startIndex, endIndex) to retrive a part of a string.
score: 0

http://stackoverflow.com/q/25701346
type: UnansweredQuestion
tagged with: collision-detection
has title: How to check if a circle lies inside of convex polygon
tagged with: geometry
has body: I would like to check if a circle intersects or lies inside a convex polygon. I found a brilliant method to detect if a point is inside a polygon (from here): public boolean insidePolygon(Vector2 [] vertices, Vector2 p) { int i, j; boolean c = false; int nvert = vertices.length; for (i = 0, j = nvert - 1; i &lt; nvert; j = i++) { if (((vertices[i].Y &gt; p.Y) != (vertices[j].Y &gt; p.Y)) &amp;&amp; (p.X &lt; (vertices[j].X - vertices[i].X) * (p.Y - vertices[i].Y) / (vertices[j].Y - vertices[i].Y) + vertices[i].X)) c = !c; } return c; } And this works perfectly for a single point, but is there any way we could modify this to check if a circle with a given radius is inside a polygon? I suppose it's possible because a circle is actually a point but bigger, but still I haven't managed to succeed...
has answer: http://stackoverflow.com/a/25701756
answer count: 2
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/40173085
has comment: http://stackoverflow.com/comment/40173257
has answer: http://stackoverflow.com/a/25714385
favorite count: 0
has comment: http://stackoverflow.com/comment/40173414
type: Question
upvote count: 5
tagged with: java

view
tags question: http://stackoverflow.com/q/25701548
tags question: http://stackoverflow.com/q/25589523
tags question: http://stackoverflow.com/q/25708640
tags question: http://stackoverflow.com/q/25607494
tags question: http://stackoverflow.com/q/25677389
tags question: http://stackoverflow.com/q/25578353
tags question: http://stackoverflow.com/q/25568221
tags question: http://stackoverflow.com/q/25616733
tag name: view
type: Tag
tags question: http://stackoverflow.com/q/25582753

http://stackoverflow.com/q/25606501
has comment: http://stackoverflow.com/comment/40000816
accepted answer: http://stackoverflow.com/a/25606633
has comment: http://stackoverflow.com/comment/40000803
has title: Subtle Java Regular Expressions
upvote count: 1
has body: String str = "1234545"; String regex = "\\d*"; Pattern p1 = Pattern.compile(regex); Matcher m1 = p1.matcher(str); while (m1.find()) { System.out.print(m1.group() + " found at index : "); System.out.print(m1.start()); } The output of this program is 1234545 found at index:0 found at index:7. My question is: why is there a space printed when actually there is no space in the str.
has answer: http://stackoverflow.com/a/25606633
has comment: http://stackoverflow.com/comment/40000683
favorite count: 0
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40000689
score: -1
tagged with: regex
has comment: http://stackoverflow.com/comment/40000730
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40000784
has comment: http://stackoverflow.com/comment/40000781
has comment: http://stackoverflow.com/comment/40000748
downvote count: 2
answer count: 1

http://stackoverflow.com/comment/40084453
type: AnswerComment
has text: @Alex I just saw that you want to convert a List<byte[]> to an array of arrays. In this case what you want is a 2D array, which is the same thing as an array of arrays
score: 0
comment on: http://stackoverflow.com/a/25652530
type: Comment

http://stackoverflow.com/q/25684070
has answer: http://stackoverflow.com/a/25684713
has comment: http://stackoverflow.com/comment/40140902
possible better answer: http://stackoverflow.com/a/25684132
linked to: http://stackoverflow.com/q/383947
downvote count: 1
has comment: http://stackoverflow.com/comment/40140795
favorite count: 0
type: Question
has title: How should I create Hashtable<Key, Value> when I do not care what is stored in Value?
accepted answer: http://stackoverflow.com/a/25684713
has answer: http://stackoverflow.com/a/25684132
upvote count: 2
type: AnsweredQuestion
has body: I want to operate over array of integers, and I can solve the problem using hashtable. I want to store the ellements of the array as Key but for Value I really don't care what will be stored there. In such case how should I create my hashtable? My approach is just to set value as 0 for each element like this: Hashtable&lt;Integer, Integer&gt; ht = new Hashtable&lt;Integer, Integer&gt;(); for (int i = 0; i &lt; arr.length; i++) { ht.put(arr[i], 0); } Is there any convention what should I do in such cases? For example, is it better to set Value as Boolean and respectively true for all inserted elements? Once again, for me it really doesn't matter what will be stored in Value. I just want to know what is the best approach in such cases.
answer count: 2
has comment: http://stackoverflow.com/comment/40140794
has comment: http://stackoverflow.com/comment/40140793
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40143817

http://stackoverflow.com/a/25636405
accepted answer of: http://stackoverflow.com/q/25636355
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25636355
has body: On the first calculation 33 / 5 you are actually dividing an integer thus giving you result with no decimal places. And the second calculation: 33/5.0 the result is actually promoted to double which has greater precision than int and resulted to decimal. Remember that 5.0 is a double thus promoting the result of the calculation to double primitive
score: 2

http://stackoverflow.com/a/25627059
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25626918
has body: If the path begins with a / it is interpreted as relative to the current context root (it means jsp is directly placed under webapp or webContent folder in the project) For example: request.getRequestDispatcher("/login.jsp").forward(request, response); If the path does NOT start with forward slash,it is considered relative to the original request. Read more...
type: Answer
answers question: http://stackoverflow.com/q/25626918

http://stackoverflow.com/a/25600725
type: Answer
has body: There's no dead code in your posted code. The only problem I can see is here: if (myVar != null) { return myVar; } You're returning a MyInterface when you should return a String. The compiler will complain about it and it's right. Also, as a better alternative, you should not directly return inside the try or catch block, instead design a single place after this block to return the result. This will make your code avoid any dead code compiler error. Your could should look like: private String someMethod(String myParam) { String result = ""; try { MyInterface myVar = (MyInterface) domeSomething(myParam); if (myVar != null) { result = myVar.methodThatReturnsString(); } } catch (Exception e) { //handle the exception //basic handling shown System.out.println("Warning. There was a problem executing someMethod:"); e.printStacktrace(); } return result; }
has comment: http://stackoverflow.com/comment/39990091
upvote count: 6
answers question: http://stackoverflow.com/q/25600689
has comment: http://stackoverflow.com/comment/39990168
has comment: http://stackoverflow.com/comment/39990053
type: AcceptedAnswer
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/39990282
has comment: http://stackoverflow.com/comment/40114491
accepted answer of: http://stackoverflow.com/q/25600689

jtextarea
tags question: http://stackoverflow.com/q/25573015
type: Tag
tags question: http://stackoverflow.com/q/25668172
tags question: http://stackoverflow.com/q/25553250
tag name: jtextarea
tags question: http://stackoverflow.com/q/25552313
tags question: http://stackoverflow.com/q/25652353
tags question: http://stackoverflow.com/q/25658672
tags question: http://stackoverflow.com/q/25594101

http://stackoverflow.com/comment/40377225
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25651040
has text: I added some code that I believe shows that when you set the opaque property on a label nothing happens. Other properties seem to work but for some reason not this one. Is there another way to create a L&F that will get the opaque property on label to work?
score: 0

http://stackoverflow.com/q/25623460
downvote count: 0
score: 1
upvote count: 1
has body: I'm trying to follow along to the Eclipse Java tutorials (lesson 3 at the moment) which introduces trying to import packages into a scrapbook. In this case it's supposed to mean that I can call Person p = new Person(); p instead of Person p = new org.totalbeginner.tutorial.Person(); p But, even though I've followed each step one by one, I get a "null" result in the inspection view rather than the expected class fields in the inspector (which should be 'name' and 'maximumBooks') Here is the class 'Person': package org.totalbeginner.tutorial; public class Person { // fields private String name; // name of the person private int maximumBooks; // maximum books a person can check out //constructor (initial values) public Person() { name = "unknown name"; maximumBooks = 3; } //methods public String getName() { return name; } public void setName(String anyName) { name = anyName; } public int getMaximumBooks() { return maximumBooks; } public void setMaximumBooks(int maximumBooks) { this.maximumBooks = maximumBooks; } } Now the tutorial is using an outdated version of Eclipse. I followed the following procedure to import a package into the scrapbook: Click on 'Sets the Import Declarations for Running Code' shortcut Add Packages... Selected 'org.totalbeginner.tutorial.*' and press OK. Is there a different step I'm missing? Neither the Person class or the Scrapbook have any noted compiling errors. What am I missing or doing wrong?
answer count: 1
has comment: http://stackoverflow.com/comment/40031372
has comment: http://stackoverflow.com/comment/40031754
favorite count: 0
type: Question
has title: New to Java and having issues with linking scrapbook to constructor
tagged with: package
has comment: http://stackoverflow.com/comment/40031614
has answer: http://stackoverflow.com/a/25624860
accepted answer: http://stackoverflow.com/a/25624860
tagged with: java
has comment: http://stackoverflow.com/comment/40032166
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40031782
type: AnsweredQuestion

http://stackoverflow.com/comment/39946005
score: 0
comment on: http://stackoverflow.com/q/25555609
type: Comment
type: QuestionComment
has text: No, of course there's a way (see my answer), it's just clunky.

http://stackoverflow.com/comment/40155712
has text: Both answers are right, I'll not cry all the night if you choose Mark's one :)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25689980
type: Comment

http://stackoverflow.com/a/25624267
answers question: http://stackoverflow.com/q/25622220
has comment: http://stackoverflow.com/comment/40050879
type: Answer
has body: It depends whether you're concerned about memory/time or both of them. You're concerned about memory Go with the brute force N2 solution because it uses no extra memory at all(only the memory required to keep the common elements), and N2 in practice is not that bad for small size lists. Anyway, fetching the phone numbers from database is more likely to cause a bigger performance hit than your N2 algorithm. You're concerned about time but you can use extra memory Wrap your phone numbers into a wrapper class, and add all the phone numbers from the 1st list to a HashSet. Then, iterate over your 2nd list and check if set is containing the wrapped phone number or not. This will guarantee you a O(m+k*n) time ( you have to iterate each list just once , and HastSet's contains method is a constant k - where k represents the average number of Strings having the same hashCode.) . This tends to O(n) because 2 and k(should be 1 because String's hashSet() collisions are quite rare) are constant factors which can be discarded. class PhoneNumber { private final String val; public PhoneNumber(final String val){ this.val = val; } @Override public int hashCode(){ return this.getVal().hashCode(); } @Override public boolean equals(Object obj){ if (this == obj) { return true; } if (obj == null) { return false; } if (this.getClass() != obj.getClass()) { return false; } PhoneNumber other = (PhoneNumber )obj; return PhoneNumberUtils.compare(this.getVal(), other.getVal()) == 0; } public String getVal(){ return this.val; } } private Set&lt;PhoneNumber&gt; getCommonPhoneNumbers(List&lt;String&gt; dbPhoneNumbers , List&lt;String&gt; userPhoneNumbers){ Set&lt;PhoneNumber&gt; common = new HashSet&lt;PhoneNumber&gt;(); Set&lt;PhoneNumber&gt; phoneNumbers = new HashSet&lt;PhoneNumber&gt;(); for(String s : userPhoneNumbers){ phoneNumbers.add(new PhoneNumber(s)); } for(String s : dbPhoneNumbers ){ PhoneNumber phoneNo = new PhoneNumber(s); if(phoneNumbers.contains(phoneNo)){ common.add(phoneNo); } } r…
accepted answer of: http://stackoverflow.com/q/25622220
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/25639970
has body: A 400 error might be occuring (and usually occurs in my case) because of incorrect URL or bad JSON format in post. please check those two Using an HttpPost object will make your job a lot easier in my opinion HttpPost post = new HttpPost(url); if(payload != null){ try { StringEntity entity = new StringEntity(payload,HTTP.UTF_8); entity.setContentType(contentType); post.setEntity(entity); } catch (UnsupportedEncodingException e) { LOG.d(TAG, "post err url : " + url); LOG.e(TAG, "post err url" , e); throw new Exception(1, e); } } HttpResponse response=executeRequest(owner, post);
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25638809

http://stackoverflow.com/comment/40070352
type: QuestionComment
has text: Use NumberFormat for formatting numbers
comment on: http://stackoverflow.com/q/25644858
score: 1
type: Comment

http://stackoverflow.com/q/25663569
answer count: 2
has answer: http://stackoverflow.com/a/25665010
downvote count: 0
type: UnansweredQuestion
tagged with: desktop-application
has title: Which is the best database application to work with offline data?
has comment: http://stackoverflow.com/comment/40103963
favorite count: 0
has answer: http://stackoverflow.com/a/25663612
upvote count: 3
has body: I have one requirement as create a desktop application edition of one data-driven web application. This web application is currently running on MySql database. Now as per my requirement I need to create a desktop edition which will be downloaded from the web-application along with data file and it can work without Internet connection on Windows and Mac platform. So now I cannot use MySql here as it needs connectivity with database server. So my question is which is the best option now to use as database in my desktop edition which can be used with offline data file without any server application? Also it will be plus point if migration from MySql to that database take minimal effort. Here are some considerations to be taken in consideration: It should be capable of storing blob data. It should have almost same sql structure as MySql It should support ORM framework like Hibernate MySql data can be transfer in its compatible structure. Please suggest me the best option for this. Also this will be Java based solution so I am planning to use JavaFX as UI framework. Please suggest me if there is another better option for this within Java.
score: 3
tagged with: java
tagged with: javafx
tagged with: database
has comment: http://stackoverflow.com/comment/40103890
has comment: http://stackoverflow.com/comment/40103977
has comment: http://stackoverflow.com/comment/40103940
type: Question

http://stackoverflow.com/q/25647786
has answer: http://stackoverflow.com/a/51548572
has answer: http://stackoverflow.com/a/25650470
tagged with: port
tagged with: rxtx
accepted answer: http://stackoverflow.com/a/25667940
has title: Could not find COM port and port list is empty
has comment: http://stackoverflow.com/comment/40077238
possible better answer: http://stackoverflow.com/a/25650470
has answer: http://stackoverflow.com/a/25667940
type: AnsweredQuestion
answer count: 3
has body: Hey i would like to connect my eclipse programs written in Java with an Arduino. Previously i used Processing but now i am working on something more difficult: I will connect a Leap to an Arduino, but i get the following message when i try to connect to my port. I am using a Mac and the port i used in processing was tty.usbserial-AM01VBFC However this does not work with the given example from: http://playground.arduino.cc/interfacing/java I changed this to match my port: private static final String PORT_NAMES[] = { "/dev/tty.usbserial-AM01VBFC", // Mac OS X "/dev/ttyACM0", // Raspberry Pi "/dev/ttyUSB0", // Linux "COM3", // Windows }; and the result is: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Could not find COM port. Started The port list is empty in my opinion because: portEnum.hasMoreElements() is false. The full code can be found in the link above the only thing i changed is the port name for Mac OS X. I have found only one guy with the same problem and he found a solution for ubuntu i do not understand: http://forum.arduino.cc/index.php?topic=73350.0;wap2 Hoping for some help, Georgi
score: 1
tagged with: java
tagged with: arduino
downvote count: 0
upvote count: 1
tagged with: macos
favorite count: 0
type: Question

http://stackoverflow.com/comment/49695523
score: 6
has text: Did not work for me when I used lambdas - is there a way to work around that as well?
comment on: http://stackoverflow.com/a/26000741
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40107911
has text: Nope I don't want any InputStream I need to access the file from the jar file because OpenCV reads file native code....
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25664351

http://stackoverflow.com/a/25711123
answers question: http://stackoverflow.com/q/25711035
has comment: http://stackoverflow.com/comment/40190923
downvote count: 3
has comment: http://stackoverflow.com/comment/40190992
has body: That code is not javascript, it is java. It looks like you're trying to use Java Server Pages (JSP), which generates HTML by running java code on your webserver which is then sent to the browser. Javascript is a completely different language which is usually run in the browser itself. In order to make your code run rather than just be displayed in the page you need to set up a webserver that will execute the java code and serve the page.
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/40190819
has comment: http://stackoverflow.com/comment/40190842
upvote count: 2

http://stackoverflow.com/q/25659530
has title: Byte length of string in different character sets
score: 0
linked to: http://stackoverflow.com/q/5688042
answer count: 2
has answer: http://stackoverflow.com/a/25659893
tagged with: java
has comment: http://stackoverflow.com/comment/40097182
has answer: http://stackoverflow.com/a/25736963
tagged with: string
type: Question
has comment: http://stackoverflow.com/comment/40097815
type: UnansweredQuestion
has body: I need to find out the length of a string for different character sets in Java. Assuming that I have 160 characters and the ASCII character set, the byte length should be 140. Similarly I need for other character set also. I may get an input stream in any of the character set, but once received it will be stored in UTF-16 and subsequently I will not be able to get the exact byte length of original character set.
tagged with: character-encoding

http://stackoverflow.com/q/25570454
tagged with: javascript
score: 4
has comment: http://stackoverflow.com/comment/40045707
has body: I'm transitioning from eclipse to intellij and like some (http://devnet.jetbrains.com/thread/452846), I'd like to have a variable comparable to eclipse's ${project_loc}. Seeing some of the responses out there I learned that I can use environment variables, but this isn't quite what I want. I'd really like intellij to be able to determine which module has focus, then run using that module's base directory as the runtime path. I have a group of modules that I want to run the same run configuration on at different times. I don't want to have to define separate run configurations for each individual module. This is how I did it in eclipse, so I'm inclined to want to do it the same way. If perhaps there's a different way to accomplish the same goal, I'm all for it. Here's our use case: We have a number of jars that each include javascript files. As part of the build process these javascript files are pulled out of the jar and aggregated together in an all.js file. During development we want to be able to update this all.js file on the fly while the server is running. Due to the aggregation step we can't use built-in hotswapping-like functionality to update client resources. For this we have created a run configuration, that when run will aggregate the js and copy it onto the local app server. This run configuration for eclipse is currently used to do this for multiple projects and is also shared between many developers. Again, the main desire is a generic variable that is agnostic to both the project/module as well as the base path to that module. Any suggestions?
tagged with: java
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/39934506
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40045514
favorite count: 0
type: Question
upvote count: 5
has title: Generic run configurations in intellij and path to active module
type: UnansweredQuestion
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/79056006
tagged with: maven

file
tags question: http://stackoverflow.com/q/25611674
tags question: http://stackoverflow.com/q/25619281
tags question: http://stackoverflow.com/q/25654475
tags question: http://stackoverflow.com/q/25629588
type: Tag
tags question: http://stackoverflow.com/q/25562494
tags question: http://stackoverflow.com/q/25660327
tags question: http://stackoverflow.com/q/25588685
tags question: http://stackoverflow.com/q/25637406
tags question: http://stackoverflow.com/q/25710932
tags question: http://stackoverflow.com/q/25670444
tags question: http://stackoverflow.com/q/25613181
tags question: http://stackoverflow.com/q/25574700
tags question: http://stackoverflow.com/q/25553069
tags question: http://stackoverflow.com/q/25676206
tags question: http://stackoverflow.com/q/25571758
tags question: http://stackoverflow.com/q/25702489
tags question: http://stackoverflow.com/q/25683994
tags question: http://stackoverflow.com/q/25684424
tags question: http://stackoverflow.com/q/25702651
tags question: http://stackoverflow.com/q/25608614
tags question: http://stackoverflow.com/q/25635957
tags question: http://stackoverflow.com/q/25592681
tags question: http://stackoverflow.com/q/25555283
tag name: file
tags question: http://stackoverflow.com/q/25655353
tags question: http://stackoverflow.com/q/25691617
tags question: http://stackoverflow.com/q/25709697
tags question: http://stackoverflow.com/q/25694690
tags question: http://stackoverflow.com/q/25653701
tags question: http://stackoverflow.com/q/25662043
tags question: http://stackoverflow.com/q/25560820
tags question: http://stackoverflow.com/q/25692003
tags question: http://stackoverflow.com/q/25663063
tags question: http://stackoverflow.com/q/25558387
tags question: http://stackoverflow.com/q/25567836
tags question: http://stackoverflow.com/q/25712333

sigar
tag name: sigar
tags question: http://stackoverflow.com/q/25711304
type: Tag

http://stackoverflow.com/a/25580489
type: Answer
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25571047
has body: Once when I found it, solution looks quite easy. Here is the class that did the job right: package com.oracle.client; import java.math.BigDecimal; import com.oracle.sca.soapservice.poprocessing.poprocessing.receivepo.ExecutePtt; import com.oracle.sca.soapservice.poprocessing.poprocessing.receivepo.ReceivePO; import com.oracle.xmlns.ns.order.ObjectFactory; import com.oracle.xmlns.ns.order.PurchaseOrderType; public class SOAClient { public static void main(String[] args) { ReceivePO recPOService = new ReceivePO(); ExecutePtt recPOPort = recPOService.getExecutePt(); PurchaseOrderType purchaseOrder = new ObjectFactory() .createPurchaseOrderType(); purchaseOrder.setCustID("1111"); purchaseOrder.setID("2121"); purchaseOrder.setProductName("Bluetooth Headset"); purchaseOrder.setItemType("Electronics"); BigDecimal bd_p = new BigDecimal("49.99"); purchaseOrder.setPrice(bd_p); BigDecimal bd_q = new BigDecimal("10"); purchaseOrder.setQuantity(bd_q); purchaseOrder.setStatus("initial"); purchaseOrder.setCcType("Mastercard"); purchaseOrder.setCcNumber("8765-8765-8765-8765"); recPOPort.execute(purchaseOrder); } }
answers question: http://stackoverflow.com/q/25571047

http://stackoverflow.com/a/25638260
has comment: http://stackoverflow.com/comment/40059002
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/40058376
downvote count: 0
has body: Will line 2 give an unique key violation error since both are referring to the same object o ? -&nbsp;No. If a key is found to be already present, then its value will be overwritten with the new one. Next, HashMap has a separate hash() method which Applies a supplemental hash function to a given hashCode (of key objects), which defends against poor quality hash functions.
has comment: http://stackoverflow.com/comment/40059664
answers question: http://stackoverflow.com/q/25638189
type: Answer

http://stackoverflow.com/q/25599998
has comment: http://stackoverflow.com/comment/39990817
has title: java.lang.ArrayIndexOutOfBoundsException while scrolling List
tagged with: baseadapter
has comment: http://stackoverflow.com/comment/39988807
has comment: http://stackoverflow.com/comment/39989022
type: Question
has comment: http://stackoverflow.com/comment/39989133
has comment: http://stackoverflow.com/comment/39990661
has comment: http://stackoverflow.com/comment/39988649
type: UnansweredQuestion
has body: private class listAdapter extends BaseAdapter { @Override public int getCount() { return labels.size(); } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } @Override public int getViewTypeCount() { return getCount(); } @Override public int getItemViewType(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { TextView name, type, time, date, location, comm, spot, spottype; TextView oname, oreg, otype, odate, otime, olocation; final ImageView pic1; final ImageView pic2; final ImageView pic3; ImageView ovtype, sloc; ImageLoadingListener animateFirstListener = new AnimateFirstDisplayListener(); int j = 0, x = 0; if (convertView == null) { vv = getActivity().getLayoutInflater().inflate( R.layout.other_item, null); } else { vv = convertView; } pic1 = (ImageView) vv.findViewById(R.id.pic1); pic2 = (ImageView) vv.findViewById(R.id.pic2); pic3 = (ImageView) vv.findViewById(R.id.pic3); name = (TextView) vv.findViewById(R.id.sname); type = (TextView) vv.findViewById(R.id.stype); time = (TextView) vv.findViewById(R.id.stime); date = (TextView) vv.findViewById(R.id.sdate); location = (TextView) vv.findViewById(R.id.slocation); comm = (TextView) vv.findViewById(R.id.scomm); // spot = (TextView) vv.findViewById(R.id.sspot); spottype = (TextView) vv.findViewById(R.id.textView1); oname = (TextView) vv.findViewById(R.id.name); oreg = (TextView) vv.findViewById(R.id.reg); otype = (TextView) vv.findViewById(R.id.type); odate = (TextView) vv.findViewById(R.id.date); otime = (TextView) vv.findViewById(R.id.time); olocation = (TextView) vv.findViewById(R.id.location); ovtype = (ImageView) vv.findViewById(R.id.vtype); sloc = (ImageView) vv.findViewById(R.id.imageView2); oname.setText(testimonialData.get(position).getmake() + " " + testimonialData.get(position).getmodel()); if (testimonialData.get(position).gettype() .equalsIgnoreCase("report")) { ore…
has comment: http://stackoverflow.com/comment/39988572
tagged with: android
tagged with: arrays
has comment: http://stackoverflow.com/comment/39988577
has comment: http://stackoverflow.com/comment/39989054
tagged with: listview
score: 0
answer count: 0
linked to: http://stackoverflow.com/q/2596547
tagged with: java

http://stackoverflow.com/q/25650913
has title: Label with a close Button JavaFX
has answer: http://stackoverflow.com/a/25651381
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25652126
score: 0
answer count: 2
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/25651381
type: Question
has answer: http://stackoverflow.com/a/25652126
has body: Is it possible to create a Label(Non-editable text field) with a close button? On button click, the label should disappear.

http://stackoverflow.com/comment/40176958
score: 3
type: Comment
type: QuestionComment
has text: If you really want it re-opened, you need to do the following: Make the title more narrow. No one will ever search for 'modern OO practices in Java' and expect to come across anything less than a novel (which we don't do). Second,you're asking about a trend. Show us code; show us what you see people using; "Is this something normal and accepted?" Is not a question we can ever answer, you may want to edit that out.
comment on: http://stackoverflow.com/q/25703386

http://stackoverflow.com/q/25646564
favorite count: 0
type: Question
tagged with: serialization
has answer: http://stackoverflow.com/a/41072340
answer count: 2
has comment: http://stackoverflow.com/comment/40073607
upvote count: 8
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/7854030
tagged with: spring
has body: I have the below Code : DTO : Class MyDTO { import java.util.Date; private Date dateOfBirth; public Date getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(Date dateOfBirth) { this.dateOfBirth = dateOfBirth; } } Controller public void saveDOB(@RequestBody MyDTO myDTO, HttpServletRequest httprequest, HttpServletResponse httpResponse) { System.out.println("Inside Controller"); System.out.println(myDTO.getDateOfBirth()); } JSON Request : { "dateOfBirth":"2014-09-04", } If I send the request as yyyy-mm-dd automatic conversion to date object happens. output in controller:- dateOfBirth= Thu Sep 04 05:30:00 IST 2014 But when I send DateofBirth in dd-mm-yyyy format It does not convert String to Date automatically.So how i can i handle this case. JSON Request : { "dateOfBirth":"04-09-2014", } Output: No Output in console does not even reaches controller. I have tried with @DateTimeFormat but its not working. I am using Spring 4.02 Please suggest is there any annotation we can use.
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/5591967
has title: Unable to convert String to Date by requestBody in spring
linked to: http://stackoverflow.com/q/3591291
linked to: http://stackoverflow.com/q/21505997
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25647213
downvote count: 0
linked to: http://stackoverflow.com/q/11376304
score: 8

http://stackoverflow.com/q/25634693
downvote count: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/40052405
has answer: http://stackoverflow.com/a/25634806
linked to: http://stackoverflow.com/q/729379
tagged with: java
tagged with: size
has title: How to find size/length of an array without using library functions/variables
has body: int arr[] = new int[10]; int size=0; while(???) { i++; } System.out.println(size); // Should print 10 How can I loop over the array without using arr.length or other library functions?
has comment: http://stackoverflow.com/comment/40055969
score: -6
type: Question
has answer: http://stackoverflow.com/a/25634712
upvote count: 0
has comment: http://stackoverflow.com/comment/40052583
answer count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40052501
tagged with: arrays

http://stackoverflow.com/q/25606563
tagged with: java
possible better answer: http://stackoverflow.com/a/25606648
has answer: http://stackoverflow.com/a/25606626
tagged with: apache-commons-collection
tagged with: collections
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25606677
accepted answer: http://stackoverflow.com/a/25606677
tagged with: apache-commons
has body: I have a List&lt;Object&gt; and I want to return the first value that it finds true which matches a predicate. I found that I can use CollectionUtils.find(collection,predicate) (Apache commons). Assuming that the Object contains a integer variable called : value , how do i specify in the predicate that the value can be 1,2,3,4,5 and to discard those that dont match. Is it possible to do 'contains'. Also not using java 8 so unable to do stream.
has title: CollectionUtils in java using predicate
has answer: http://stackoverflow.com/a/25606648
upvote count: 12
type: AnsweredQuestion
score: 12
answer count: 3
downvote count: 0

http://stackoverflow.com/a/25696987
has body: it's better to organize your code in reusable function to make it more readable: public class AreaInv2 { private static Scanner sc = new Scanner(System.in); public static void main(String[] args) { String name = getName(); while (true) { float radius = getRadius(name); printArea(radius); System.out.println("Would you like the area of any other circles? "); if (!needToDoAgain()) { System.out.print("Have a great day " + name + "!"); break; } } sc.close(); } private static String getName() { System.out.println("Hi there! What's your name?"); return sc.next(); } private static float getRadius(String name) { System.out.println("Alright , " + name + ", enter the radius of the circle: "); return sc.nextFloat(); } private static void printArea(float radius) { float area = (float) (Math.pow(radius, 2) * Math.PI); System.out.print("The area is "); System.out.printf("%.2f", area); System.out.println("."); } private static boolean needToDoAgain() { String yesno = sc.next(); if (yesno.equalsIgnoreCase("yes")) { return true; } else if (yesno.equalsIgnoreCase("no")) { return false; } else { System.out.println("Sorry, could you say yes or no? "); return needToDoAgain(); } } }
has comment: http://stackoverflow.com/comment/40165648
has comment: http://stackoverflow.com/comment/40165641
answers question: http://stackoverflow.com/q/25696829
type: Answer
has comment: http://stackoverflow.com/comment/40165613
score: 0

http://stackoverflow.com/a/25719689
has comment: http://stackoverflow.com/comment/40220517
has body: Extending Oberron's answer, to put zoned times in Icalendar, you need a top level VTIMEZONE element that defines the timezone and a TZID attribute in the time, eg. DTSTART;TZID=Europe/Prague:20140912T100000. TZID should not be sitting out on it's own, unrelated to a time, to my eyes. Ical4j should do this for you. See this page. Try loading the timezone registry as shown... TimeZoneRegistry registry = builder.getRegistry();
downvote count: 0
has comment: http://stackoverflow.com/comment/40219173
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40213401
answers question: http://stackoverflow.com/q/25686970
type: Answer
has comment: http://stackoverflow.com/comment/40218325

ampersand
tags question: http://stackoverflow.com/q/25560332
type: Tag
tag name: ampersand

http://stackoverflow.com/comment/40134841
type: QuestionComment
comment on: http://stackoverflow.com/q/25674850
type: Comment
has text: Could you be a bit more precise? What do you want to model? Do you want to make sure that shipment A and B are in the same route?
score: 0

http://stackoverflow.com/a/25567058
score: 1
type: Answer
has body: I read the Oracle Docs for class.getResource() and there I have to use "/" Obviously you have to use / for windows or \ for linux as the file separator. The file separator is use to navigate inside a directory. Suppose you have a file inside mydirectory/filename and you have kept it under the resources folder of your project. The way to read this will be either URL url = className.class.getClassLoader().getResource("/mydirectory/filename"); or InputStream is = className.class.getClassLoader() .getResourceAsStream("/mydirectory/filename"); Or URL url = Thread.currentThread().getContextClassLoader() .getResource("/mydirectory/filename"); Or InputStream is = Thread.currentThread().getContextClassLoader() .getResourceAsStream("/mydirectory/filename"); / will be used to browse inside the directories.
downvote count: 0
answers question: http://stackoverflow.com/q/25566691
upvote count: 1

http://stackoverflow.com/q/25707768
tagged with: jquery
tagged with: ajax
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25707848
tagged with: file-upload
favorite count: 0
type: Question
has body: I wanna send an image through ajax but I get the following exception: org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is false surprisingly when I send this form regularly(not through ajax) form works fine.I tried changing Content-Type to multipart/form-data but then I get this exception: org.apache.commons.fileupload.FileUploadException: the request was rejected because no multipart boundary was found here is the jquery code: $(document).ready(function() { $("#myform").submit(function(e) { e.preventDefault(); var data = new FormData(); data.append('file', document.formName.file.files[0]); // &lt;-- possibly this line doesn't work $.ajax({ url: 'upload.do', data: data, cache: false, contentType: false, processData: false, type: 'POST', success: function(res) { } }); }); }); and the form: &lt;form name="formName" enctype="multipart/form-data" id="myform" action="upload.do" method="POST"&gt; &lt;input type="file" name="file" id="input-file" /&gt; &lt;br&gt; &lt;input type="submit" value="Upload images" class="upload" /&gt; &lt;/form&gt;
type: UnansweredQuestion
has title: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is false
tagged with: javascript

http://stackoverflow.com/q/25648371
tagged with: eclipse
has answer: http://stackoverflow.com/a/25648585
type: Question
tagged with: fuzzy-logic
downvote count: 4
upvote count: 0
type: UnansweredQuestion
answer count: 1
has title: Testing Fuzzy Logic
has body: I have a problem to testing my fuzzy logic on Java programming either right or wrong. Do you have any simple source code to test it. May you share to me, please. Kindly need your help. Thank you so much. Best Regards, Deni Y.
score: -4
favorite count: 0
tagged with: network-programming
tagged with: java

http://stackoverflow.com/q/25587409
type: Question
has body: I am learning dependency injection with Guice. I'm trying to understand if there is a recommended way to implement static class constants when programming with a dependency injection framework. Huracan class first version: public class Huracan implements Car { public static final URL COMPANY_URL; public static final String CAR_TYPE = "sports car"; static { try { COMPANY_URL = new URL("www.lamborghini.com"); } catch (MalformedURLException e) { e.printStackTrace(); throw new Error(e); } } public void drive() { System.out.println("Lamborghini Huracan " + CAR_TYPE + " driving!" ); } } I can create a module - HuracanModule - and there I can use bindConstant and bind toInstance for the binding and remove the static constants declarations from the Huracan class. Guice Huracan module: public class HuracanModule extends AbstractModule { @Override protected void configure() { bindConstant().annotatedWith(Names.named("cars.huracan.cartype")).to("sports car"); bind(URL.class).annotatedWith(Names.named("cars.huracan.company_url")). toInstance(new URL("www.lamborghini.com")); } } Huracan class second version: public class Huracan implements Car { private final String CAR_TYPE; private final URL COMPANY_URL; public Huracan( @Named("cars.huracan.cartype") String carType, @Named("cars.huracan.comany_url") URL companyUrl ) { this.CAR_TYPE = carType; this.COMPANY_URL = companyUrl; } public void drive() { System.out.println("Lamborghini Huracan " + CAR_TYPE + " driving!" ); } } I understand that this gives you the flexibility to manipulate the constants in different scenarios. But I am feeling I am missing something. Is this the right programming model ? Is there suppose to be a Guice model for every class you want to store static constants ? Or create only one giant main app module for everything ? What is the semantic correlation between a module and a class ? With using static constants declaration on the class, the burden of knowing how to refer to them uniquely is handled by the p…
accepted answer: http://stackoverflow.com/a/25590780
tagged with: static
has answer: http://stackoverflow.com/a/25590780
tagged with: dependency-injection
tagged with: guice
type: AnsweredQuestion
tagged with: constants
score: 2
has title: How to implement a class constant static fields declarations with dependency injection pattern
upvote count: 2
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40090657
type: QuestionComment
has text: @Slavic unfortunately, they exist
score: 0
comment on: http://stackoverflow.com/q/25655366
type: Comment

http://stackoverflow.com/comment/39919257
has text: i will try other format and post result
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25562479

http://stackoverflow.com/q/25701892
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40174104
has comment: http://stackoverflow.com/comment/40174073
has title: Eclipse Plugin-Project bundle cannot be resolved
has body: I checked out an Eclipse Plugin-Project from GitHub and wanted to start it (and edit, but that is not the focus). But in the MANIFEST.MF it says Bundle 'org.apache.log4j' cannot be resolved and some other missing bundle messages. I know that I have to download the bundle version of log4j, which I have done from here. After that, I created a new folder and added a new target directory linking to this folder. But I still got the message that the bundle is missing in the manifest file. What am I doing wrong?
linked to: http://stackoverflow.com/q/8285745
has comment: http://stackoverflow.com/comment/40174162
score: 0
duplicate of: http://stackoverflow.com/q/8285745
tagged with: java
tagged with: bundle
tagged with: resolve
tagged with: eclipse
tagged with: eclipse-plugin
type: Question
has comment: http://stackoverflow.com/comment/40174247
answer count: 0
has comment: http://stackoverflow.com/comment/40174049

http://stackoverflow.com/comment/40156041
type: AnswerComment
score: 0
has text: Would I be able to make it change it back to the default color on a click of the button?
comment on: http://stackoverflow.com/a/25691944
type: Comment

http://stackoverflow.com/comment/42115918
type: Comment
has text: Excellent post but I believe this was first shipped with Solr 4.8.0.
comment on: http://stackoverflow.com/a/25625696
score: 0
type: AnswerComment

http://stackoverflow.com/a/25624897
downvote count: 0
has body: Simply answer. Never use maven plugins as dependencies cause they do not belong to dependencies. That's the reason why got those strange artifacts in your build.
upvote count: 8
type: Answer
score: 8
answers question: http://stackoverflow.com/q/25615330

http://stackoverflow.com/a/25642954
answers question: http://stackoverflow.com/q/25642691
type: Answer
score: 0
has body: You could do this programmatically by float density = getResources().getDisplayMetrics().density; This will give you: 0.75 - ldpi 1.0 - mdpi 1.5 - hdpi 2.0 - xhdpi 3.0 - xxhdpi 4.0 - xxxhdpi Source Then check the density and act accordingly: if (density &gt;= 2.0) { textView.setTypeface(Typeface.SANS_SERIF); } else { textView.setTypeface(Typeface.SANS_SERIF,Typeface.BOLD); }

http://stackoverflow.com/a/25671687
has comment: http://stackoverflow.com/comment/40118619
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40118775
has body: From the Android documentation: final Button button = (Button) findViewById(R.id.button_id); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { final CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox_id); if (checkBox.isChecked()) { // display toast1 } else { // display toast2 } } }); Is that what you're looking for? https://developer.android.com/reference/android/widget/CheckBox.html
type: Answer
answers question: http://stackoverflow.com/q/25671600
has comment: http://stackoverflow.com/comment/40120487
score: 0

http://stackoverflow.com/q/25694243
tagged with: batch-file
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/40169100
upvote count: 1
type: UnansweredQuestion
score: 1
has title: Eclipse: ant exec .bat file not stopping
tagged with: java
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40169151
tagged with: ant
tagged with: windows
tagged with: eclipse
has body: I'm using an ant build script to compile some java classes, create a .jar file and place the classes into it, and then run a batch file using ant's exec command. The .bat file uses the .jar file to execute several java classes. The command line output from running the .bat file shows in the Eclipse output window, but when I hit the stop button in Eclipse, it doesn't stop executing. It stops showing command line output in Eclipse, but the processes controlled by the batch file will continue until it reaches the end of all processes. Here's my ant script; <project name="myProject" default="all"> <property name="app.name" value="myProject"/> <include name="**/*.jar"/> <exclude name="**/*.properties"/> <taskdef name="javac" classname="org.apache.tools.ant.taskdefs.Javac" classpathref="classpath"/> <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="classpath"/> <mkdir dir="${build}"/> <mkdir dir="${target}"/> <delete dir="${classes}"/> <mkdir dir="${build}"/> <mkdir dir="${target}/lib"/> <include name="*.jar"/> <exclude name="junit*"/> <include name="**/*.class"/> <include name="${app.name}.jar"/> <exclude name="junit*"/> <arg line="/c myBatchFile.bat"/> How can I stop this from executing, other than waiting for it to finish?

http://stackoverflow.com/comment/40134163
has text: That is precisely what I meant!
type: Comment
comment on: http://stackoverflow.com/a/25662719
score: 0
type: AnswerComment

http://stackoverflow.com/comment/53110506
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25602210
has text: I have a similar problem (exact same code actually) however "item" is null all the time. Anybody know why this is?
type: Comment

http://stackoverflow.com/comment/41019785
comment on: http://stackoverflow.com/q/25646440
type: Comment
type: QuestionComment
has text: Try to set some text to Target textview.
score: 0

http://stackoverflow.com/q/25552730
possible better answer: http://stackoverflow.com/a/25552954
tagged with: java
has answer: http://stackoverflow.com/a/25552900
has answer: http://stackoverflow.com/a/25552906
accepted answer: http://stackoverflow.com/a/25552906
favorite count: 0
type: Question
has title: JAVA: are the notion of subtyping and of inheritance the same thing?
upvote count: 5
score: 5
downvote count: 0
answer count: 5
has answer: http://stackoverflow.com/a/25552954
tagged with: inheritance
linked to: http://stackoverflow.com/q/6056124
has answer: http://stackoverflow.com/a/25552861
tagged with: subtyping
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25553726
has body: Based on the note at the end of this answer it looks like subtyping and inheritance are subtly different concepts in Java. What is it? Is inheritance only when a class declaration contains an extends ... clause? If this is the case then a class will not inherit from Object, even if it is a subtype of it, right?

http://stackoverflow.com/comment/39981078
has text: What if an error is needed if the user says "true", "affirmative", or something other than "yes" that isn't "no"?
score: 0
comment on: http://stackoverflow.com/a/25595866
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25597953
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25597424
has comment: http://stackoverflow.com/comment/40130510
has body: Instead of clicking the "Fully Qualified Name" item in the popup, you can simply use its shortcut, Y, when menu is shown. See letter Y underlined on screenshot in Dollyn's answer.

http://stackoverflow.com/comment/40045847
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25630906
has text: @NiteShaed-No,it's not deprectaed,it might be that those are not getting used anywhere OR not running even for once in the program. Andreas comment was for humour,you mustn't feel it as deprecated,it is fine and there is somewhere logic error!

http://stackoverflow.com/comment/40067206
has text: And what is the pure html pendant of `<form:select id="cbox" path="country" items="${countrylist}" />`? Please replace this line with the html pendant in your post.
type: QuestionComment
comment on: http://stackoverflow.com/q/25643264
score: 0
type: Comment

http://stackoverflow.com/comment/40136583
has text: @jilen please give an idea to achieve above scenario...
score: 0
comment on: http://stackoverflow.com/q/25659195
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40069323
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25643995
has text: It worked but I got a nullpointerException now? :) Also pleae upvote so i can upvote people that answers my question. Thanks
score: 0

http://stackoverflow.com/q/25599991
has comment: http://stackoverflow.com/comment/39988589
has answer: http://stackoverflow.com/a/25600335
has comment: http://stackoverflow.com/comment/39988534
has answer: http://stackoverflow.com/a/25600162
has comment: http://stackoverflow.com/comment/39988825
answer count: 4
has comment: http://stackoverflow.com/comment/39988766
has comment: http://stackoverflow.com/comment/39988827
has comment: http://stackoverflow.com/comment/39988622
score: 1
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39988833
has body: From my understanding, this is an example of variable declaration: int variable; and this is an example of variable initialization: variable = 2; Together, we can both declare and initialize a variable as such: int variable = 2; For methods, we have similar constructs: abstract int method(int param); and int method (int param) { return param; } but instead we call the former a method prototype and the latter a declaration. Edit: Another example would be as follows: static int differentMethod(int param); public static void main (String[] args) { ... } static int differentMethod(int param) { ... } Edit 2: Ignore the example immediately above as it's not supported in Java (but something similar exists in C). Is there such a thing as method initialization?
upvote count: 1
has title: Is there such a thing as method initialization?
favorite count: 0
has comment: http://stackoverflow.com/comment/39988660
type: Question
linked to: http://stackoverflow.com/q/122407
has answer: http://stackoverflow.com/a/25600146
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25600384
has comment: http://stackoverflow.com/comment/39988680

http://stackoverflow.com/comment/40134222
type: Comment
comment on: http://stackoverflow.com/q/25679653
score: 0
type: QuestionComment
has text: And as you say it has nothing to do with weblaf as the running example uses Nimbus.

http://stackoverflow.com/q/25635434
accepted answer: http://stackoverflow.com/a/25636581
tagged with: spring
tagged with: spring-security
has answer: http://stackoverflow.com/a/25636581
tagged with: spring-mvc
type: AnsweredQuestion
has body: I have a quick question in regards to Spring Security and obtaining further information(Instance variables) for the current logged in User. By default, without the necessity to write your own UserDetailsService Is there a way to obtain any of the other instance variables that are defined within my User bean? As you're probably aware by placing the following code in one of my controllers I have access to the following fields such as: Username, password, enabled, authorities, etc. UserDetails userDetails = (UserDetails) ((Authentication)principal).getPrincipal(); I would like to obtain other information such as the following instance variables I have defined in my User object (ID, NAME, EMAIL, ETC): // Instance Variables private int id; private String name; private String email; private String username; // I can already obtain this private String password; // I can already obtain this Could you please provide some further assistance in way which I can get more information?
score: 0
has answer: http://stackoverflow.com/a/25635535
tagged with: java
possible better answer: http://stackoverflow.com/a/25635535
type: Question
answer count: 2
has title: Spring Security User Information

http://stackoverflow.com/comment/39964101
score: 0
has text: Thanks JB, this is pushing me in the right direction. I've got this now, and what happens is it returns ALL ParentClasses if no child has testField = '1', and NONE if any do. Do you know how I would go about applying this on an individual level to each ParentClass?
type: Comment
comment on: http://stackoverflow.com/a/25584981
type: AnswerComment

http://stackoverflow.com/comment/39962402
type: Comment
score: 0
type: QuestionComment
has text: Just a few questions for clarification: Is this for homework or is this for a personal project? If for homework, usually there will be stipulations and rules regarding what can and cannot be done code-wise. Have you gone through a basic Java textbook or the main sections of an intro to Java tutorial yet, to enable you to understand fully what are classes, methods, variables, the differences between static and instance fields and methods? This is important as it will allow us to know what you need help in and what you already know.
comment on: http://stackoverflow.com/q/25585365

http://stackoverflow.com/q/25590205
has comment: http://stackoverflow.com/comment/39970703
accepted answer: http://stackoverflow.com/a/25593374
has comment: http://stackoverflow.com/comment/39970770
has answer: http://stackoverflow.com/a/25593374
tagged with: sax
has comment: http://stackoverflow.com/comment/39970762
possible better answer: http://stackoverflow.com/a/25590355
has answer: http://stackoverflow.com/a/25591979
has answer: http://stackoverflow.com/a/25590355
type: AnsweredQuestion
answer count: 3
has title: How to efficiently make a large XML file searchable in a web application?
upvote count: 2
score: 1
linked to: http://stackoverflow.com/q/7521803
tagged with: java
has body: I have an XML document and I need to make it searchable via a webapp. The document is currently only 6mb.. but could be extrememly large, thus from my research SAX seems the way to go. So my question is, given a search term do I: Do I load the document in memory once (into a list of beans and then store it in memory)? And then search it when need be? or Parse the document looking for the desired search term and only add the matches to the list of beans? And repeat this process with each search? I am not that experienced with webapps, but I am trying to figure out the optimal way to approach this, does anyone with Tomcat, SAX and Java Web apps have any suggestions as to which would be optimum? Regards, Nate
has comment: http://stackoverflow.com/comment/39970893
downvote count: 1
has comment: http://stackoverflow.com/comment/39970721
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question

http://stackoverflow.com/comment/40006065
type: Comment
score: 0
type: AnswerComment
has text: It is difficult because i have more than 100 files which is difficult to remove all the commas
comment on: http://stackoverflow.com/a/25609216

http://stackoverflow.com/comment/61684699
comment on: http://stackoverflow.com/a/25709312
type: Comment
has text: Great example for a complete jaxb application! Helped me to solve a different problem and to improve my UnitTests. Thanks for sharing!
type: AnswerComment
score: 1

http://stackoverflow.com/a/25598592
has body: Its correct as indicated by Blorgbeard "The sum of the first 1000 primes" is not the same as "the sum of all primes which are &lt;= 1000". In your case the main is calculating sum of first 168 prime numbers. You need to rewrite the main as following to get the sum of first 1000 prime numbers: public static void main(String args[]){ int number = 2; int count = 0; long sum = 0; while(count &lt; 1000){ if(isPrime(number)){ sum += number; count++; } number++; } System.out.println(sum); } Output: 3682913
upvote count: 6
type: Answer
has comment: http://stackoverflow.com/comment/39986200
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/25598497

http://stackoverflow.com/comment/40194230
comment on: http://stackoverflow.com/q/25708724
type: QuestionComment
has text: Do you have property SenderID in other entities? Read this: https://hibernate.atlassian.net/browse/HHH-5836
type: Comment
score: 0

http://stackoverflow.com/a/62793274
answers question: http://stackoverflow.com/q/25683537
has body: for restarting application you can use below code Runtime.getRuntime().exec("java -jar myApp.jar"); System.exit(0); in netbeans platform application you can use this command LifecycleManager.getDefault().markForRestart(); LifecycleManager.getDefault().exit();
type: Answer
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/40071451
type: Comment
has text: Not applicable. OP needs in ImageView's Click which is individual View of List Row. Not complete ListRow's Click.
type: AnswerComment
comment on: http://stackoverflow.com/a/25645618
score: 1

http://stackoverflow.com/a/25661026
accepted answer of: http://stackoverflow.com/q/25660969
type: AcceptedAnswer
has body: your first command is correct, you need to do this. // if suggested path does not exists if(!dir.exists()){ file.mkdirs(); // make the required stucture. }
downvote count: 0
score: 3
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/25660969

http://stackoverflow.com/q/25551141
tagged with: jstl
upvote count: 2
type: UnansweredQuestion
has body: I want to do an if statement in a JSP tag so if the previous URL sting is = 0 or empty then don't display something. Im trying to use refererPAge but its not working. Can anybody help. I cant even get it to display the previous URL &lt;c:set var="refererPage" scope="request" value="${request.getHeader}"/&gt; &lt;c:out value="${refererPage}"/&gt; ${refererPage} Thanks
answer count: 1
tagged with: url
downvote count: 0
tagged with: jsp
has title: Get previous URL in a JSP tag
favorite count: 0
tagged with: get
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/39897606
has comment: http://stackoverflow.com/comment/39898335
has comment: http://stackoverflow.com/comment/39898002
has answer: http://stackoverflow.com/a/25562274
has comment: http://stackoverflow.com/comment/39897823
has comment: http://stackoverflow.com/comment/39898796
type: Question
has comment: http://stackoverflow.com/comment/39897919

http://stackoverflow.com/comment/39961238
has text: Don't you have a stack trace?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25560383
type: Comment

http://stackoverflow.com/comment/40014130
type: QuestionComment
has text: Example added @BoratSagdiyev
score: 0
comment on: http://stackoverflow.com/q/25613927
type: Comment

http://stackoverflow.com/a/25663935
has body: If your main goal is to broadcast information you might also use the OSGi Event Admin, felix has a quick tutorial as well. Handling your own listeners via Services might be considered harmful.
has comment: http://stackoverflow.com/comment/40124381
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25657257
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25657257
score: 2

http://stackoverflow.com/comment/39938924
score: 0
has text: Can't you pass them as arguments during the Runtime.exec call?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25572808

http://stackoverflow.com/q/25581886
has answer: http://stackoverflow.com/a/25582051
type: Question
tagged with: exception
tagged with: java
has title: when throw new Error() is written in try block why catch block is not executed .it go in finally only .Latter code also not executed
answer count: 5
has answer: http://stackoverflow.com/a/25582098
has body: Example bellow a program ,where in try block defectedCode() method is called ,So why only output shown only C with "Exception in thread "main" java.lang.Error". public class ExceptionTest { public static void defectedCode(){ throw new Error(); } public static void main(String args[]){ try{ defectedCode(); System.out.println("A"); }catch(Exception e){ System.out.println("B"); }finally{ System.out.println("C"); } System.out.print("D"); } } Exception in thread "main" java.lang.Error C at ExceptionTest.defectedCode(ExceptionTest.java:15) at ExceptionTest.main(ExceptionTest.java:21) Java Result: 1
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/25582049
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33981299
has answer: http://stackoverflow.com/a/25582046
favorite count: 0

http://stackoverflow.com/q/25553069
downvote count: 0
tagged with: file
upvote count: 1
has answer: http://stackoverflow.com/a/25553296
has comment: http://stackoverflow.com/comment/39902775
accepted answer: http://stackoverflow.com/a/25553296
type: AnsweredQuestion
has title: Write file in java to src directory
has answer: http://stackoverflow.com/a/25553411
possible better answer: http://stackoverflow.com/a/25553411
has body: I am writing a few files with test results with Java, that I want to check into source control. The closest method I have found to do this is: myclass.class.getProtectionDomain().getCodeSource().getLocation().getPath()) Which will write the file to the class directory in the build. Is there a trick/quick way that I could write the file to the path that the class is in in the development src folder, rather than the build directory?
score: 1
tagged with: java
favorite count: 0
type: Question
answer count: 2

http://stackoverflow.com/comment/40149417
type: QuestionComment
has text: Tried adding a dummy DISPLAY env var to /etc/environments, did not help...
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25688241

http://stackoverflow.com/comment/39971305
score: 0
comment on: http://stackoverflow.com/a/25565491
type: Comment
type: AnswerComment
has text: Ok thanks for clarifying, I'm accepting this answer then because I wasn't sure if there are other implications with flatMap if I just have single objects as the type (no collections).

http://stackoverflow.com/comment/40175652
type: Comment
type: QuestionComment
score: 0
has text: Does that need to be a string value?
comment on: http://stackoverflow.com/q/25702758

http://stackoverflow.com/a/25615795
has body: That looks fine, did you type in the right values in your textfield before you tested it? Per example if you leave it empty or type in "1,3" it wouldn't probably accept it. Edited: I just did a test and as I said, it only accepts values like this: "1.3" import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; public class MyApp extends JFrame implements ActionListener { JTextField textField; JLabel label; JButton okButton; public MyApp() { textField = new JTextField(4); label = new JLabel("N/A"); okButton = new JButton("Ok"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); setLayout(new BorderLayout()); add(textField, BorderLayout.NORTH); add(label, BorderLayout.CENTER); add(okButton, BorderLayout.SOUTH); okButton.addActionListener(this); pack(); } public static void main(String[] args) { MyApp app = new MyApp(); app.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource() == okButton) { double d = 0; d = Double.parseDouble(textField.getText()); label.setText(String.valueOf(d)); } } }
has comment: http://stackoverflow.com/comment/40038062
has comment: http://stackoverflow.com/comment/40017629
has comment: http://stackoverflow.com/comment/40017749
has comment: http://stackoverflow.com/comment/40017650
has comment: http://stackoverflow.com/comment/40017700
has comment: http://stackoverflow.com/comment/40017547
has comment: http://stackoverflow.com/comment/40019372
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25615754

http://stackoverflow.com/q/25562613
downvote count: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25637051
has body: I am using BC to encrypt and sign an SMIME message for use with AS2. The code we have works fine with an absolutely ancient version of bouncy castle, bcmail-1.4:125. Upgrading to anything newer causes the receiver of the message (not too ancient Cyclone server) to fail to verify the message. (e.g. the earliest v in maven causes this too. These are the versions without API changes (e.g. 1.38). Since we use JDK 1.7 (and 1.8), I've been trying to update this to a newer version of BC, java-mail, etc. I've upgraded all of bouncy castle to bcmail-jdk15on:1.51 and bcprov-jdk15on:1.51, along with java mail, and followed the examples in the bcmail package. However, I am still getting an error from Cyclone saying integrity-check-failed. I am fairly certain the error is with how I am doing signing. When I disable signing and only use encryption it processes correctly. Also, I can correctly receive a signed response from the remote server and verify the signature, which is how I get the error message out (from content-disposition on the MimeMultiPart). The certificates are created by openssl/self signed/etc, stored in pkcs12 file Unlimited strength policies are in place senderKey is a BCRSAPrivateCrtKey senderCert org.bouncycastle.jcajce.provider.asymmetric.x509.X509CertificateObject Failing: The current code is this, using bcmail-jdk15on:1.51 &amp; etc SMIMESignedGenerator gen = new SMIMESignedGenerator(); gen.addSignerInfoGenerator(new JcaSimpleSignerInfoGeneratorBuilder() .setProvider("BC") .build("SHA1withRSA", senderKey, senderCert)); // gen.addCertificates(new JcaCertStore(list(senderCert))); old v. doesn't add certs MimeMultipart smime = gen.generate(part); // MimeBodyPart passed in to function MimeBodyPart tmpBody = new MimeBodyPart(); tmpBody.setContent(signedData); tmpBody.setHeader("Content-Type", signedData.getContentType() Previously working code looks like this and uses bcmail-1.4:1.25. Upgrading to 1.3x also causes a failure on the other end when decrypting (irre…
accepted answer: http://stackoverflow.com/a/25637051
favorite count: 0
type: Question
score: 5
upvote count: 5
has title: SMIME can't be validated by receiver when using newer version of Bouncy Castle
tagged with: encryption
tagged with: smime
type: AnsweredQuestion

http://stackoverflow.com/q/25674947
tagged with: jpanel
has answer: http://stackoverflow.com/a/25691384
accepted answer: http://stackoverflow.com/a/29439418
has title: Scrolling limitation with JScrollPane and JViewport maximum sizes smaller than contents
linked to: http://stackoverflow.com/q/2561480
favorite count: 0
has answer: http://stackoverflow.com/a/29439418
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/40148579
has comment: http://stackoverflow.com/comment/40124986
has comment: http://stackoverflow.com/comment/40128660
downvote count: 0
tagged with: swing
linked to: http://stackoverflow.com/q/25526833
linked to: http://stackoverflow.com/q/19167154
linked to: http://stackoverflow.com/q/1796578
has comment: http://stackoverflow.com/comment/40147824
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7156949
has comment: http://stackoverflow.com/comment/40148509
tagged with: jscrollpane
has comment: http://stackoverflow.com/comment/40125185
possible better answer: http://stackoverflow.com/a/25691384
has body: I have a JFrame containing a JScrollPane containing a JPanel. The JPanel contains a bunch of JTextAreas. I'm loading a lot of text into them (about 8k-10k characters). The layout works fine, though the scrolling is a bit laggy. The real issue is that it seems JPanel, JScrollPane and JViewport have a hard 32767 size limit, so when any JTextArea grows higher than that, it can't be scrolled any further to show the last 1/3 of the text. Below you can see a minimal example for the problem. I used the NetBeans JFrame designer so it might be a bit lengthy but the only thing I have changed from the defaults is that the JTextAreas are direct children of the JPanel, the scrollbar policies, and slightly larger font size: public class NewJFrame extends javax.swing.JFrame { /** * Creates new form NewJFrame */ public NewJFrame() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jPanel1 = new javax.swing.JPanel(); jTextArea1 = new javax.swing.JTextArea(); jTextArea2 = new javax.swing.JTextArea(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); jTextArea1.setColumns(20); jTextArea1.setFont(new java.awt.Font("Monospaced", 0, 14)); // NOI18N jTextArea1.setRows(5); jTextArea2.setColumns(20); jTextArea2.setFont(new java.awt.Font("Monospaced", 0, 14)); // NOI18N jTextArea2.setRows(5); jTextArea2.setText("Some long text..."); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout…
score: 3
tagged with: jviewport
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/40143125
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25685105
type: Comment
has text: i wonder why it would print 14,it would print 8.Also Class B method are not overriding class A method

http://stackoverflow.com/comment/39920248
type: QuestionComment
comment on: http://stackoverflow.com/q/25563131
has text: Please add your SQL query to the question.
score: 0
type: Comment

swing
tags question: http://stackoverflow.com/q/25669485
tags question: http://stackoverflow.com/q/25658482
tags question: http://stackoverflow.com/q/25574261
tags question: http://stackoverflow.com/q/25664083
tags question: http://stackoverflow.com/q/25593719
tags question: http://stackoverflow.com/q/25554137
tags question: http://stackoverflow.com/q/25646891
tags question: http://stackoverflow.com/q/25584656
tags question: http://stackoverflow.com/q/25708775
tags question: http://stackoverflow.com/q/25569770
tags question: http://stackoverflow.com/q/25615366
tags question: http://stackoverflow.com/q/25687660
tags question: http://stackoverflow.com/q/25606647
tags question: http://stackoverflow.com/q/25560057
tags question: http://stackoverflow.com/q/25610393
tags question: http://stackoverflow.com/q/25635601
tags question: http://stackoverflow.com/q/25683630
tags question: http://stackoverflow.com/q/25602465
tags question: http://stackoverflow.com/q/25672489
tags question: http://stackoverflow.com/q/25623481
tags question: http://stackoverflow.com/q/25676893
tags question: http://stackoverflow.com/q/25652405
tags question: http://stackoverflow.com/q/25700517
tags question: http://stackoverflow.com/q/25688330
tags question: http://stackoverflow.com/q/25643657
tags question: http://stackoverflow.com/q/25594005
tags question: http://stackoverflow.com/q/25584275
tags question: http://stackoverflow.com/q/25563645
tags question: http://stackoverflow.com/q/25578334
tags question: http://stackoverflow.com/q/25650558
tags question: http://stackoverflow.com/q/25647509
tags question: http://stackoverflow.com/q/25665353
tags question: http://stackoverflow.com/q/25620286
tags question: http://stackoverflow.com/q/25577856
tags question: http://stackoverflow.com/q/25649950
tags question: http://stackoverflow.com/q/25657330
tags question: http://stackoverflow.com/q/25626749
tags question: http://stackoverflow.com/q/25581190
tags question: http://stackoverflow.com/q/25641324
tags question: http://stackoverflow.com/q/25607935
tags question: http://stackoverflow.com/q/25613743
tags question: http://stackoverflow.com/q/25697170
tags question: http://stackoverflow.com/q/25690498
tags question: http://stackoverflow.com/q/25646236
tags question: http://stackoverflow.com/q/25591323
tags question: http://stackoverflow.com/q/25571553
tags question: http://stackoverflow.com/q/25662658
tags question: http://stackoverflow.com/q/25598282
tags question: http://stackoverflow.com/q/25605145
tags question: http://stackoverflow.com/q/25672632
tags question: http://stackoverflow.com/q/25560383
tags question: http://stackoverflow.com/q/25693227
tags question: http://stackoverflow.com/q/25671865
tags question: http://stackoverflow.com/q/25564651
tags question: http://stackoverflow.com/q/25710812
tags question: http://stackoverflow.com/q/25624435
tags question: http://stackoverflow.com/q/25592718
tags question: http://stackoverflow.com/q/25594207
tags question: http://stackoverflow.com/q/25593949
tags question: http://stackoverflow.com/q/25556339
tags question: http://stackoverflow.com/q/25621964
tags question: http://stackoverflow.com/q/25558826
tags question: http://stackoverflow.com/q/25657304
tags question: http://stackoverflow.com/q/25605594
tags question: http://stackoverflow.com/q/25579480
tags question: http://stackoverflow.com/q/25640276
tags question: http://stackoverflow.com/q/25691653
tags question: http://stackoverflow.com/q/25708867
tags question: http://stackoverflow.com/q/25688335
tags question: http://stackoverflow.com/q/25591476
tags question: http://stackoverflow.com/q/25638602
tags question: http://stackoverflow.com/q/25583002
tags question: http://stackoverflow.com/q/25699010
tags question: http://stackoverflow.com/q/25643167
tags question: http://stackoverflow.com/q/25652010
tags question: http://stackoverflow.com/q/25691914
tags question: http://stackoverflow.com/q/25614814
tags question: http://stackoverflow.com/q/25690473
tags question: http://stackoverflow.com/q/25675474
tags question: http://stackoverflow.com/q/25554060

http://stackoverflow.com/comment/40107675
type: QuestionComment
comment on: http://stackoverflow.com/q/25662046
score: 0
has text: You should edit your question title as well, because it's very misleading. If I understand you correctly, you want to know if it's possible to batch-update tables in a single statement. Which is more an `SQL` question in my opinion. But anyway, you should write that in the title as well, because many will only see the title and you might get more/better answers with a better title.
type: Comment

http://stackoverflow.com/comment/39961485
type: AnswerComment
has text: and also i do not see any connection of my question and reading blocking or non-blocking.
type: Comment
comment on: http://stackoverflow.com/a/25570774
score: 0

http://stackoverflow.com/comment/39964712
score: 0
comment on: http://stackoverflow.com/q/25586828
type: Comment
type: QuestionComment
has text: @user230137 And how does that find the first occurrence?

javascript
tags question: http://stackoverflow.com/q/25568863
tags question: http://stackoverflow.com/q/25583706
tags question: http://stackoverflow.com/q/25697916
tags question: http://stackoverflow.com/q/25672414
tags question: http://stackoverflow.com/q/25681961
tags question: http://stackoverflow.com/q/25656710
tags question: http://stackoverflow.com/q/25559883
tags question: http://stackoverflow.com/q/25676748
tags question: http://stackoverflow.com/q/25603191
tags question: http://stackoverflow.com/q/25580134
tags question: http://stackoverflow.com/q/25638322
tags question: http://stackoverflow.com/q/25599275
tags question: http://stackoverflow.com/q/25702424
tags question: http://stackoverflow.com/q/25601315
tags question: http://stackoverflow.com/q/25685383
tags question: http://stackoverflow.com/q/25707768
tags question: http://stackoverflow.com/q/25598729
tags question: http://stackoverflow.com/q/25598745
tags question: http://stackoverflow.com/q/25604657
tags question: http://stackoverflow.com/q/25640080
tags question: http://stackoverflow.com/q/25563201
tags question: http://stackoverflow.com/q/25707202
tags question: http://stackoverflow.com/q/25591963
tags question: http://stackoverflow.com/q/25654178
tags question: http://stackoverflow.com/q/25661941
tags question: http://stackoverflow.com/q/25607559
tags question: http://stackoverflow.com/q/25681071
tag name: javascript
tags question: http://stackoverflow.com/q/25592901
tags question: http://stackoverflow.com/q/25604470
tags question: http://stackoverflow.com/q/25589524
tags question: http://stackoverflow.com/q/25557516
tags question: http://stackoverflow.com/q/25603306
tags question: http://stackoverflow.com/q/25641000
tags question: http://stackoverflow.com/q/25594289
tags question: http://stackoverflow.com/q/25703534
tags question: http://stackoverflow.com/q/25698147
tags question: http://stackoverflow.com/q/25555512
tags question: http://stackoverflow.com/q/25627192
tags question: http://stackoverflow.com/q/25658554
tags question: http://stackoverflow.com/q/25665322
tags question: http://stackoverflow.com/q/25621751
tags question: http://stackoverflow.com/q/25575605
tags question: http://stackoverflow.com/q/25616035
tags question: http://stackoverflow.com/q/25634710
tags question: http://stackoverflow.com/q/25637835
tags question: http://stackoverflow.com/q/25624458
tags question: http://stackoverflow.com/q/25660400
tags question: http://stackoverflow.com/q/25602773
tags question: http://stackoverflow.com/q/25644310
tags question: http://stackoverflow.com/q/25643264
tags question: http://stackoverflow.com/q/25689103
tags question: http://stackoverflow.com/q/25604644
tags question: http://stackoverflow.com/q/25681442
tags question: http://stackoverflow.com/q/25685304
tags question: http://stackoverflow.com/q/25704694
type: Tag
tags question: http://stackoverflow.com/q/25687635
tags question: http://stackoverflow.com/q/25653020
tags question: http://stackoverflow.com/q/25570454
tags question: http://stackoverflow.com/q/25629105
tags question: http://stackoverflow.com/q/25686323
tags question: http://stackoverflow.com/q/25602117
tags question: http://stackoverflow.com/q/25591247
tags question: http://stackoverflow.com/q/25671325

http://stackoverflow.com/q/25613396
has answer: http://stackoverflow.com/a/25613435
tagged with: java
has title: how to make sure a method is called first before others in java
has answer: http://stackoverflow.com/a/25613662
answer count: 4
downvote count: 7
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25613433
upvote count: 2
type: UnansweredQuestion
has body: I wrote a car program that has four methods accelerate,brake,gear and start, and I want to make sure the start method is called first before any of the other three methods are called.pls how should I do this.
has comment: http://stackoverflow.com/comment/40013088
has answer: http://stackoverflow.com/a/25613466
score: -5
has comment: http://stackoverflow.com/comment/40013046

http://stackoverflow.com/comment/40082694
has text: And scala.Boolean can't be used from Java, so the type Java sees _is_ Option<Object> unfortunately.
comment on: http://stackoverflow.com/a/25611968
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25605676
has answer: http://stackoverflow.com/a/25605813
type: Question
has answer: http://stackoverflow.com/a/41415958
has title: What is the difference between layout and activity?
answer count: 5
tagged with: layout
has answer: http://stackoverflow.com/a/25605771
has comment: http://stackoverflow.com/comment/39999625
score: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/25605813
has body: I have some problems with the layout and activity and I don't know are they different,are they related? I think the layout is a place we can add or remove our views and activity is just a place that shows any thing in our layout, is this true?
possible better answer: http://stackoverflow.com/a/41415958
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25605883
downvote count: 3
tagged with: android
upvote count: 7
tagged with: java
has comment: http://stackoverflow.com/comment/39999235
has answer: http://stackoverflow.com/a/54054597

http://stackoverflow.com/comment/40004422
score: 0
has text: You should also create and open your filewriter before the loop begins, and then close it once the loop has finished
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25608650

http://stackoverflow.com/comment/40119145
score: 0
type: Comment
has text: @AaronF In that case why there is "removing" in "*I want to loop through the text, **removing** blocks of whitespace and blocks of non-whitespace*"? Did you perhaps want to write "separating"?
comment on: http://stackoverflow.com/a/25671873
type: AnswerComment

http://stackoverflow.com/q/25567806
tagged with: rest
has body: I am to use Dependency Injection of Spring framework version 4. I have seen that the Jersey has its DI with plugin org.glassfish.jersey.ext jersey-spring3 2.12 Is Jersey's DI of Spring recommended or is there special reason to use it? What if Spring 4 DI is used independently ? Also please let me know any step by step learning source to integration Spring DI with Jersey ?
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/21443088
favorite count: 0
type: Question
tagged with: jakarta-ee
answer count: 2
tagged with: jersey
accepted answer: http://stackoverflow.com/a/25572473
has answer: http://stackoverflow.com/a/45914270
downvote count: 0
has answer: http://stackoverflow.com/a/25572473
upvote count: 1
tagged with: spring
has title: Jersey with Spring 4 Dependency Injection
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/45914270

http://stackoverflow.com/q/25592265
type: Question
has body: I wrote a simple server in Java, but I have a problem. The code responsible for sending responses to browsers looks like this: PrintWriter out = new PrintWriter(new OutputStreamWriter(this._client.getOutputStream(), StandardCharsets.UTF_8), true); out.write("HTTP/1.1 200 OK\n"); out.write("Access-Control-Allow-Origin: *\n"); out.write("Access-Control-Allow-Headers *\n"); out.write("Content-Type: application/xhtml+xml; charset=utf-8\n"); out.write("Accept-Encoding: UTF-8\n"); out.write("Content-Length: " + message.length() + "\n"); out.write("\n"); out.write(message); out.flush(); The message variable contains a JSON string. When I want to return a simple string contains only ASCII chars it's ok - a browser gets everything: {"data":[{"name":"{\"nick\":\"abc\",\"message\":\"czesc\"}","event":"message"}],"id":"cb822555313d73a697e5f908b1f21fff5eb85fedf062f301a4932d9547c1d266"} But when message has polish chars, for example: {"data":[{"name":"{\"nick\":\"abc\",\"message\":\"cześć\"}","event":"message"}],"id":"cb822555313d73a697e5f908b1f21fff5eb85fedf062f301a4932d9547c1d266"} the browser receive only this: {"data":[{"name":"{\"nick\":\"abc\",\"message\":\"cześć\"}","event":"message"}],"id":"cb822555313d73a697e5f908b1f21fff5eb85fedf062f301a4932d9547c1d266 As you see it is the same string, but without last two chars. Why?
tagged with: java
accepted answer: http://stackoverflow.com/a/25592276
tagged with: utf-8
has answer: http://stackoverflow.com/a/25592276
type: AnsweredQuestion
score: 0
has title: I sending message to a browser, but the browser receive only part of it
answer count: 1

http://stackoverflow.com/a/25557233
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39925111
has body: Now you can send your Pure Java project logs into warning level for example... OutputStream os = new OutputStream() { @Override public synchronized void write(byte[] buffer, int offset, int len) { Log.w("blah", new String(buffer)); } @Override public void write(int oneByte) throws IOException { // Not really sure what to do here... } }; System.setOut(new PrintStream(os)); System.out.println("Adam.");
answers question: http://stackoverflow.com/q/25555488
type: Answer
has comment: http://stackoverflow.com/comment/39937405
has comment: http://stackoverflow.com/comment/39931702
has comment: http://stackoverflow.com/comment/39910665
has comment: http://stackoverflow.com/comment/39912261
score: 0

http://stackoverflow.com/comment/40018244
type: Comment
comment on: http://stackoverflow.com/q/25616249
type: QuestionComment
score: 0
has text: I have done inserting part with 3 different queries. now looking into validating those inserts

http://stackoverflow.com/q/25689842
has title: netbeans 8.0 incorrect credentials to repository using ssh
has comment: http://stackoverflow.com/comment/40151947
has body: When I try to connect to my EC2 server, using Netbeans(Git-Remote-Push), I get "incorrect credentials coonecting to repository at SSH://xx.xx.xxx.xx/git-repo" In my ide.log, I get the following message: "WARNING [org.netbeans.modules.progress.spi.InternalHandle]: Cannot call progress on a task that was never started at org.netbeans.modules.git.client.GitProgressSupport.setProgressMessage(GitProgressSupport.java:247) INFO [org.netbeans.modules.git.ui.repository.remote.SelectUriStep]: Auth failed when accessing ssh://54.77.226.97/git-repo com.jcraft.jsch.JSchException: Algorithm negotiation fail" Steps I have taken to overcome the problem. I can connect using git-bash OK I have ussed ssh-keygen to generate the keys I have downloaded JCE 8 unlimited strength policy files. Any help much appreciated, thanks
score: 0
tagged with: java
answer count: 1
tagged with: ssh
type: Question
has answer: http://stackoverflow.com/a/28023591
tagged with: netbeans
type: UnansweredQuestion

multithreading
tags question: http://stackoverflow.com/q/25595128
tags question: http://stackoverflow.com/q/25712132
tags question: http://stackoverflow.com/q/25602557
tags question: http://stackoverflow.com/q/25698072
tags question: http://stackoverflow.com/q/25607965
tags question: http://stackoverflow.com/q/25584256
tags question: http://stackoverflow.com/q/25660988
tags question: http://stackoverflow.com/q/25649950
tags question: http://stackoverflow.com/q/25676455
tags question: http://stackoverflow.com/q/25560732
tags question: http://stackoverflow.com/q/25617962
tags question: http://stackoverflow.com/q/25699113
tags question: http://stackoverflow.com/q/25613065
tags question: http://stackoverflow.com/q/25568635
tags question: http://stackoverflow.com/q/25643358
tags question: http://stackoverflow.com/q/25614948
tags question: http://stackoverflow.com/q/25637690
tags question: http://stackoverflow.com/q/25585163
tags question: http://stackoverflow.com/q/25636643
tags question: http://stackoverflow.com/q/25633620
tags question: http://stackoverflow.com/q/25610352
tags question: http://stackoverflow.com/q/25605753
tags question: http://stackoverflow.com/q/25571960
tags question: http://stackoverflow.com/q/25707433
type: Tag
tags question: http://stackoverflow.com/q/25615649
tags question: http://stackoverflow.com/q/25685451
tags question: http://stackoverflow.com/q/25626790
tags question: http://stackoverflow.com/q/25570583
tags question: http://stackoverflow.com/q/25587264
tags question: http://stackoverflow.com/q/25551719
tags question: http://stackoverflow.com/q/25576845
tags question: http://stackoverflow.com/q/25562784
tags question: http://stackoverflow.com/q/25556865
tags question: http://stackoverflow.com/q/25571156
tags question: http://stackoverflow.com/q/25588782
tags question: http://stackoverflow.com/q/25603791
tags question: http://stackoverflow.com/q/25673747
tags question: http://stackoverflow.com/q/25615068
tags question: http://stackoverflow.com/q/25630223
tags question: http://stackoverflow.com/q/25664087
tags question: http://stackoverflow.com/q/25602206
tags question: http://stackoverflow.com/q/25609251
tags question: http://stackoverflow.com/q/25557418
tags question: http://stackoverflow.com/q/25700846
tags question: http://stackoverflow.com/q/25666995
tags question: http://stackoverflow.com/q/25676682
tags question: http://stackoverflow.com/q/25619736
tags question: http://stackoverflow.com/q/25668719
tags question: http://stackoverflow.com/q/25560878
tags question: http://stackoverflow.com/q/25704155
tags question: http://stackoverflow.com/q/25579439
tags question: http://stackoverflow.com/q/25625569
tags question: http://stackoverflow.com/q/25578210
tags question: http://stackoverflow.com/q/25626458
tags question: http://stackoverflow.com/q/25610043
tags question: http://stackoverflow.com/q/25664083
tags question: http://stackoverflow.com/q/25659657
tags question: http://stackoverflow.com/q/25656002
tags question: http://stackoverflow.com/q/25691151
tags question: http://stackoverflow.com/q/25553551
tags question: http://stackoverflow.com/q/25686482
tags question: http://stackoverflow.com/q/25580660
tags question: http://stackoverflow.com/q/25587793
tags question: http://stackoverflow.com/q/25612277
tags question: http://stackoverflow.com/q/25581308
tags question: http://stackoverflow.com/q/25642642
tags question: http://stackoverflow.com/q/25626111
tags question: http://stackoverflow.com/q/25658761
tags question: http://stackoverflow.com/q/25575559
tags question: http://stackoverflow.com/q/25573327
tags question: http://stackoverflow.com/q/25588856
tags question: http://stackoverflow.com/q/25692601
tags question: http://stackoverflow.com/q/25656150
tags question: http://stackoverflow.com/q/25612782
tags question: http://stackoverflow.com/q/25594084
tags question: http://stackoverflow.com/q/25575483
tags question: http://stackoverflow.com/q/25565707
tags question: http://stackoverflow.com/q/25564651
tags question: http://stackoverflow.com/q/25581724

http://stackoverflow.com/comment/39951636
type: AnswerComment
has text: Like I said. Better to use `isEmpty()` to avoid this type of bug.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/25579433

octal
tags question: http://stackoverflow.com/q/25694204
type: Tag
tag name: octal

http://stackoverflow.com/q/25697690
duplicate of: http://stackoverflow.com/q/5498865
tagged with: arraylist
answer count: 3
has title: How to "trim" an arrayList to only the 5 most recent values ? :
upvote count: 1
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/25697980
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25697732
has body: I will declare an ArrayList at class level. I'll use a 'set' method to fill the arrayList with values. This 'set' method will be called from an ActionEvent method. Events will happen regularly in the program, so this 'set' method will be called 100 times or more. Each time 'set' is called it will pass a String variable to the set method. The String variable will be added to the (Class level) ArrayList. I want this ArrayList to "trim" itself so that it only ever contains 5 values. ie: I need the value at index 4 to be eliminated and what was at index 3 shifts to index 4 and the "newest" variable which is passed in becomes index 0. What I don't know how to do is make the ArrayList "trim" itself in this way. some guidance would be much apprecieated. Thank you xxx
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5498865
score: -1
has answer: http://stackoverflow.com/a/25698643

http://stackoverflow.com/q/25635278
has comment: http://stackoverflow.com/comment/40056630
has answer: http://stackoverflow.com/a/25635496
has comment: http://stackoverflow.com/comment/40053567
tagged with: android
tagged with: java
has title: How to make sure the layout of an activity no replace by other activity?
has comment: http://stackoverflow.com/comment/40053704
has comment: http://stackoverflow.com/comment/40072557
tagged with: android-activity
tagged with: eclipse
type: Question
type: UnansweredQuestion
answer count: 1
has body: Please help... I have Activity 1 : consist of button for value, 5, 10,30,50, and 100. Activity 2 : display the value that had been chosen in Activtity 1. but.. what I get.. In Activity 2,the value not display..but, it display the value only when I use back button go to Activity1 and it using layout of Activity 2. Activity 1 public class ButtonClickHandler implements View.OnClickListener { public void onClick(View view) { switch (view.getId()) { case R.id.imageView2: Intent intent7 = new Intent(IntentExampleActivity.this,more.class); intent7.putExtra("YourKeyName", "RM 5"); startActivity(intent7); break; case R.id.imageView6: Intent intent2 = new Intent(IntentExampleActivity.this,more.class); intent2.putExtra("YourKeyName", "RM 10"); startActivity(intent2); break; case R.id.imageView3: Intent intent4 = new Intent(IntentExampleActivity.this,more.class); intent4.putExtra("YourKeyName", "RM 30"); startActivity(intent4); break; case R.id.imageView02: Intent intent3 =new Intent(IntentExampleActivity.this,more.class); intent3.putExtra("YourKeyName", "RM 50"); startActivity(intent3); break; case R.id.imageView06: Intent intent5 = new Intent(IntentExampleActivity.this,more.class); intent5.putExtra("YourKeyName", "RM 100"); startActivity(intent5); break; default: }; Activity 2 package com.prgguru.android; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class more extends Activity { TextView text1; TextView text2; Button btn1; Button btn2; String value; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.more); btn1= (Button) findViewById(R.id.button1); btn1.setOnClickListener(new ButtonClickHandler()); btn2= (Button) findViewById(R.id.button2); btn2.setOnClickListener(new ButtonClickHandler()); Intent intent = getIntent(); String valueFromIntent = intent.getStringExtra("YourKeyName"); tex…
tagged with: android-intent
score: 0

http://stackoverflow.com/comment/40134334
score: 0
type: AnswerComment
has text: @Karthik You should instead explicitly specify the columns to insert to, and leave the rest out.
type: Comment
comment on: http://stackoverflow.com/a/25679939

http://stackoverflow.com/a/25644166
type: Answer
answers question: http://stackoverflow.com/q/25644062
score: 2
has comment: http://stackoverflow.com/comment/40073935
accepted answer of: http://stackoverflow.com/q/25644062
type: AcceptedAnswer
has body: You can use: String platform = SWT.getPlatform(); which returns "win32", "motif", "gtk", "photon", "carbon", "cocoa", "wpf" ... It is rare to actually need to use this.
has comment: http://stackoverflow.com/comment/40073686
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/40038002
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25625879
has text: I'd mark the map field as `static final` and lock with a `synchronized` block (the `ReentrantLock` doesn't add any value here), but otherwise, looks good.

http://stackoverflow.com/q/25680929
has answer: http://stackoverflow.com/a/25681027
favorite count: 0
type: Question
type: UnansweredQuestion
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/40135510
has title: Parse json without knowning the keys
upvote count: 6
answer count: 3
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/46521891
has answer: http://stackoverflow.com/a/25681304
has body: i am trying to parse json in java without knowing the keys and the structure of json format and save that data into the hashmap how would i cycle through the whole json format and store key and value into the hashmap {"id" : 12345, "value" : "123", "person" : "1"} like in this example all the keys would be jsonobject none of them will be json array There is some other library like jackson i don't want to use any third party library
duplicate of: http://stackoverflow.com/q/7304002

http://stackoverflow.com/comment/40166878
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25697732
has text: Indeed so. On the other hand, if you do it in your direction then for a while it's under capacity and doesn't meet its spec of having the most recent five elements in it! So really you'd want it to be `synchronized` so that this is an atomic operation. Still you need to add before remove, though, even when it's synchronized, because if you remove and then the add fails, you've got no way of backing out.
type: AnswerComment

http://stackoverflow.com/q/25590650
downvote count: 1
favorite count: 0
type: Question
tagged with: jnlp
has title: How to make JNLP voice chat application?
has answer: http://stackoverflow.com/a/25590697
tagged with: java
score: -1
tagged with: chat
has body: I've seen some websites made a voice chat using .jnlp (Java Network Launch Protocol ) I was wondering how can I make a website the same like it, and how is that possible? , link: http://arbfoox.com/ | https://elhddbha.com/ | www . 63on . com How cPanel looks like: www . 63on.com/server/server . html in the cpanel list in the right it says: Up~down. Main, online now, rooms, colored names, banned, messages, server settings, password and log out. When u click on 1 of the pictures it will download .jnlp file 2 kb and when u lunch it u will be asked to enter ur name then u will enter the chat, if u tried to edit that .jnlp file you will see how it works, just wondering how can I do the same in my website, and how can I make a cpanel for customers ect? I was redirected to this website ivocalize . com &lt; But when u try to use it, it doesn't look the same at all.
upvote count: 0
type: UnansweredQuestion
answer count: 1
tagged with: voice

http://stackoverflow.com/comment/40012743
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/25613202
has text: Short answer: no, but there may be some 3rd party libraries that provide the required functionality (eg. is Beanshell still around/relevant?)
type: Comment

http://stackoverflow.com/q/25638444
has answer: http://stackoverflow.com/a/25663371
has comment: http://stackoverflow.com/comment/40058653
tagged with: java
has answer: http://stackoverflow.com/a/25638616
has body: I want to add the image and the file with the same form in JSP. how should i do it? Here, i made the form as: &lt;div id="user_img"&gt; &lt;form name="form1" method="post" enctype="multipart/form-data" action="image_user_upload_db.jsp"&gt; &lt;input type="file" name="poster" id="imagefile"/&gt; &lt;input type="submit" id="submit_img" value="submit"/&gt; &lt;/form&gt; &lt;/div&gt; and the jsp page which help in saving the image is: try{ String ImageFile=""; String itemName = ""; boolean isMultipart = ServletFileUpload.isMultipartContent(request); if (!isMultipart){ } else{ FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List items = null; try{ items = upload.parseRequest(request); } catch (FileUploadException e){ e.getMessage(); } Iterator itr = items.iterator(); while (itr.hasNext()){ FileItem item = (FileItem) itr.next(); if (item.isFormField()){ String name = item.getFieldName(); String value = item.getString(); if(name.equals("poster")){ ImageFile=value; } } else{ try{ itemName = item.getName(); File savedFile = new File(config.getServletContext().getRealPath("/")+"\\img\\user_img\\"+itemName); item.write(savedFile); } catch (Exception e){ out.println("Error"+e.getMessage()); } } } try{ String str="update user_info set img_name='"+itemName+"' where user_id=?"; PreparedStatement ps=con.prepareStatement(str); ps.setInt(1,id1); int rs1=ps.executeUpdate(); response.sendRedirect("profile.jsp"); } catch(Exception el){ out.println("Inserting error"+el.getMessage()); } } } I want this form to take the other input type also, but as i add another input type to the form, it gives error.
has title: Add images to the form in java
type: Question
tagged with: jsp
accepted answer: http://stackoverflow.com/a/25638616
has comment: http://stackoverflow.com/comment/40058722
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25639387
possible better answer: http://stackoverflow.com/a/25639387
answer count: 3

http://stackoverflow.com/comment/40154000
type: QuestionComment
comment on: http://stackoverflow.com/q/25690625
has text: Can you pay me? As an aside, a person who cannot be bothered to spell all 3 letters of the word 'you', or indicates a question with '???' is unlikely to get help from me.
type: Comment
score: 1

http://stackoverflow.com/q/25583973
has answer: http://stackoverflow.com/a/28321066
has body: Is it possible for a Chrome packaged app to contain a Java applet? I'm attempting to integrate QZ-Print / jZebra into a packaged app, however the applet does not appear and JavaScript receives an error of applet / can't read method of undefined when attempting to call a function.
upvote count: 1
score: 1
tagged with: java
has title: Chrome packaged app with a Java applet
tagged with: google-chrome
favorite count: 0
type: Question
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25590749
downvote count: 0
tagged with: google-chrome-app

http://stackoverflow.com/q/25695697
tagged with: intellij-idea
has title: How to setup libraries for IntelliJ 13 on Mac with JDK 1.8
tagged with: java-8
has comment: http://stackoverflow.com/comment/40168694
score: 0
tagged with: groovy
tagged with: java
has body: I recently installed the Java 1.8 Update 20 JRE on my Mac running OSX 10.9.4. After that, I also added the JDK of 1.8.0_20. When I go into Terminal and execute "java -version" or "javac -version", each time I get "1.8.0_20" as a result. For me, this means that both JRE and JDK 1.8 are the System standard right now (I might be wrong on this). So, I also add IntelliJ IDEA 13.1 and open it. I logged into GitHub using my credentials and it worked. So from the launcher window, I proceed Configure → Project Defaults → Project Structure. From here I firstly click the "New" button next to "No SDK" and select JDK. It automatically brings me to /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home. Just to make sure I select the JDK itself, I back off into ~/JavaVirtualMachines/ and select the jdk1.8.0_20.jdk, hitting return. This is now recognized as "1.8" in IntelliJ. On the left hand side, I now go to Libraries and hit the "+" sign. This also automatically brings me to /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre/lib. I know that it has to add all the .jar files in this folder, so I highlight using SHIFT + CLICK the entire contents of the folder and click "Ok". This is now library "ext" (don't know where that name comes from). I click Apply and Ok and go back to the Quick Start menu. Selecting "Create New Project", I leave the template for Java and see that the Project SDK has been set as 1.8 (Java version "1.8.0_20"). Underneath it gives me the option to tick for "Groovy" (again, no idea what that is) and lastly, the library... Only that the line "Use library:" returns "[No library specified]". Even when I tick Groovy and the library field becomes clickable, it still does not find the before-created Java library. Nevermind that, I untick Groovy and go to write some simple Java code: Under the project name, in its src folder, I create a class and write: public class main { public static void main (String[] args){ System.out.println("Hello W…
answer count: 1
has answer: http://stackoverflow.com/a/25714022
tagged with: macos
has comment: http://stackoverflow.com/comment/40168504
type: Question
type: UnansweredQuestion

http://stackoverflow.com/comment/39944414
score: 0
has text: These are the two registered activities:
comment on: http://stackoverflow.com/q/25575522
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25639175
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25643635
favorite count: 0
has body: I am using jenkins to run selenium webdriver scripts. The tests run successfully , and when i go to console , its shows loading icon for a long time , even though the tests are run successfully. After a long time, it stops and displays success message. Can someone please help on this, as it is taking more time to see the results than testing the application manually.
tagged with: selenium-webdriver
tagged with: java
answer count: 1
tagged with: selenium
score: 1
type: Question
tagged with: jenkins
has title: Jenkins- Selenium Webdriver- Keeps loading in console for a long time more than an hour even after all tests are run

http://stackoverflow.com/comment/42444686
type: AnswerComment
comment on: http://stackoverflow.com/a/25589730
has text: This looks like a pretty decent answer - why did you want to delete it?
type: Comment
score: 0

http://stackoverflow.com/a/25623589
score: 2
has comment: http://stackoverflow.com/comment/40036404
has body: You need to alter cacheManager in order to integrate EhCache. Your current code does not make EhCache enter the picture. The configuration would look like @Configuration @EnableJpaRepositories(basePackageClasses = {PackageMarker.class}) @EnableTransactionManagement(proxyTargetClass = true) @EnableCaching public class FooJPAConfig implements CachingConfigurer { @Bean public EhCacheManagerFactoryBean cacheFactoryBean() { EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean(); ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("whatever-name.xml")); //this is where you set the location of the eh-cache configuration file return ehCacheManagerFactoryBean; } @Bean @Override public CacheManager cacheManager() { EhCacheCacheManager cacheManager = new EhCacheCacheManager(); cacheManager.setCacheManager(cacheFactoryBean().getObject()); return cacheManager; } @Bean @Override public KeyGenerator keyGenerator() { return new DefaultKeyGenerator(); } } You will also have to have spring-context-support as a dependency on your classpath (applies for Spring 3.2) Note that the code above activates Spring -EhCache integration, not JPA - EhCache integration. That means that you can use Spring's @Cacheable not EhCache's @Cache on entities.
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40035989
has comment: http://stackoverflow.com/comment/40032382
type: Answer
answers question: http://stackoverflow.com/q/25623435

http://stackoverflow.com/q/25661665
tagged with: java
has answer: http://stackoverflow.com/a/25662141
has title: What's the usage of synchronized in Java?
has body: I have written several years of C++. And just begin to write in Java. There are synchronized statements in Java. It's new to me and I found the following usage: synchronized (NetworkManager.class) {/*some code*/} and NetworkManager myInstance = new NetworkManager(); synchronized(myInstance){/*some code*/} I know that synchronized statements will block other synchronized access to the synchronized sections in an object. But I'm confused by the argument of synchronized. What I think is that if I want to block some method then I should synchronize on myInstance in C++ for second example. If I create another instance, it should have no influence. Is this correct? If it is correct, what happens with use of NetworkManager.class? Will the .class return a class object reference to NetworkManager. On which instances will it take effect? Or will it influence all NetworkManager instances?
type: Question
accepted answer: http://stackoverflow.com/a/25661718
has answer: http://stackoverflow.com/a/25661718
possible better answer: http://stackoverflow.com/a/25662141
type: AnsweredQuestion
score: 0
answer count: 2

http://stackoverflow.com/comment/40013322
type: Comment
comment on: http://stackoverflow.com/a/25604629
type: AnswerComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/60419/discussion-between-whilda-chaq-and-antariksha-yelkawar).
score: 0

http://stackoverflow.com/comment/40028336
score: 0
type: Comment
type: AnswerComment
has text: thank you for your prompt response. I receive the following error: - The method getInt(int) is undefined for the type List<ParseUser>
comment on: http://stackoverflow.com/a/25621193

http://stackoverflow.com/q/25676103
answer count: 2
linked to: http://stackoverflow.com/q/16688102
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
downvote count: 0
has body: I am wondering if hibernate allowing use arrayList to represent multiple columns. For example: I have a single table, called "tableA" with columns: tableA: |id|c1|c2|c3|c4| I would like to create a java object use arrayList to map to columns c1,c2,c3,c4. @Entity @Table(name = "tableA") public class tableA{ @Column(name = "id", unique = true, nullable = false) public int id; //QUESTION: How do I annotate here to map columns c1,c2,c3,c4 to below arraylist ? ---- public List&lt;String&gt; columns = new ArrayList&lt;&gt;(); //I tried this, but it doesn't work : @Column(name = "c1", length=10) public String getC1(){ return columns.get(0); } public String setC1(String c1){ columns.add(c1); } } How do I annotate here to map columns c1,c2,c3,c4 to below arraylist ?
has title: hibernate map multiple columns to arraylist
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25687169
has comment: http://stackoverflow.com/comment/40132185
tagged with: hibernate-mapping
has answer: http://stackoverflow.com/a/25678434
score: 4
upvote count: 4

http://stackoverflow.com/a/25594013
type: AcceptedAnswer
downvote count: 1
has body: I honestly don't know how to fix the path issue, but because you mention you're using Eclipse I assume we're talking about Java Libraries. I can suggest one thing: use Maven for dependencies. You can easily configure the needed libraries for your project without having to mess around with adding them manually to you build path. This should help you getting started with Maven: http://wiki.eclipse.org/M2E
type: Answer
accepted answer of: http://stackoverflow.com/q/25593899
score: -1
answers question: http://stackoverflow.com/q/25593899
upvote count: 0
has comment: http://stackoverflow.com/comment/39977702

http://stackoverflow.com/q/25672246
has comment: http://stackoverflow.com/comment/40119695
upvote count: 0
has title: Java setLocation() Resets after new keyEvent
has answer: http://stackoverflow.com/a/25672661
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25672468
has comment: http://stackoverflow.com/comment/40119803
has body: By first, sorry for bad English. I've got a question. I've coded a simple keyEvent thing that let move my JLabel. It works fine, but when i ask my code to change the setText by using keyEvent, he will reset my setLocation(). Here's my code: package view; import javax.swing.JFrame; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; import javax.swing.JLabel; import controller.Keylisteners; @SuppressWarnings("serial") public class Builder extends JFrame { public JLabel plaatje = new JLabel(); public static Builder instance; public static Builder getInstance(){ if(instance == null){ instance = new Builder(); } return instance; } public Builder() { setSize(getMaximumSize()); this.addKeyListener(new Keylisteners()); setLayout(null); //plaatje.setText("UP"); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup() .addContainerGap(595, Short.MAX_VALUE) .addComponent(plaatje) .addGap(567)) ); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup() .addContainerGap(570, Short.MAX_VALUE) .addComponent(plaatje, GroupLayout.PREFERRED_SIZE, 65, GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); getContentPane().setLayout(groupLayout); } } And the other class. package controller; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import view.Builder; public class Keylisteners extends KeyAdapter{ public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { Builder.getInstance().plaatje.setText("UP"); Builder.getInstance().plaatje.setLocation(Builder.getInstance().plaatje.getX(), Builder.getInstance().plaatje.getY()-5); Builder.getInstance().plaatje.repaint(); } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { Builder.getInstance().plaatje.setText("DOWN"); Builder.getInstance().plaatje.setL…
has answer: http://stackoverflow.com/a/25672468
downvote count: 1
accepted answer: http://stackoverflow.com/a/25672661
score: -1
favorite count: 0
answer count: 2
type: Question

http://stackoverflow.com/a/25686569
upvote count: 8
score: 8
downvote count: 0
answers question: http://stackoverflow.com/q/25685993
type: Answer
has body: You cannot do that, nor do you need to. Not only is Service a Context, but Service can call getApplicationContext() to get the Application object if that is what you truly need. Do not pass in extras things that the service can get on its own.

http://stackoverflow.com/comment/40026992
has text: @KonstantinV.Salikhov care to comment? I've been through the documentation and I have more specific question related to the Java API
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25620471
score: 0

http://stackoverflow.com/q/25651227
has body: I'm trying to create a Lottery Number Generator. It will ask the user how many games they want to play then create a Lottery Ticket with randomly picked numbers 1-49. Each game will be stored. Once all games have been created then it will print it out. Right now I'm having an issue where the Games are not copying into the ArrayList the way I want it. Currently it places them all into the element then copies that element "numberOfGames" times. I'm pretty sure it has something to do with the for loop but I'm stuck on this part. public class LotteryTicket { ArrayList&lt;Integer&gt; Numbers; ArrayList&lt;Integer&gt; Lottery; ArrayList&lt;ArrayList&lt;Integer&gt;&gt; Games; LotteryTicket(){ Lottery = new ArrayList&lt;Integer&gt;(); Numbers = new ArrayList&lt;Integer&gt;(); Games = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); } public ArrayList&lt;Integer&gt; Numbers(){ for(int i = 0; i &lt; 49; i++){ Numbers.add(i); } Collections.shuffle(Numbers); return Numbers; } public void Generate(int numberOfGames){ for (int i = 0; i &lt; numberOfGames; i++){ Numbers(); for(int x = 0; x &lt; 6; x++){ Lottery.add(Numbers.get(x)); } Collections.sort(Lottery); Games.add(Lottery); } } public void Display(){ System.out.println(Games); } } Here is my tester: public class Picker { private static int numberOfGames; public static void main(String[] args){ System.out.println("Please enter the amount of games you would like to play"); Scanner in = new Scanner(System.in); numberOfGames = in.nextInt(); LotteryTicket q = new LotteryTicket(); ArrayList&lt;ArrayList&gt; game= new ArrayList&lt;ArrayList&gt;(); q.Generate(numberOfGames); q.Display(); } }
score: 0
accepted answer: http://stackoverflow.com/a/25651536
has comment: http://stackoverflow.com/comment/40082056
tagged with: java
has comment: http://stackoverflow.com/comment/40082155
has answer: http://stackoverflow.com/a/25651536
has title: ArrayList Lottery Game
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25651396
upvote count: 2
downvote count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/25651396
tagged with: arraylist
type: AnsweredQuestion

http://stackoverflow.com/comment/40032127
type: AnswerComment
has text: I've already got Session Stickyness turned on, that's the problem, it keeps on trying to stick to the server once it's died, everything's fine until one of the application servers dies.
comment on: http://stackoverflow.com/a/25566760
type: Comment
score: 0

http://stackoverflow.com/a/25639571
has body: Try to set debug attribut in log4j:configuration node to true. &lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true"&gt; It prints out information as the configuration file is read and used to configure the log4j environment. You may be got more details to resolve your problem.
score: 3
answers question: http://stackoverflow.com/q/25638994
type: Answer
upvote count: 3
downvote count: 0

http://stackoverflow.com/q/25666228
downvote count: 0
has body: I have a little JPA question. Assume you have such tables: (structure is fixed) PERSON -- ID, DEPARTMENT_ID ... SPECIALWORKER ------ ID, PERSON_ID, SPECIALDEPARTMENT_ID ... DEPARTMENT ------- ID, ... SPECIALDEPARTMENT ------- ID, ... In Java I would build it with a simple hierarchy: SpecialWorker extends Person and SpecialDepartment extends Department. We will have "simple" Persons as well as "simple" Departments. In JPA I try to build that scenario with a JOINED_Table inheritance, but I can't get it working. Any ideas? edit the coding, i hope i missed nothing. I got a integrity exception when i try to insert a specialworker. When i insert a specialworker jpa has to set the fk to departement (baseclass person) as well as the fk to the special departement (from the concrete current class) @Entity @Table(name = "DEPARTEMENT") @Access(AccessType.FIELD) @Inheritance(strategy = InheritanceType.JOINED) public class Departement { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") private Integer id; ... } @Entity @Table(name = "SPECIALDEPARTEMENT") @Access(AccessType.FIELD) @PrimaryKeyJoinColumn(name = "ID_DEPARTEMENT", referencedColumnName = "ID") public class SpecialDepartement extends Departement implements Serializable { @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID", updatable = false, insertable = false) private Integer id01; @OneToMany(mappedBy = "specialDepartement", cascade = CascadeType.ALL, orphanRemoval = true) private List&lt;SpecialWorker&gt; workers; ... } @Entity @Table(name = "PERSON") @Access(AccessType.FIELD) @Inheritance(strategy = InheritanceType.JOINED) public class Person { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") @Max(19) private Long id; @ManyToOne @JoinColumn(name = "ID_DEPARTEMENT", referencedColumnName = "ID", nullable = false) private Departement departement; ... } @Entity @Table(name = "SWORKER") @Access(AccessType.FIELD) @PrimaryKeyJoinColumn(name = "ID_PER…
has title: JPA, inheritance JOINED, multiple ID's
has comment: http://stackoverflow.com/comment/40113515
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/40109138
has comment: http://stackoverflow.com/comment/40111934
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40111735
favorite count: 0
type: Question
answer count: 0
type: UnansweredQuestion
tagged with: jpa

http://stackoverflow.com/q/25584408
has title: net.sf.jasperreports.engine.JRException: No input source supplied to the exporter
type: Question
answer count: 0
upvote count: 1
type: UnansweredQuestion
tagged with: java
downvote count: 0
score: 1
favorite count: 0
tagged with: jasper-reports
has body: I have a Exception. "net.sf.jasperreports.engine.JRException: No input source supplied to the exporter". the Source Code (in the jsp file): try { CustomerReport report = new CustomerReport(); report.setReportType((Integer) session.getAttribute("reportType")); report.setEndTime((String) session.getAttribute("endTime")); report.setBeginTime((String) session.getAttribute("beginTime")); List&lt;CustomerStatistics&gt; stasList = (List&lt;CustomerStatistics&gt;) session.getAttribute("stasList"); dataSize = stasList.size(); ds = report.getDataSource(stasList).toString(); JasperPrint print = report.getPrint(stasList); JRHtmlExporter exporter = new JRHtmlExporter(); session.setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, print); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out); exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, true); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "../servlets/image?image="); exporter.exportReport(); } catch (Exception e) { logger.error(this.getClass(), e); } The CustomerReport code: public JasperPrint getPrint(List&lt;CustomerStatistics&gt; stasList) { JasperPrint print = null; FontBuilder boldFont = stl.fontArialBold().setFontSize(12).setFontName("SansSerif"); TextColumnBuilder&lt;String&gt; areaNameColumn = col.column("区域", "areaName", type.stringType()); TextColumnBuilder&lt;Integer&gt; businessConsultColumn = col.column("业务咨询", "businessConsultSum", type.integerType()); TextColumnBuilder&lt;Integer&gt; openReserveColumn = col.column("开通预约", "openReserveSum", type.integerType()); TextColumnBuilder&lt;Integer&gt; complainAcceptColumn = col.column("投诉受理", "complainAcceptSum", type.integerType()); try { print = report() .setPageFormat(900, 600, PageOrientation.PORTRAIT) .setTemplate(Templates.reportTemplate) .title(Templates.createTitleComponent(title + " [ " + beginTime + " 至 " + endTime + " ]")) .summary( cht.bar3…

http://stackoverflow.com/q/25626458
favorite count: 0
type: Question
tagged with: timer
has comment: http://stackoverflow.com/comment/40037398
has answer: http://stackoverflow.com/a/25626586
type: UnansweredQuestion
has body: I have an annoying issue with my desktop app that I am just unable to figure out. I have isolated the problem into the following example. What I am trying to do.... I have a jframe and 5 jpanels, each panel has a different picture. When launched, the user will see panel A with a button all inside my jframe. When the button is pressed I would like panel A to dissappear and panel B,C,D and E become visible after one another but each panel to be displayed for different lengths of time... B visible for 3 secs, B invisible, C visible for 5 seconds, C invisible... and so on. I have tried javax.Timer, Thread.sleep(3000) and even for statements and none seem to achieve what I want. How would you guys achieve this and what is the method I need to be looking at? Thanks in advance.
has comment: http://stackoverflow.com/comment/40037082
tagged with: multithreading
tagged with: jpanel
tagged with: swing
has comment: http://stackoverflow.com/comment/40039089
has title: Timing the display of JPanels
has comment: http://stackoverflow.com/comment/40037513
has comment: http://stackoverflow.com/comment/40039456
answer count: 2
has comment: http://stackoverflow.com/comment/40037311
has comment: http://stackoverflow.com/comment/40037240
score: 1
has comment: http://stackoverflow.com/comment/40037215
has comment: http://stackoverflow.com/comment/40037067
tagged with: java
has comment: http://stackoverflow.com/comment/40037435
downvote count: 0
has comment: http://stackoverflow.com/comment/40037430
upvote count: 1
has answer: http://stackoverflow.com/a/25627547

http://stackoverflow.com/q/25676790
has title: InputStream fails to open file
tagged with: java
has body: Writing some tests for an Android app and a failure occurs when trying to open a file. My hunch is something is breaking down when passing the context. Here's how I pass in the context testFactoryQueued.java: Object obj = Factory.getInstance(getInstrumentation().getContext()); which goes to Factory.java private static Factory mInstance; private Context mContext; public static Factory getInstance(Context context) { if (mInstance == null) { mInstance = new Factory(context); } return mInstance; } private Factory(Context context) { mContext = context; } // Try to open file try { InputStream is = mContext.getResources().getAssets().open(inFile); ...etc... } catch (IOException e) { e.PrintStackTrace(); } Thanks in advance!
answer count: 1
tagged with: unit-testing
type: Question
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25677011
score: 0

http://stackoverflow.com/comment/39975239
type: Comment
has text: post your androidManifest file also
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25592628

http://stackoverflow.com/q/25589167
downvote count: 0
has comment: http://stackoverflow.com/comment/39968822
has title: Mapping element in configuration specifies no attributes Error occurred when i try to run my project in Hibernate
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: hibernate
answer count: 1
favorite count: 0
type: Question
has body: Error occurred when i try to run my project in Hibernate.The error is as follows. Mapping element in configuration specifies no attributes Can anyone help me in clearing this error
accepted answer: http://stackoverflow.com/a/25589201
upvote count: 2
has answer: http://stackoverflow.com/a/25589201

http://stackoverflow.com/q/25596942
has comment: http://stackoverflow.com/comment/39983297
favorite count: 0
has answer: http://stackoverflow.com/a/25597299
type: Question
has comment: http://stackoverflow.com/comment/39983130
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25597234
has comment: http://stackoverflow.com/comment/39983332
tagged with: input
possible better answer: http://stackoverflow.com/a/25597299
has comment: http://stackoverflow.com/comment/39983526
has body: I am brand new at Java and this one is throwing me. Using the below code it loops through for the first question until I enter anything but an integer but after finishing that loop it does not stop for the remaining question. Through a bit of research and reading I have found that I need to use the in.nextLine() to eat the newline character after the input. However no matter where I place the nextLine() it doesn't work? I thought it would be after the first int input = in.nextInt(); line but that did not work. Any help on where it would go and why? System.out.print("How many CUs per course are remaining in your degree program? Enter any letter to quit: "); while (in.hasNextInt()) { // Verify input is an integer int input = in.nextInt(); if (input &lt;= 0) // Verify that input is not negative or zero { System.out.println("Please enter a positive number or any letter to quit"); System.out.print("Add another course or any letter to quit: "); } else { courseCuList.add(input); System.out.print("Add another course or any letter to quit: "); } } System.out.print("How many CUs do you plan to take per term?"); while (in.hasNextInt()) { int input = in.nextInt(); // in.nextLine(); This line consumes the \n if (input &lt;= 0) { System.out.println("Please enter a whole positive number."); System.out.println("How many CUs do you plan to take per term?"); } else { cuPerTerm = in.nextInt(); } }
score: 2
answer count: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25597234
has title: "hasNextInt" does not detect subsequent input; where to put "nextLine"?
downvote count: 0

http://stackoverflow.com/q/25618540
has body: I have a web service based on a number of entity classes. one of them is shows below @Entity @Table(name = "users") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Users.findAll", query = "SELECT u FROM Users u"), @NamedQuery(name = "Users.findByUserName", query = "SELECT u FROM Users u WHERE u.userName = :userName"), @NamedQuery(name = "Users.findByUserPassword", query = "SELECT u FROM Users u WHERE u.userPassword = :userPassword")}) public class Users implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @Column(name = "user_name") private String userName; @Basic(optional = false) @Column(name = "user_password") private String userPassword; @JoinColumn(name = "user_category_id", referencedColumnName = "category_id") @ManyToOne(optional = false) private UserCategory userCategoryId; @OneToMany(cascade = CascadeType.ALL, mappedBy = "userName") private List<UserRecord> userRecordList; public Users() { } public Users(String userName) { this.userName = userName; } public Users(String userName, String userPassword) { this.userName = userName; this.userPassword = userPassword; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserPassword() { return userPassword; } public void setUserPassword(String userPassword) { this.userPassword = userPassword; } public UserCategory getUserCategoryId() { return userCategoryId; } public void setUserCategoryId(UserCategory userCategoryId) { this.userCategoryId = userCategoryId; } @XmlTransient public List<UserRecord> getUserRecordList() { return userRecordList; } public void setUserRecordList(List<UserRecord> userRecordList) { this.userRecordList = userRecordList; } @Override public int hashCode() { int hash = 0; hash += (userName != null ? userName.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields …
has comment: http://stackoverflow.com/comment/40022439
has comment: http://stackoverflow.com/comment/40022440
answer count: 0
tagged with: java
downvote count: 0
has title: UnmarshalException while consuming a web service
score: 1
upvote count: 1
tagged with: web-services
favorite count: 0
type: Question
tagged with: rest
type: UnansweredQuestion

spring-mvc
tags question: http://stackoverflow.com/q/25579684
tags question: http://stackoverflow.com/q/25656007
type: Tag
tags question: http://stackoverflow.com/q/25571017
tags question: http://stackoverflow.com/q/25637334
tags question: http://stackoverflow.com/q/25705713
tags question: http://stackoverflow.com/q/25683464
tags question: http://stackoverflow.com/q/25683627
tags question: http://stackoverflow.com/q/25689837
tags question: http://stackoverflow.com/q/25674863
tags question: http://stackoverflow.com/q/25635806
tags question: http://stackoverflow.com/q/25673959
tags question: http://stackoverflow.com/q/25632061
tags question: http://stackoverflow.com/q/25557319
tags question: http://stackoverflow.com/q/25674733
tags question: http://stackoverflow.com/q/25678115
tags question: http://stackoverflow.com/q/25690923
tags question: http://stackoverflow.com/q/25574597
tags question: http://stackoverflow.com/q/25560796
tags question: http://stackoverflow.com/q/25631084
tags question: http://stackoverflow.com/q/25700872
tags question: http://stackoverflow.com/q/25632784
tags question: http://stackoverflow.com/q/25640116
tags question: http://stackoverflow.com/q/25648446
tags question: http://stackoverflow.com/q/25654269
tags question: http://stackoverflow.com/q/25699727
tags question: http://stackoverflow.com/q/25676605
tags question: http://stackoverflow.com/q/25695676
tags question: http://stackoverflow.com/q/25659838
tags question: http://stackoverflow.com/q/25632779
tags question: http://stackoverflow.com/q/25678610
tags question: http://stackoverflow.com/q/25604477
tags question: http://stackoverflow.com/q/25698850
tags question: http://stackoverflow.com/q/25583522
tags question: http://stackoverflow.com/q/25593796
tags question: http://stackoverflow.com/q/25701285
tags question: http://stackoverflow.com/q/25702295
tags question: http://stackoverflow.com/q/25640760
tags question: http://stackoverflow.com/q/25692735
tags question: http://stackoverflow.com/q/25582753
tags question: http://stackoverflow.com/q/25659054
tags question: http://stackoverflow.com/q/25691255
tags question: http://stackoverflow.com/q/25556550
tags question: http://stackoverflow.com/q/25683430
tags question: http://stackoverflow.com/q/25569372
tags question: http://stackoverflow.com/q/25600953
tags question: http://stackoverflow.com/q/25665881
tags question: http://stackoverflow.com/q/25633477
tags question: http://stackoverflow.com/q/25645669
tags question: http://stackoverflow.com/q/25641964
tags question: http://stackoverflow.com/q/25690217
tags question: http://stackoverflow.com/q/25552692
tags question: http://stackoverflow.com/q/25621497
tags question: http://stackoverflow.com/q/25607154
tags question: http://stackoverflow.com/q/25665420
tags question: http://stackoverflow.com/q/25551541
tags question: http://stackoverflow.com/q/25659381
tags question: http://stackoverflow.com/q/25599827
tags question: http://stackoverflow.com/q/25605626
tags question: http://stackoverflow.com/q/25589916
tags question: http://stackoverflow.com/q/25594136
tags question: http://stackoverflow.com/q/25687215
tags question: http://stackoverflow.com/q/25559659
tags question: http://stackoverflow.com/q/25592170
tags question: http://stackoverflow.com/q/25554373
tags question: http://stackoverflow.com/q/25608010
tags question: http://stackoverflow.com/q/25646047
tags question: http://stackoverflow.com/q/25673757
tags question: http://stackoverflow.com/q/25635434
tags question: http://stackoverflow.com/q/25641043
tags question: http://stackoverflow.com/q/25659719
tag name: spring-mvc
tags question: http://stackoverflow.com/q/25615664
tags question: http://stackoverflow.com/q/25604215
tags question: http://stackoverflow.com/q/25596179
tags question: http://stackoverflow.com/q/25612984
tags question: http://stackoverflow.com/q/25589728
tags question: http://stackoverflow.com/q/25712830
tags question: http://stackoverflow.com/q/25644210
tags question: http://stackoverflow.com/q/25691185

http://stackoverflow.com/q/25639763
favorite count: 0
type: Question
has body: Recently our management has been affected by Java developments (which is right), so our project becomes more "tipized". Thats ok, lets start to replace all dates to datetimes, so, what used to be: public function setDate ($id, $date) { mysql insert date ($id, $date) etc etc pseudo code } .... setDate ('2001-01-02 11:32:54'); so all dates were in raw format. After our refactoring, it should be look alike: public function setDate ($id, DateTime $date) { mysql insert date ($id, $date-&gt;toFormat('Y-m-d H:i:s') etc etc pseudo code } .... setDate (new DateTime ('2001-01-02 11:32:54')); which almost have... very little advantage. But it increases the memory what script consume. In general, is it good to have "better" code to sacrifise some memory/resource?
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1
tagged with: php
has title: Php, replace all dates (string) to DateTime class, memory issues?
score: 1
has comment: http://stackoverflow.com/comment/40063630
tagged with: java
tagged with: datetime

http://stackoverflow.com/comment/40017559
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25612205
has text: If the biggest element of an unsorted array is to be repeatedly accessed, then the best solution is to find it once using a linear scan (in O(n) operations) and cache it. Much better than sorting (O(n log n)) and then picking the element directly. You're also assuming that sorting the array won't mess up anything else; it's quite possible that the order is important and sorting cannot be used at all.

http://stackoverflow.com/q/25621497
type: Question
tagged with: spring-mvc
tagged with: java
has title: Get attribute from ServletContext on JSP page
accepted answer: http://stackoverflow.com/a/25621634
has answer: http://stackoverflow.com/a/25621634
upvote count: 11
type: AnsweredQuestion
tagged with: el
has body: How can I find my attribute from ServletContext object on JSP page? I set it before in: public class MyServletContextListener implements ServletContextListener{ private static final Logger logger = LoggerFactory.getLogger(MyServletContextListener.class); @Override public void contextInitialized(ServletContextEvent event) { logger.info("Init gameEngine in listener"); Engine engine = Engine.getInstance(); event.getServletContext().setAttribute("engine", engine); } @Override public void contextDestroyed(ServletContextEvent event) { }} and now want to get on JSP page. Maybe it possible to do with ${pageContext.servletContext.attributeNames}?
answer count: 1
downvote count: 0
tagged with: jsp
score: 11
favorite count: 0

http://stackoverflow.com/comment/40068613
type: AnswerComment
has text: If program includes Thread t3=new Thread(obj1) then Thread t1 will acquire two locks one for object obj1 and second for class object.
comment on: http://stackoverflow.com/a/25642768
score: 0
type: Comment

testng
tag name: testng
tags question: http://stackoverflow.com/q/25602146
tags question: http://stackoverflow.com/q/25561067
tags question: http://stackoverflow.com/q/25674619
tags question: http://stackoverflow.com/q/25685387
tags question: http://stackoverflow.com/q/25566643
tags question: http://stackoverflow.com/q/25602313
tags question: http://stackoverflow.com/q/25551001
type: Tag
tags question: http://stackoverflow.com/q/25650361

http://stackoverflow.com/comment/40167751
type: AnswerComment
comment on: http://stackoverflow.com/a/25698178
score: 0
type: Comment
has text: Can you see any page from your project (html, jsp, anything)? What is any working URL are you using to access any resource from your project?

http://stackoverflow.com/q/25642388
has answer: http://stackoverflow.com/a/25643207
tagged with: logging
has title: How to check when added a new line in log file - Java
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25643207
has body: I'm trying monitoring the log file using my simple script in java. How to check whether a file has changed when script is run again. The script should check occurred is the phrase "Unable" My script is running every 5 minutes (Windows Scheduler) My code: import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class LogAgent { public static void main(String[] args) { double count = 0,countBuffer=0,countLine=0; String lineNumber = ""; String filePath = "/Users/Radek/log.txt"; BufferedReader br; String inputSearch = "Unable"; String line = ""; try { br = new BufferedReader(new FileReader(filePath)); try { while((line = br.readLine()) != null) { countLine++; //System.out.println(line); String[] words = line.split(" "); for (String word : words) { if (word.equals(inputSearch)) { count++; countBuffer++; } } if(countBuffer &gt; 0) { countBuffer = 0; lineNumber += countLine + ","; } } br.close(); } catch (IOException e) { e.printStackTrace(); } } catch (FileNotFoundException e) { e.printStackTrace(); } if (count == 0) { System.out.println("Stan poprawny"); } else { System.out.println("Liczba wystapien alertu--"+count); // System.out.println("Alert w liniach--"+lineNumber); } } }
type: Question

http://stackoverflow.com/comment/40012323
comment on: http://stackoverflow.com/q/25612786
type: QuestionComment
score: 0
has text: Sotirios Delimanolis got it, 8 minutes response time! Thank you StackOverflow!
type: Comment

http://stackoverflow.com/comment/39942788
score: 2
comment on: http://stackoverflow.com/q/25574797
type: Comment
type: QuestionComment
has text: @JimGarrison in Java 1.5 and newer, volatile guarantees visibility of all the changes made before the assignment to volatile, not just the changes in the vloatile itself. So it can be relevant.

http://stackoverflow.com/comment/40095826
has text: If you're using `double` values to compute financial values in dollars and cents, you're almost certainly doing it wrong. If you haven't yet read it, check out [floating-point-gui.de](http://floating-point-gui.de).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25658589
score: 0

http://stackoverflow.com/comment/39956993
comment on: http://stackoverflow.com/q/25568604
score: 0
type: Comment
type: QuestionComment
has text: The problem was on my side, the url was partly incorrect (I had dl=0 instead of dl=1).

has-many
type: Tag
tag name: has-many
tags question: http://stackoverflow.com/q/25581653

http://stackoverflow.com/comment/39994766
score: 0
has text: dont forget, that 'public static ConnectionManager getInstance()' should be 'synchronized' or in if statement code should be in `synchronized` block with double check of `instance==null`. This way synchronization will occur ~1 time during application lifetime, and your class will be "always" a Singleton.
type: QuestionComment
comment on: http://stackoverflow.com/q/25600575
type: Comment

sorting
tags question: http://stackoverflow.com/q/25557043
tags question: http://stackoverflow.com/q/25700557
tags question: http://stackoverflow.com/q/25692002
tags question: http://stackoverflow.com/q/25597831
tags question: http://stackoverflow.com/q/25568525
tags question: http://stackoverflow.com/q/25625867
tags question: http://stackoverflow.com/q/25552209
tags question: http://stackoverflow.com/q/25684127
tags question: http://stackoverflow.com/q/25660816
tags question: http://stackoverflow.com/q/25678029
tags question: http://stackoverflow.com/q/25691617
tags question: http://stackoverflow.com/q/25661064
tags question: http://stackoverflow.com/q/25686404
tag name: sorting
tags question: http://stackoverflow.com/q/25619575
tags question: http://stackoverflow.com/q/25680943
tags question: http://stackoverflow.com/q/25606267
tags question: http://stackoverflow.com/q/25679191
tags question: http://stackoverflow.com/q/25610851
tags question: http://stackoverflow.com/q/25691773
tags question: http://stackoverflow.com/q/25702561
tags question: http://stackoverflow.com/q/25592312
tags question: http://stackoverflow.com/q/25657440
tags question: http://stackoverflow.com/q/25702489
tags question: http://stackoverflow.com/q/25707942
tags question: http://stackoverflow.com/q/25607888
tags question: http://stackoverflow.com/q/25614256
tags question: http://stackoverflow.com/q/25690111
tags question: http://stackoverflow.com/q/25564587
tags question: http://stackoverflow.com/q/25566734
type: Tag

http://stackoverflow.com/q/25566729
has title: To find maximum numbers of 1 in a 2D array
tagged with: algorithm
has answer: http://stackoverflow.com/a/25566871
type: UnansweredQuestion
tagged with: arrays
has body: Below is my code to find the index of a row that has maximum numbers of 1 in a sorted 2D matrix. public class RowWithMax1 { public static void main(String[] args) { int a[][]={{0,1,1,1},{1,1,1,1},{0,0,1,1}}; int rows=0; int rowe=a.length-1; int cole=a.length; int cols=0; //System.out.println("len="+a.length); int index=0; int count[]=new int[a[0].length]; int k=0; int max=0; while(rows&lt;=rowe) { count[k]=0; while(a[rows][cole]==1 &amp;&amp; cole!=cols) { count[k]++; cole--; //System.out.println("cole="+cole); } System.out.println(k+" "+count[k]); if(count[k]&gt;max) { max=count[k]; index=k; } rows++; k++; cole=a.length; } System.out.println("index"+index); } } The code works fine for the first and the last row but, for the second row it gives count less than 1. For example, in the second row number of 1 is 4, but the code returns 3.
tagged with: data-structures
has answer: http://stackoverflow.com/a/25567067
score: 0
answer count: 2
tagged with: java
type: Question

http://stackoverflow.com/comment/40063225
has text: what **out.println(jsonobj)** returns. check whether its a valid json using **jsonlint** [link](http://jsonlint.com). and check whether it follows the json receive data [link](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25637701
type: Comment

http://stackoverflow.com/q/25702651
has comment: http://stackoverflow.com/comment/40175477
has comment: http://stackoverflow.com/comment/40175787
upvote count: 0
has comment: http://stackoverflow.com/comment/40175651
has comment: http://stackoverflow.com/comment/40175455
tagged with: java
answer count: 1
tagged with: file
has title: Java: (File) Scanner's first "next" adds an unknown symbol
has comment: http://stackoverflow.com/comment/40175538
downvote count: 1
has comment: http://stackoverflow.com/comment/40175758
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40175815
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40175672
has comment: http://stackoverflow.com/comment/40175491
has comment: http://stackoverflow.com/comment/40175523
score: -1
tagged with: utf-8
has body: I am working with a Scanner that scans a file for specific data in Java. The first result it gets (as the first word in a text file) should be something like test, but, it returns this word with the unknown character at the front of the word. (By that, I mean the square that appears if a character is unknown, or if it is not supported in a font, like this: ☐). The text file I am working with is encoded in UTF-8. This is the situation: Scanner scanner = new Scanner(new File("data/File.txt")); [...] scanner.next(); scanner.close(); So, what it returns is ☐test, where there should be test. Of course, the original text file features a test without such a weird sign. Thanks for your help!
has comment: http://stackoverflow.com/comment/40175556
has answer: http://stackoverflow.com/a/25703023

oracle-database
tags question: http://stackoverflow.com/q/25615641
tags question: http://stackoverflow.com/q/25626965
tags question: http://stackoverflow.com/q/25607985
tags question: http://stackoverflow.com/q/25711515
tags question: http://stackoverflow.com/q/25687972
tags question: http://stackoverflow.com/q/25657341
tags question: http://stackoverflow.com/q/25617152
tags question: http://stackoverflow.com/q/25567032
tags question: http://stackoverflow.com/q/25617097
tag name: oracle-database
tags question: http://stackoverflow.com/q/25569565
tags question: http://stackoverflow.com/q/25619803
tags question: http://stackoverflow.com/q/25601759
tags question: http://stackoverflow.com/q/25631839
tags question: http://stackoverflow.com/q/25627017
tags question: http://stackoverflow.com/q/25623458
type: Tag
tags question: http://stackoverflow.com/q/25623153
tags question: http://stackoverflow.com/q/25703203
tags question: http://stackoverflow.com/q/25569607
tags question: http://stackoverflow.com/q/25706614

android
tags question: http://stackoverflow.com/q/25665482
tags question: http://stackoverflow.com/q/25688661
tags question: http://stackoverflow.com/q/25685304
tags question: http://stackoverflow.com/q/25629258
tags question: http://stackoverflow.com/q/25566622
tags question: http://stackoverflow.com/q/25704694
tags question: http://stackoverflow.com/q/25712606
tags question: http://stackoverflow.com/q/25614272
tags question: http://stackoverflow.com/q/25683321
tags question: http://stackoverflow.com/q/25583855
tags question: http://stackoverflow.com/q/25688532
tags question: http://stackoverflow.com/q/25561865
tags question: http://stackoverflow.com/q/25581336
tags question: http://stackoverflow.com/q/25686057
tags question: http://stackoverflow.com/q/25630369
tags question: http://stackoverflow.com/q/25612741
tags question: http://stackoverflow.com/q/25593835
tags question: http://stackoverflow.com/q/25619849
tags question: http://stackoverflow.com/q/25698810
tags question: http://stackoverflow.com/q/25676361
tags question: http://stackoverflow.com/q/25607028
tags question: http://stackoverflow.com/q/25659126
tags question: http://stackoverflow.com/q/25708825
tags question: http://stackoverflow.com/q/25557255
tags question: http://stackoverflow.com/q/25692920
tags question: http://stackoverflow.com/q/25568190
tags question: http://stackoverflow.com/q/25568688
tags question: http://stackoverflow.com/q/25606355
tags question: http://stackoverflow.com/q/25710884
tags question: http://stackoverflow.com/q/25589243
tags question: http://stackoverflow.com/q/25559433
tags question: http://stackoverflow.com/q/25622650
tags question: http://stackoverflow.com/q/25569678
tags question: http://stackoverflow.com/q/25600672
tags question: http://stackoverflow.com/q/25598996
tags question: http://stackoverflow.com/q/25588325
tags question: http://stackoverflow.com/q/25679111
tags question: http://stackoverflow.com/q/25633646
tags question: http://stackoverflow.com/q/25616783
tags question: http://stackoverflow.com/q/25700074
tags question: http://stackoverflow.com/q/25568133
tags question: http://stackoverflow.com/q/25601517
tags question: http://stackoverflow.com/q/25694151
tags question: http://stackoverflow.com/q/25619234
tags question: http://stackoverflow.com/q/25566553
tags question: http://stackoverflow.com/q/25635940
tags question: http://stackoverflow.com/q/25588246
tags question: http://stackoverflow.com/q/25701601
tags question: http://stackoverflow.com/q/25674599
tags question: http://stackoverflow.com/q/25578561
tags question: http://stackoverflow.com/q/25607906
tags question: http://stackoverflow.com/q/25558864
tags question: http://stackoverflow.com/q/25645732
tags question: http://stackoverflow.com/q/25636827
tags question: http://stackoverflow.com/q/25656843
tags question: http://stackoverflow.com/q/25630040
tags question: http://stackoverflow.com/q/25613748
tags question: http://stackoverflow.com/q/25562899
tags question: http://stackoverflow.com/q/25589523
tags question: http://stackoverflow.com/q/25633806
tags question: http://stackoverflow.com/q/25690272
tags question: http://stackoverflow.com/q/25704546
tags question: http://stackoverflow.com/q/25633414
tags question: http://stackoverflow.com/q/25612978
tags question: http://stackoverflow.com/q/25704391
tags question: http://stackoverflow.com/q/25575168
tags question: http://stackoverflow.com/q/25576845
tags question: http://stackoverflow.com/q/25623961
tags question: http://stackoverflow.com/q/25699274
tags question: http://stackoverflow.com/q/25628494
tags question: http://stackoverflow.com/q/25563604
tags question: http://stackoverflow.com/q/25568896
tags question: http://stackoverflow.com/q/25650599
tags question: http://stackoverflow.com/q/25655930
tags question: http://stackoverflow.com/q/25711409
tags question: http://stackoverflow.com/q/25707710
tags question: http://stackoverflow.com/q/25710343
tags question: http://stackoverflow.com/q/25708589
tags question: http://stackoverflow.com/q/25636917
tags question: http://stackoverflow.com/q/25553777

http://stackoverflow.com/a/25588298
score: 0
has body: This line is responsible: while(gender != 0);//begin sentinel controlled while loop Look closely. There is a semi-colon at the end - that is the entire statement. The {} block that follows does not belong to the loop (and is executed exactly once). Try dropping the ; from the end - we've fixed our while loop, but now the {} loop body doesn't execute at all. This is because gender is initialized with a value of 0. So to get our loop to execute at least once we need to either initialize gender to something else, or use a do-while loop. Here is the modified code using a do-while. import java.util.Scanner; public class AdoptAPet { public static void main(String[] args) { Scanner input = new Scanner(System.in); int gender = 0; double costAdoption = 0.0; double costGenderSelect = 0.0; double costAnyGender = 0.0; double costProcessing = 0.0; double total = 0.0; int genderCounter = 0; System.out.println("Choose from the following options: 1 for male, 2 for female, 3 for any"); do //begin sentinel controlled while loop { System.out.print("Please choose the gender of the cat you wish to purchase:"); gender = input.nextInt(); if(gender &lt; 0) { System.out.println("INVALID CHOICE! "); System.out.print("enter 0 to quit: 0 or enter any other nunber to continue:"); gender = input.nextInt(); } if (gender == 1) { costAdoption = 9.50; costAdoption += costProcessing + 2.00; total += costAdoption; System.out.printf("Your Choice is: " ); System.out.printf("male and the total is $%.2f", total); } if (gender == 2) { costGenderSelect = 11.50; costGenderSelect += costProcessing + 2.00; total += costGenderSelect; System.out.printf("Your Choice is: " ); System.out.printf("female and the total is $%.2f", total); } if (gender == 3) { costAnyGender = 9.50; costAnyGender += costProcessing + 2.00; total += costAnyGender; System.out.printf("Your Choice is: " ); System.out.printf("Any gender and the total is $%.2f", total); } } while(gender != 0); //end sentinel controlled while loop } }
answers question: http://stackoverflow.com/q/25587346
type: Answer

http://stackoverflow.com/comment/40147479
type: QuestionComment
comment on: http://stackoverflow.com/q/25684276
score: 1
type: Comment
has text: There is like at least several major bugs in this little chunk of code. As others suggested you should learn a lot more before you decide to implement your own connection pooling.

http://stackoverflow.com/q/25557088
answer count: 2
tagged with: regex
has answer: http://stackoverflow.com/a/25557161
accepted answer: http://stackoverflow.com/a/25557161
has body: I have this String: "Hello, my Name is Peter.java." The desired split is: [Hello, my, Name, is, Peter.java] I split at punktuation marks but completly ignore things in these brackets. I tried: string.split("(?!\\[\\[.*\\]\\])\\s*(\\,|\\.|\\s)\\s*") but this doesnt work because the output is [Hello, my, Name, is, Peter, java]. Can you help me? Other examples: "Hello. My name is Peter.java" --&gt; [Hello, My, name, is, Peter.java] "Hi. How, are,you" --&gt; [Hi, How, are,you]
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39909584
downvote count: 0
tagged with: java
tagged with: string
favorite count: 0
type: Question
upvote count: 2
has title: Java Regex, Split String at punctuation marks except in brackets
has answer: http://stackoverflow.com/a/25557439
possible better answer: http://stackoverflow.com/a/25557439

http://stackoverflow.com/q/25617962
score: 81
linked to: http://stackoverflow.com/q/15745140
linked to: http://stackoverflow.com/q/17342850
has body: I have a question regarding how singleton beans serve concurrent requests in detail. I have searched on StackOverflow regarding this question. This is a sample link from stackoverflow, but I found only high level details. I want full details on how a singleton bean serves concurrent requests and how the system processor will see those requests. I have researched regarding concurrent request handling in the system processor online. They said the processor itself has a scheduler and that scheduler will decide which request gets processed. Ok fine. If suppose I have more than one core processor, how does the scheduler handle concurrent requests? Can anyone explain to me the step-by-step process on how a singleton bean will serve concurrent requests in the JVM and system? Let me explain with a concrete example. I have a class like Sports: class Sports { public void playFootball() { } public void playVolleyBall() { } } Two requests come in. The first request is executing the playFootball method on the created singleton instance of class Sports. At the same time, another request is executing the playVolleyBall method on the same created singleton instance of class Sports. How is it possible with a singleton instance?
tagged with: java
downvote count: 0
linked to: http://stackoverflow.com/q/26654031
tagged with: concurrency
has comment: http://stackoverflow.com/comment/40035678
has answer: http://stackoverflow.com/a/25624832
favorite count: 0
has title: How does the singleton Bean serve the concurrent request?
tagged with: multiprocessing
has answer: http://stackoverflow.com/a/59453276
type: Question
has answer: http://stackoverflow.com/a/25618070
linked to: http://stackoverflow.com/q/13776728
has answer: http://stackoverflow.com/a/25622348
upvote count: 81
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/25634505
has answer: http://stackoverflow.com/a/45871625
answer count: 6
tagged with: spring

http://stackoverflow.com/q/25702124
tagged with: java.util.scanner
upvote count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25702796
has answer: http://stackoverflow.com/a/25702291
has body: I'm trying to write a simple program to read a text file and store pair of words in a Set. Here is the code I wrote for that import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.TreeSet; public class Main { public static void main(String[] args) { TreeSet&lt;String&gt; phraseSet = new TreeSet&lt;String&gt;(); try { Scanner readfile = new Scanner(new File("data.txt")); while(readfile.hasNext("\\w{2}")) { String phrase = readfile.next("\\w{2}"); phraseSet.add(phrase); } } catch (FileNotFoundException e) { e.printStackTrace(); } for(String p : phraseSet) { System.out.println(p); } } } The code compiles but prints out a blank line (The while loop is never entered). The data.txt file contents are: There are seven words in this line. And then there are few more words in this line. I'm expecting following Strings in my TreeSet (off course in sorted order) There are are seven seven words words in in this this line line And And then then there there are .... this line
has comment: http://stackoverflow.com/comment/40174909
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25702273
tagged with: java
accepted answer: http://stackoverflow.com/a/25702291
has comment: http://stackoverflow.com/comment/40174799
has answer: http://stackoverflow.com/a/25702273
has comment: http://stackoverflow.com/comment/40176541
has comment: http://stackoverflow.com/comment/40174569
answer count: 4
has comment: http://stackoverflow.com/comment/40175527
has comment: http://stackoverflow.com/comment/40174802
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25702687
has title: Trying to read 2 words from a file in Java

http://stackoverflow.com/a/25706740
answers question: http://stackoverflow.com/q/25706655
downvote count: 0
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25706655
score: 1
type: Answer
has body: From the documentation (http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html) about the contains method of the Collection interface: Returns true if this collection contains the specified element. More formally, returns true if and only if this collection contains at least one element e such that (o==null ? e==null : o.equals(e)). o.equals(e) Calls the non-overridden method of the class Object I suggest you to override the method equals, for example public class Pessoa { @Override public boolean equals(Pessoa pessoa) { //You check if the fields are equal, if not, return false if(this.field != pessoa.field) return false; else if(this.field2 != pessoa.field2) return false; return true; } }

http://stackoverflow.com/comment/40004002
comment on: http://stackoverflow.com/a/25570418
has text: just put your url of success login to url-pattern above.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25699919
tagged with: jar
favorite count: 0
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25701810
has answer: http://stackoverflow.com/a/25709664
score: 0
answer count: 2
has title: Running opengl jogamp from jar
tagged with: opengl
has body: I've written a program that uses opengl that I have been running without issue form within eclipse, and I now want to package it up into a jar for deployment. I'm using maven to manage all the dependencies and the build process. I've done a clean and package to build a jar with all the necessary dependencies, but I'm having trouble getting it to actually run. It seem to be looking for files outside of the jar file, for example gluegen-rt.dll, which I can see is in the jar at the top level. It also seems like it's trying to reference a version of my jar with '-natives-windows-amd64' appended to the name. When I try and run it I get the following error: D:\My Documents\workspace\Cube\target&gt;java -jar cube-0.0.1-SNAPSHOT-jar-with-dependencies.jar 10 OPENGL Catched FileNotFoundException: D:\My Documents\workspace\Cube\target\cube-0.0.1-SNAPSHOT-jar-with-dependencies-natives-windows-amd64.jar (The system cannot find the file specified), while addNativeJarLibsImpl(classFromJavaJar class com.jogamp.common.os.Platform, classJarURI jar:file:/D:/My%20Documents/workspace/Cube/target/cube-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/com/jogamp/common/os/Platform.class, nativeJarBaseName cube-0.0.1-SNAPSHOT-jar-with-dependencies-natives-windows-amd64.jar): [ file:/D:/My%20Documents/workspace/Cube/target/cube-0.0.1-SNAPSHOT-jar-with-dependencies.jar -&gt; file:/D:/My%20Documents/workspace/Cube/target/ ] + cube-0.0.1-SNAPSHOT-jar-with-dependencies-natives-windows-amd64.jar -&gt; slim: jar:file:/D:/My%2520Documents/workspace/Cube/target/cube-0.0.1-SNAPSHOT-jar-with-dependencies-natives-windows-amd64.jar!/ Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: D:\My Documents\workspace\Cube\target\gluegen-rt.dll at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.load0(Unknown Source) at java.lang.System.load(Unknown Source) at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:551) at com.jogamp.common.jvm.…
upvote count: 1
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/39938588
has text: I have the compound boolean so that it checks if position (i) is an asterisk, and if it is and the letter guessed is correct it adds that letter to the new string tempString along with the other unfilled blanks. Also I forgot, in the else in my for, correctChars gets set to zero. I'll edit that. As for the static/non-static; I am not sure, as I said I'm still learning, so that's probably just me glancing over things. Does it help for those to be static?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25572146

http://stackoverflow.com/comment/40166795
has text: so the answer is `HashMap` handles `null` in special way.
comment on: http://stackoverflow.com/q/25697609
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40191720
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25705229
type: Comment
has text: I made an edit to my post, this should work, I tested it. Sorry for the wrong awnser, it was already pretty late.

http://stackoverflow.com/comment/40024677
type: AnswerComment
comment on: http://stackoverflow.com/a/25619511
has text: I agree. But may be jasper **might be** doing something internally before directly evaluating the expression, that's why I asked him to check with community. Because my last experience was with 4.5.1 and they're 5.6.0 so things might have changed. And anyway the expression in the given format is wrong. :)
type: Comment
score: 0

http://stackoverflow.com/a/25710697
has comment: http://stackoverflow.com/comment/40190434
has comment: http://stackoverflow.com/comment/40192952
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25708873
type: AcceptedAnswer
score: 6
answers question: http://stackoverflow.com/q/25708873
has comment: http://stackoverflow.com/comment/40192554
type: Answer
upvote count: 6
has body: Based on the stack trace you posted, this is almost certainly a bug in Eclipse's code generation, not the JDK. You can find this out from the javap listing of the code that captures the lambda (generated by ecj.) I think what you'll find is that it invokes the alternate metafactory (altMetafactory) which handles the unusual cases such as serializable lambdas, additional marker interfaces implemented by the lambda object, or bridge methods not handled by the target interface. For reference, the only cases where additional bridges are explicitly required are when the target interface necessitates bridges but was compiled with an older javac and therefore the bridges are not present in the interface itself, or when interactions between the target type and additional interfaces require bridges. Both are serious corner cases and should happen exceedingly rarely.
has comment: http://stackoverflow.com/comment/40193804
has comment: http://stackoverflow.com/comment/58354292

http://stackoverflow.com/comment/40039279
has text: Isn't this essentially the purpose of using a database? Why are you trying to reinvent the wheel?
comment on: http://stackoverflow.com/q/25627408
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25642806
type: Answer
answers question: http://stackoverflow.com/q/25642717
has comment: http://stackoverflow.com/comment/40066428
score: 0
has body: Move name variable declaration out of while and get the age using the last name entered. Here you go: String name while (in.hasNext()) { name = in.next(); nameArray.add(name); Integer age = in.nextInt(); names.put(name, age); } Integer value; value = names.get(name); System.out.println("the age is:" + value);

http://stackoverflow.com/q/25705950
downvote count: 1
has answer: http://stackoverflow.com/a/25705970
favorite count: 0
has answer: http://stackoverflow.com/a/25706024
type: Question
has comment: http://stackoverflow.com/comment/40181646
has body: Here is the example code, very simple. Public String method_A() throws Exception{ try{ //do something here return "result"; }catch(Exception e){ **handleException(e);** } } private void handleException(Exception e) throws Exception{ log.error("", e); throw new Exception(); } The compiler complains that "method_A" doesn't return a value. My understanding that, since in its catch block, method "handleException" always throws exception, so no need to return a value. Did I miss something here?
answer count: 5
has comment: http://stackoverflow.com/comment/40181656
has answer: http://stackoverflow.com/a/25705969
has answer: http://stackoverflow.com/a/25705972
accepted answer: http://stackoverflow.com/a/25705972
score: 2
type: AnsweredQuestion
upvote count: 3
has title: Why ask for a return value?
tagged with: java
has comment: http://stackoverflow.com/comment/40181733
possible better answer: http://stackoverflow.com/a/25705969
has answer: http://stackoverflow.com/a/25705989

http://stackoverflow.com/q/25622301
tagged with: java
duplicate of: http://stackoverflow.com/q/7196605
tagged with: jdbc
score: -1
has comment: http://stackoverflow.com/comment/40031970
has comment: http://stackoverflow.com/comment/40031911
has comment: http://stackoverflow.com/comment/40030338
upvote count: 0
has answer: http://stackoverflow.com/a/25622680
has body: I have written an application that fetching records from one DB and runs all those data in another DB to check proper error less data. ir in DB1 i have million records, My application fetches 1000 records from DB1 and runs a query in another db say DB2 with those records to find out proper data. My problem here is java by default fetches only 1000 records, but i would need to fetch minimum of 6000 records How can i do that in java, and I am using preparedStatement (My researches on google and stackoverflow says FetchSize cannot be used for prepare statement) Is there any special function or shld we write an algorithm to fetch 6000 data and add them to an ArrayList and use that in another DB ???
answer count: 1
tagged with: mysql
downvote count: 1
linked to: http://stackoverflow.com/q/7196605
favorite count: 0
type: Question
has title: Fetching more records from database using java
type: UnansweredQuestion

http://stackoverflow.com/comment/40199858
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25670077
has text: If you don't want them passed by remote reference, don't export them. You have to make up your mind.

http://stackoverflow.com/a/25571056
has comment: http://stackoverflow.com/comment/39946283
has comment: http://stackoverflow.com/comment/39935380
has body: The best way of obtaining the columns of the result set is to ask JDBC to do it for you. You do not need a ResultSet object for it - ResultSetMetaData would be enough. PreparedStatement preparedStatement = connection.prepareStatement(query); ResultSetMetaData metaData = preparedStatement.getMetaData(); for (int i = 1 ; i &lt;= metaData.getColumnCount() ; i++) { listOfColumns.add(metaData.getColumnLabel(i)); }
has comment: http://stackoverflow.com/comment/39936068
has comment: http://stackoverflow.com/comment/39935678
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/39936078
answers question: http://stackoverflow.com/q/25570907
has comment: http://stackoverflow.com/comment/39935549
score: 3
has comment: http://stackoverflow.com/comment/39935811
type: Answer

http://stackoverflow.com/comment/40062820
comment on: http://stackoverflow.com/q/25630440
type: Comment
type: QuestionComment
has text: You've been asked to list the Spring jars from your classpath. That would be a good place to start if you would want us to help you further.
score: 0

http://stackoverflow.com/a/25709137
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40187343
score: 0
has comment: http://stackoverflow.com/comment/40187403
type: Answer
has body: It is a compiler error. Java complier assumes that the loop might not be executed at all keeping the variable uninitialized. So it flags the statement with uninitialized error. Just add String sInputSlot1P1=null; Before the loop
accepted answer of: http://stackoverflow.com/q/25709103
answers question: http://stackoverflow.com/q/25709103

http://stackoverflow.com/a/25560190
has comment: http://stackoverflow.com/comment/39926889
score: 0
has comment: http://stackoverflow.com/comment/39936962
has comment: http://stackoverflow.com/comment/59594252
has comment: http://stackoverflow.com/comment/39931535
answers question: http://stackoverflow.com/q/25557263
type: Answer
has body: I would think that you need to implement the onClick() method inside the onClickListener like this: public class Login extends Activity implements OnClickListener { private EditText user, pass; private Button mSubmit, mRegister; private ProgressDialog pDialog; JSONParser jsonParser = new JSONParser(); private static final String LOGIN_URL = "http://************/tappedin/login.php"; private static final String TAG_SUCCESS = "success"; private static final String TAG_MESSAGE = "message"; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login_layout); private EditText user, pass; private Button mSubmit, mRegister; mSubmit = (Button) findViewById(R.id.butLogin); mRegister = (Button) findViewById(R.id.butRegister); mSubmit.setOnClickListener(this); mRegister.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.butLogin: new AttemptLogin().execute(); break; case R.id.butRegister: Intent i = new Intent(this, Register.class); startActivity(i); break; default: break; } } } Otherwise it's as if you don't have the onClick() method at all, and it will never execute. In fact I'm surprised that you're not receiving an error that Login doesn't implement the necessary methods.

http://stackoverflow.com/comment/40148499
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25682401
has text: I edited my code with the function where it fails.

http://stackoverflow.com/a/25605177
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25605113
downvote count: 0
has body: Most likely your code is suffering from wrong class import. Check, you may be mixing the import with org.xml.sax.ContentHandler, which is an interface and cannot be instantiated.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40000667
answers question: http://stackoverflow.com/q/25605113
type: Answer

http://stackoverflow.com/comment/39924684
has text: Looks like c code ported to java with no respect to `unsigned`
score: 0
comment on: http://stackoverflow.com/q/25565452
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25673747
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40130997
has answer: http://stackoverflow.com/a/25673868
tagged with: wait
has answer: http://stackoverflow.com/a/25675338
score: 0
has comment: http://stackoverflow.com/comment/40122591
answer count: 3
has answer: http://stackoverflow.com/a/25673819
has comment: http://stackoverflow.com/comment/40122621
tagged with: java
has title: Two thread which invokes wait and notify
type: Question
has comment: http://stackoverflow.com/comment/40122656
has body: The code I've witten doesn't work as I expected. static Integer sync = 1; static void m() throws Exception { synchronized (sync) { System.err.println("First"); sync.notify(); sync.wait(1000L); System.err.println("Second"); System.err.println("Third"); } } public static void main(String[] args) throws Exception { Runnable r = new Runnable() { @Override public void run() { try { m(); } catch (Exception ex) { Logger.getLogger(IO.class.getName()).log(Level.SEVERE, null, ex); } } }; Runnable t = new Runnable() { @Override public void run() { try { m(); } catch (Exception ex) { Logger.getLogger(IO.class.getName()).log(Level.SEVERE, null, ex); } } }; Thread th1 = new Thread(r); Thread th2 = new Thread(t); th1.run(); th2.run(); } We have two threads which execute m()'s syncjronized statement. When the first thread executes one and come across the wait() it'll be added to the wait set. After this, the second thread is starting to execute the synchronized statement, and perform notify(). Since the output must be First First .... But actually it is First Second Third First Second Third Why?
type: UnansweredQuestion

http://stackoverflow.com/a/25610764
type: AcceptedAnswer
has body: It could be useful if your servlet was packaged in a jar for use by another user, who could then set the input parameters to their own specification in their own servlet definition. If you hard coded it, they could not otherwise 'configure' your servlet.
score: 3
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/25610636
has comment: http://stackoverflow.com/comment/40008401
answers question: http://stackoverflow.com/q/25610636
has comment: http://stackoverflow.com/comment/40008439
has comment: http://stackoverflow.com/comment/40008361
downvote count: 0

http://stackoverflow.com/a/25608505
upvote count: 1
has body: You just need to declare your array as an array of type T where T is a superclass of all the classes of the objects you want to fill it with. In the worst case, it would be Object but it's bad design 9 times out of 10.
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25608453
downvote count: 0

http://stackoverflow.com/q/25600223
answer count: 1
tagged with: selenium
has title: Not able to run selenium script through testng
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/39999117
has body: I have written a simple script in selenium. I am using Testng. I created a xml file where I mentioned suit name and class name. Xml file code is as <?xml version="1.0" encoding="UTF-8"?> <class name="additional.wikipediaTEst"/> Now when I try to run this by right clicking inside xml file, text box for selecting suite is disabled. How this would be enable.
accepted answer: http://stackoverflow.com/a/25605498
has answer: http://stackoverflow.com/a/25605498
has comment: http://stackoverflow.com/comment/39989518
has comment: http://stackoverflow.com/comment/39997282
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/q/25702088
type: Question
has comment: http://stackoverflow.com/comment/40260313
has comment: http://stackoverflow.com/comment/40177288
has body: I've got a simple test application which connects to a USB device (as a local file), transmits a start transmission character, and then reads the input from the device. This all works fine, but infrequently it would block on the read() call. To prevent this I attempted to check whether there are at least 1 available bytes before proceeding with the read() operation. However when I run this I get an IOException from the available() call. My code is: public static void testRecord() { // Records data for a second String portName = "\\\\.\\&lt;DEVICE_FILE&gt;"; FileWriter out = null; byte singleByte; long startTime = System.currentTimeMillis(); try { out = new FileWriter(portName); out.write('c'); // start data transmission out.write(0x0d); // carriage return required out.flush(); if (out != null) out.close(); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(portName), 512); System.out.println("Connected to device"); while(System.currentTimeMillis() &lt; startTime+1000) { avail = bis.available(); if (!(avail &gt; 0)) { System.out.println("Available: " + avail); continue; } singleByte = (byte) bis.read(); // Do stuff with data } if (bis != null) bis.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("ERROR"); } } The Error trace is: Connected to device java.io.IOException at java.io.FileInputStream.available(Native Method) at java.io.BufferedInputStream.available(Unknown Source) at test.Test.testRecord(Test.java:58) at test.Test.main(Test.java:135) ERROR Am I doing something wrong? If I comment out the available() call it works perfectly aside from the issue that it blocks on read() approximately once every 50 runs. I've also tried implementing the reader as a BufferedReader over a InputStreamReader (as the data is ASCII) and using the ready() method of BufferedReader but that always returns false. EDIT: I'm looking at alternatives to checking if there is data available before reading, most o…
has comment: http://stackoverflow.com/comment/40176335
accepted answer: http://stackoverflow.com/a/25748327
has comment: http://stackoverflow.com/comment/40174454
tagged with: bufferedinputstream
tagged with: usb
has comment: http://stackoverflow.com/comment/40176982
has comment: http://stackoverflow.com/comment/40220953
has comment: http://stackoverflow.com/comment/40176330
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40175997
linked to: http://stackoverflow.com/q/804951
has comment: http://stackoverflow.com/comment/40186978
has title: Java available bytes for BufferedInputStream isn't working
tagged with: java
has comment: http://stackoverflow.com/comment/40256640
has answer: http://stackoverflow.com/a/25748327
score: 1
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40174880
has comment: http://stackoverflow.com/comment/40174398
tagged with: bufferedreader
upvote count: 1
has comment: http://stackoverflow.com/comment/40175990
favorite count: 0

http://stackoverflow.com/comment/99899346
type: AnswerComment
comment on: http://stackoverflow.com/a/25621634
score: 0
type: Comment
has text: @shareef This is because you were trying this on Servlet API <3.0 - but the method `getServletContext()` was only added to `HttpServletRequest` in Servlet API 3.0.

http://stackoverflow.com/q/25589916
tagged with: spring-mvc
upvote count: 4
tagged with: java
has comment: http://stackoverflow.com/comment/39970374
answer count: 1
downvote count: 0
has body: I am creating application with spring aspect but in app engine when I hit first request then exception occurs while initialize spring framework. Exception stack trace is as below: SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminController' defined in file [PATH\PACKAGE\AdminController.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.reflect") My Aspect @Aspect @Component public class AuthorizationAspect { @Around(value="@annotation(org.springframework.web.bind.annotation.RequestMapping)") public Object interceptApplicationRequest( ProceedingJoinPoint proceedingJoinPoint) throws Throwable { System.out.println("test"); return proceedingJoinPoint.proceed(); } } My Controller @Controller @RequestMapping(value="/admin") public class AdminController { @RequestMapping(value = "/add", method = RequestMethod.GET) public ModelAndView add(){ ModelAndView mv = new ModelAndView("add"); return mv; } } Configuration in XML &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd http://www.springframework.org/schema/aop http:/…
has comment: http://stackoverflow.com/comment/39970266
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39970727
has comment: http://stackoverflow.com/comment/39970342
type: UnansweredQuestion
tagged with: google-app-engine
has title: appengine spring aop java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.reflect")
has comment: http://stackoverflow.com/comment/42436324
tagged with: spring
has answer: http://stackoverflow.com/a/26983063
score: 4

http://stackoverflow.com/a/25687272
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25686404
has comment: http://stackoverflow.com/comment/40218713
has comment: http://stackoverflow.com/comment/40148874
type: Answer
has comment: http://stackoverflow.com/comment/40148164
has body: Are you sure that List&lt;Map&lt;String, String&gt;&gt; is the approriate data type you want? To me it looks like you are in fact looking simplify for TreeMap&lt;String, String&gt; i.e. a sorted map key -> value? Or do you mean to use a List&lt;StringPair&gt; (for that, please choose a more appropriate name than StringPair, and implement that class to your needs)? I have the impression that in lack of an obvious Pair&lt;String, String&gt; class in Java you have been abusing SimpleBinding as a pair class. The proper way to have pairs in Java is to implement a new class, with a proper class name - "pair" is technical, not semantic. You could also do List&lt;String[]&gt; and implement a Comparator&lt;String[]&gt; for sorting. But that doesn't save you any work over implementing a NamePair class and making it comparable yourself.
has comment: http://stackoverflow.com/comment/40147790
has comment: http://stackoverflow.com/comment/40147643
accepted answer of: http://stackoverflow.com/q/25686404

http://stackoverflow.com/comment/40231249
has text: I'm emailing you the project shortly - its as simple as I could make it. I'm not sure if you use gradle/sbt/maven or just ant. I'm going to simplify the package the best I can.
comment on: http://stackoverflow.com/a/25729269
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25636464
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25636311
score: 3
has comment: http://stackoverflow.com/comment/40058743
upvote count: 3
type: AcceptedAnswer
has body: You can use ImageGetter to get image from drawable resource. ImageGetter imageGetter = new ImageGetter() { @Override public Drawable getDrawable(String source) { Drawable d = getResources().getDrawable(R.drawable.yourimage); d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); return d; } }; Spanned spanned = Html.fromHtml( " ", imageGetter, null); now set it to TextView textView.setText(spanned); Edit No Friends.. #### //#### to replace with image String s=res.getString(R.string.nofriends); s=s.replace("####",spanned); textView.setText(s);
accepted answer of: http://stackoverflow.com/q/25636311

opengl-es
tags question: http://stackoverflow.com/q/25644714
tags question: http://stackoverflow.com/q/25584032
tags question: http://stackoverflow.com/q/25648386
type: Tag
tag name: opengl-es
tags question: http://stackoverflow.com/q/25641393

http://stackoverflow.com/comment/39913319
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25559312
has text: the Exception is thrown at the moment when I try to authorize the credentials to start working with the Calendar API, the rest of my program is about petitions to a bluehost server via json, so, do you think that I need to install tomcat on every pc?

http://stackoverflow.com/comment/40064624
type: AnswerComment
score: 0
has text: yes, you need to add 'action' after 'net.sf.japi.swing': 'net.sf.japi.swing.action'.
comment on: http://stackoverflow.com/a/25640505
type: Comment

http://stackoverflow.com/comment/39971950
type: Comment
has text: Please add some comments to your answer, what was wrong and how it should be fixed
type: AnswerComment
comment on: http://stackoverflow.com/a/25590678
score: 1

http://stackoverflow.com/q/25679546
tagged with: clr
tagged with: java
downvote count: 3
has title: Is this memory ever claimed back before program stops in C/C++?
has body: Note: This is a hypothetical situation I am creating to understand the functioning of program and malloc in C/C++. Let us say that I allocated 10k integers and they all got allocated contiguously in the memory. Now, I free every alternate element in these 10k integers. Now, I want to allocate a long integer which requires 8 bytes. Since none of the above 5k locations have 8 bytes contiguously, does the program allocate this variable a new memory location? If in future I am going to use only > 4 byte locations then am I just wasting this entire memory? Or does the compiler take necessary steps so that these remaining 5k locations will be contiguous later? EDIT: To those who marked this as a duplicate. Okay, let us say that it uses paging and it is taking care of fragmentation by remapping the pages to contiguous blocks in physical memory. Even then, it would mean that in virtual memory all those address locations are no longer usable right? So, those memory locations are not usable? Yes I understand that this is a problem of fragmentation etc. My question is the following: Is there any way the run-time program might know that this issue arises and somehow try and manage its resources in a good way? Since C is a totally compiled language, I don't think this is possible. Does JAVA or C# run-time environment do things like this? Reorganizing their objects such that they take up a contiguous block of memory in their heap space? And if that happens, do they have to change values of every referencing variable? Since their position on the heap (and effectively their address) is changing?
has comment: http://stackoverflow.com/comment/40133202
favorite count: 0
linked to: http://stackoverflow.com/q/3770457
type: Question
tagged with: memory-management
has comment: http://stackoverflow.com/comment/40133002
has comment: http://stackoverflow.com/comment/40133223
type: UnansweredQuestion
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/40133072
duplicate of: http://stackoverflow.com/q/3770457
upvote count: 1
has answer: http://stackoverflow.com/a/25679596
tagged with: c++
has comment: http://stackoverflow.com/comment/40204185
has comment: http://stackoverflow.com/comment/40133047

http://stackoverflow.com/comment/40390948
score: 0
type: QuestionComment
has text: IDEA is only available in the "-ext" versions of the bouncycastle provider.
comment on: http://stackoverflow.com/q/25686095
type: Comment

http://stackoverflow.com/q/25686892
has comment: http://stackoverflow.com/comment/40146906
type: Question
has body: Problem: I have created a Desktop Application with Java and SWT/JFace. The project contains design, action, util and model classes. Created executable jar, All works fine but now i am facing some branding and endorsing issue i.e. - Minimize should display in task bar. - Running executable jar is showing as a javaw.exe in task manager list not with its name. - On alt + tab application appear as unknown exe Now I want a suggestion. Can these issue be solved easily without impacting a lot if yes then please provide needed clue? or should I go to Eclipse RCP plugin productization which can handle all above means. If sole answer is No, Then please suggest an optimize way to migrate to eclipse RCP. it would be nice if you point action list as I am new in such productization. Update As i have created GUI by SWT/Jface and, using main as entry point I have created its executable jar, is this creating problem that i hav mentioned above?
answer count: 0
has title: Issue in creating executable jar for SWT/Jface Application
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40204731
tagged with: swt
tagged with: production-environment
has comment: http://stackoverflow.com/comment/40147362
has comment: http://stackoverflow.com/comment/40146357
tagged with: jface
tagged with: eclipse-rcp
score: 0
has comment: http://stackoverflow.com/comment/40241174
has comment: http://stackoverflow.com/comment/40147045
has comment: http://stackoverflow.com/comment/40147313
tagged with: java
has comment: http://stackoverflow.com/comment/40147791
has comment: http://stackoverflow.com/comment/40146299
has comment: http://stackoverflow.com/comment/40204567

http://stackoverflow.com/q/25688558
tagged with: java
type: Question
tagged with: jasper-reports
has body: I am new to java. I tried to display jasper Report in Jdesktoppane but report Does not display in jdesktoppane.I cant get any error or Exception while run the program how to slove this problem.. Any one help me to display report in jdesktoppane private void Report() { try { JasperDesignjd=JRXmlLoader.load("F:\\NetBeans\\Project\\Chit\\src\\Report\\report1.jrxml"); JasperReport jr=JasperCompileManager.compileReport(jd); JasperPrint jp=JasperFillManager.fillReport(jr, null,chit1.conn); JRViewer viewer = new JRViewer(jp); jPanel1.add(viewer); jPanel1.setVisible(true); jDesktopPane.add(viewer); } catch (JRException ex) { System.out.println(ex); } } Thank you..
has answer: http://stackoverflow.com/a/25689002
type: UnansweredQuestion
has title: Jasper Report not display in jdesktoppane
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25702933

http://stackoverflow.com/q/25652091
has comment: http://stackoverflow.com/comment/40083699
has comment: http://stackoverflow.com/comment/40083715
answer count: 3
has comment: http://stackoverflow.com/comment/40083578
upvote count: 2
has comment: http://stackoverflow.com/comment/40083705
has comment: http://stackoverflow.com/comment/40083745
has comment: http://stackoverflow.com/comment/40083697
downvote count: 0
has comment: http://stackoverflow.com/comment/40084509
tagged with: methods
tagged with: variables
has comment: http://stackoverflow.com/comment/40083642
has comment: http://stackoverflow.com/comment/40083729
favorite count: 0
has answer: http://stackoverflow.com/a/25652498
type: Question
has answer: http://stackoverflow.com/a/25652515
has answer: http://stackoverflow.com/a/25652502
has comment: http://stackoverflow.com/comment/40083529
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40083457
linked to: http://stackoverflow.com/q/25651066
has title: Passing Variables to Extended Class and Calling Methods
has body: I am at a complete loss right now. I am trying to develop a program that will display the Months, Account #, and Balance of two savings accounts and update the Balance as interest on the accounts is accrued: For the first account 10,002 interest is accrued monthly with a yearly interest rate of 1.2%. For the second account 10,003 interest is accrued quarterly with a yearly interest rat of 4%. I have to design four individual classes in order to do this. SavingsAccount, SavingsAccountDriver, FlexibleSavingsAccount, and CDSavingsAccount. SavingsAccount is the parent class of both FlexibleSavingsAccount and CDSavingsAccount. SavingsAccountDriver is the Main class. In SavingsAccount I have a method setAnnualInterestRate() that is called in SavingsAccountDriver. This method sets the interest rate for each account. The problem I am having is passing this value to the extended classes FlexibleSavingsAccount and CDSavingsAccount so that I can update the balance by adding the interest rate for each account. If anyone could please assist me on how this is done I would greatly appreciate it. SavingsAccountDriver: public class SavingsAccountDriver { public static void main (String[] args) { SavingsAccount saver1 = new SavingsAccount(10002, 2000); //create new SavingsAccount object SavingsAccount saver2 = new SavingsAccount(10003, 3000); //create new SavingsAccount object saver1.setAnnualInterestRate(.012); //sets AnnualInterestRate for 'saver1' object saver2.setAnnualInterestRate(.04); //sets AnnualInterestRate for 'saver2' object System.out.println("\nMonthly balances:\n"); System.out.println("Month " + " Account# " + " Balance " + " " + " Month " + " Account# " + " Balance "); System.out.println("----- " + " -------- " + " ------- " + " " + " ----- " + " -------- " + " ------- "); System.out.println(saver1.getAccountNumber() + " / " + saver1.getBalance() + " / " + saver1.getInterest()); System.out.println(saver2.getAccountNumber() + " / " + saver2.getBalance() + " / " + saver…
score: 2

http://stackoverflow.com/q/25689161
answer count: 2
has answer: http://stackoverflow.com/a/25692420
type: UnansweredQuestion
tagged with: subclipse
tagged with: svnkit
score: 0
has answer: http://stackoverflow.com/a/25720815
has comment: http://stackoverflow.com/comment/40150526
tagged with: svn
tagged with: java
has body: I would like to know for a specific local workspace file, the corresponding svn reposity path. My files are extracted from multiple repository, and placed in different projects of my eclipse workspace. Right clicking on them, selecting properties -> Subversion -> Url I can read the path I'm looking for. I need to read this path with java class. I think some information are stored in an hidden .svn folder contained in the root of each project. Can anyone tell me from where subclipse read the svn path of each file (or how build it).. Later I will use svnkit to automatically make some operation on file of my workspace, using that information. But I would like to get the svnpath of any file, dinamically. Thank you!
tagged with: eclipse
has title: reading subclipse repository path with java
type: Question

http://stackoverflow.com/q/25602465
possible better answer: http://stackoverflow.com/a/25603020
tagged with: swing
accepted answer: http://stackoverflow.com/a/25604928
has comment: http://stackoverflow.com/comment/39994556
has answer: http://stackoverflow.com/a/25604928
has comment: http://stackoverflow.com/comment/39993667
type: AnsweredQuestion
has body: I think my problem has a simple solution but I am new to Java programming so I wasn't able to solve it myself, I have this jSpinner that I used as time picker. What I need is to pass this jSpinner's value to a string. Please help me do this. Thank you very much in advance for your help! This is the code of the Spinner Spintimetoplay = new javax.swing.JSpinner(); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 24); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); SpinnerDateModel model = new SpinnerDateModel(); model.setValue(calendar.getTime()); JSpinner Spintimetoplay = new JSpinner(model); JSpinner.DateEditor editor = new JSpinner.DateEditor(Spintimetoplay, "HH:mm"); DateFormatter formatter = (DateFormatter)editor.getTextField().getFormatter(); formatter.setAllowsInvalid(false); formatter.setOverwriteMode(true); Spintimetoplay.setEditor(editor); Whenever I used .getValue() as some suggestions said it gives me 0 value rather than 00:00(for example).
tagged with: jspinner
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25603020
favorite count: 0
type: Question
has title: Passing SpinnerDateModel formatted value to String
has comment: http://stackoverflow.com/comment/39994091
answer count: 2
has comment: http://stackoverflow.com/comment/39994299
downvote count: 0

http://stackoverflow.com/comment/40007043
comment on: http://stackoverflow.com/a/25610026
score: 0
type: AnswerComment
type: Comment
has text: @WisdomOrji In that case, you can rely on the fact that all the numbers in the arrays are between 0 and 19. `z` can be an array of 20 booleans, and when you find that x[i]==y[j], set z[x[i]] to true.

http://stackoverflow.com/a/25621965
type: Answer
answers question: http://stackoverflow.com/q/25621722
score: 0
has comment: http://stackoverflow.com/comment/40028862
has body: One of the way which is pure OOP is to use a full constructor (without id) public User(String username, String password, Boolean isAdmin) { this.username = username; this.password = password; this.isAdmin = isAdmin; } Now, you can initialize the field before you save it to the database.
has comment: http://stackoverflow.com/comment/40028936

http://stackoverflow.com/a/25677564
answers question: http://stackoverflow.com/q/25677479
accepted answer of: http://stackoverflow.com/q/25677479
downvote count: 0
type: Answer
score: 3
upvote count: 3
type: AcceptedAnswer
has body: A component may only reside within a single parent, adding a component to another container will remove it from the first, so basically, nothing resides within your JPanel anymore... JFrame by default, uses a BorderLayout, which means that only one component can occupy any of the five available spaces it provides. What's happening with your code is b9, been the last component added to your frame, is the only component been displayed. BorderLayout is providing b9 with the full available space to it. Start by taking a look at Laying Out Components Within a Container. You may need to use multiple layouts in order to achieve what you want, but this allows you to separate responsibility and isolate the individual requirements of each section of your interface

http://stackoverflow.com/q/25708689
has answer: http://stackoverflow.com/a/25709777
type: AnsweredQuestion
has title: Where is the source code of CallObjectMethod in jni.h
upvote count: 0
has body: I searched for the method definition of CallObjectMethod method declared in the file jni.h in OpenJDK 8. However, I can't find it. Where is the source code of the method CallObjectMethod? I am studying JDK for the aim of researching. I need to know the JDK entirely.
answer count: 1
downvote count: 1
tagged with: jvm
favorite count: 0
type: Question
tagged with: java-native-interface
tagged with: java
accepted answer: http://stackoverflow.com/a/25709777
score: -1

http://stackoverflow.com/q/25682471
has comment: http://stackoverflow.com/comment/40170485
has comment: http://stackoverflow.com/comment/40195531
accepted answer: http://stackoverflow.com/a/25730735
tagged with: java
has comment: http://stackoverflow.com/comment/40227103
type: Question
has comment: http://stackoverflow.com/comment/40193524
upvote count: 3
tagged with: scala
tagged with: intellij-idea
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25730735
has body: When creating a sbt project using IntelliJ IDEA 13.1.4 with the Scala plugin 0.41.2 on Mac OS X 10.9.4, the following error has occurred: [warn] problem while downloading module descriptor: http://repo1.maven.org/maven2/org/scalatest/scalatest_2.11/2.2.1/scalatest_2.11-2.2.1.pom: /Users/.../.ivy2/cache/org.scalatest/scalatest_2.11/ivy-2.2.1.xml.original.part (Permission denied) (384ms) which prevents refreshing project dependencies. What could be the issue and a solution?
has title: Why does creating sbt project in IntelliJ IDEA cause "Permission Denied"?
favorite count: 0
type: AnsweredQuestion
score: 3
tagged with: sbt

http://stackoverflow.com/comment/39935880
type: QuestionComment
score: 0
has text: thanks for the responses, actually I'm creating a Specific Utility class that will do something for a Person and its sub-classes(Students etc), but I can only access the properties of Person with this kind of design(e.g access the properties of sub-classes of the type parameter Person), so I'm trying to investigate if I can do it with this kind of approach, the actual name of the Utility class is "EntityPropertiesValidator<Person>" you can already guess what this class might do for Person and its subclasses ("EntityPropertiesValidator<Student>"
comment on: http://stackoverflow.com/q/25570889
type: Comment

http://stackoverflow.com/q/25613223
tagged with: arrays
linked to: http://stackoverflow.com/q/2927391
duplicate of: http://stackoverflow.com/q/529085
has answer: http://stackoverflow.com/a/25613390
score: 0
has answer: http://stackoverflow.com/a/25613389
tagged with: java
has body: I have for example the following class public class MyClass&lt;T&gt; { private int id; T content; } and in other part of my project I want to create a method that return Myclass&lt;byte[]&gt;[] I wrote this code Myclass&lt;byte[]&gt;[] tempArray=new Myclass&lt;byte[]&gt;[4]; > the eclipse says "cannot create a generic array of Myclass&lt;byte[] anyone knows how to solve it?
tagged with: generics
has title: how can I create a regular array that contain a generic type I created in java?
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/529085
type: UnansweredQuestion

http://stackoverflow.com/comment/40047873
type: QuestionComment
comment on: http://stackoverflow.com/q/25631550
score: 0
has text: The presence of '\u0085' suggests that the file is in the "windows-1252" charset (or another Windows charset that uses the 128-159 codepoints), but your BufferedReader was constructed around a FileReader or InputStreamReader with no charset (or an incorrect charset). Specify "windows-1252" as a charset and your regex will not need to change.
type: Comment

http://stackoverflow.com/comment/39931553
type: Comment
type: QuestionComment
has text: @Benjamin Before the op can use jstl, he has to import the jstl core libraries into the jsp files.
score: 0
comment on: http://stackoverflow.com/q/25568711

http://stackoverflow.com/comment/40014067
type: AnswerComment
comment on: http://stackoverflow.com/a/25613818
type: Comment
has text: Having done some further research I note that an Android convention seems to be for callbacks to happen on the UI thread. If I do that, that would be one solution. Another approach I could do is make more use of the Android Looper and Handler classes. When I get more time tomorrow I'll try to expand on my question with some more concrete information about what I'm doing as I'd value any direction.
score: 0

http://stackoverflow.com/a/25711386
answers question: http://stackoverflow.com/q/25711067
has body: Java compiles generics using type erasure. If the type is not bound, the compiler treats instances of the parameterized type as being an Object instance. To solve that, you have to bind the type to some super-type having the desired method: interface Record { ... } class Table&lt;T extends Record&gt; { ... } Once bound, the compiler know that you can call any method of Record on an instance of type T. In addition, it will reject any attempt to instantiate a Table with a parameterized type that is not a sub-class of Record. Whereas, in your original code, your Table object may be instantiated with any type parameter (which was probably not the desired behavior).
score: 0
type: Answer

http://stackoverflow.com/comment/39955755
has text: I see only one file, please post the related code example.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25581842
type: QuestionComment

http://stackoverflow.com/comment/40064154
score: 0
type: Comment
has text: I cannot find an 'off by one' error for any input value using your code. Can you give me an example. (Obviously I cannot test all input values :)
comment on: http://stackoverflow.com/a/25584690
type: AnswerComment

http://stackoverflow.com/q/25702283
upvote count: 1
tagged with: android
score: 1
tagged with: java
has title: Java - convert MGRS coordinate to LatLon WGS
tagged with: coordinate-transformation
favorite count: 0
type: Question
has body: For my App I need compact code for converting between LatLon (WGS84) and MGRS. JCoord.jar: Looks great, but the version 1.1 jar is 0.5Mb in size. That is doubles my App for only perfoming a 2-way conversion of coordinates. Openmap: Isolating just the MGRSPoint.java (https://code.google.com/p/openmap/source/browse/src/openmap/com/bbn/openmap/proj/coords/MGRSPoint.java) from the rest is not easy. GeographicLib: This seems a good solution, but I could not find a Java source file. Is it available for usage? Nasa: The Nasa code looks great, see http://worldwind31.arc.nasa.gov/svn/trunk/WorldWind/src/gov/nasa/worldwind/geom/coords/MGRSCoordConverter.java. Isolating just the MGRS conversion code was not easy. GDAL: Was implemented in another programming language. IBM (via j-coordconvert.zip): Is complact, suits well for the UTM conversion, but the MGRS conversion is described to be errorneous. Alas. Is there a good (compact) Java source for converting between LatLon/wgs84 and MGRS?
downvote count: 0
has answer: http://stackoverflow.com/a/25712032
accepted answer: http://stackoverflow.com/a/25712032
answer count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/50328303
type: Comment
score: 0
type: AnswerComment
has text: @nawfal: the Java syntax is `myList.forEach(System.out::println)`. It’s because `System.out` is an expression which evaluates to a `PrintStream` instance and `::println` is a *method reference* pointing to an instance method named `println` within `PrintStream`.
comment on: http://stackoverflow.com/a/25567047

http://stackoverflow.com/comment/39912380
comment on: http://stackoverflow.com/q/25558414
score: 0
type: Comment
type: QuestionComment
has text: @assylias I have tried with simple logback.xml, see update. But not worked

http://stackoverflow.com/q/25669197
type: Question
has comment: http://stackoverflow.com/comment/40120423
has comment: http://stackoverflow.com/comment/40114496
has comment: http://stackoverflow.com/comment/40114790
tagged with: windows
tagged with: java
score: 0
answer count: 0
tagged with: on-the-fly
type: UnansweredQuestion
has body: I have made an encryption system and I'm looking for a way to add some way to integrate it with file system on windows(if possible also on linux). I don't want to rise a debate whether it is needed, that it already exists etc... I was hoping to find a way to mount a virtual disk drive that will be able to access the files in the decrypted form, encrypt and decrypt on the fly using my software, it is currently written in java, but if needed I can port it to c++. I have found one way to do it, which is to run a java ssh server and use another software to mount it in windows, but it doesn't work work well, constant crashes or it sometimes just doesn't mount the drive. I need it as I want to access the files using IDE and other programs without coping the files as it decreases the security and doubles the disk space used. Has anyone found a way to do it preferably in java? Is there some kind of API for it (all I need is list files, get parent, read file, write file)? Or is there a good java lib what works with another program to do it?
tagged with: encryption
has title: Java encryption on-the-fly by virtual drive

http://stackoverflow.com/comment/40190776
comment on: http://stackoverflow.com/q/25711035
type: Comment
type: QuestionComment
has text: @Evan: ah, I thought it looked a little wrong, bit I assumed they were just custom methods.
score: 0

http://stackoverflow.com/a/25656459
has body: Instead of using a finalizer, which carries a performance impact alongside being rather easy to get wrong, why not store a PhantomReference to the created object inside the factory? From the Javadocs: Phantom references are most often used for scheduling pre-mortem cleanup actions in a more flexible way than is possible with the Java finalization mechanism. You could have the factory track the associated ReferenceQueue for that reference, and once the object is enqueued, perform the cleanup actions ordinarily done by undo.
has comment: http://stackoverflow.com/comment/40118343
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25655611
has comment: http://stackoverflow.com/comment/40121659
has comment: http://stackoverflow.com/comment/40112385
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25655611
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40056194
type: AnswerComment
comment on: http://stackoverflow.com/a/25636931
has text: It doesn't necessarily have to be a `String`. Oh, and they've just updated their question.
score: 0
type: Comment

http://stackoverflow.com/q/25676854
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/25676884
tagged with: string
downvote count: 1
has title: Print all occurrences of vowels in a sentence
favorite count: 0
has body: I wrote a method that should print all vowels in the sentence. But it seems that my code only returns one occurrence of a vowel. I need to return all the occurrences in a string. How do I make the output an appended string? public String getVowels() { for (int i=0; i &lt;MyString.str.length(); i++) { c = MyString.str.charAt(i); if ((MyString.str.charAt(i) == 'a') || (MyString.str.charAt(i) == 'e') || (MyString.str.charAt(i) == 'i') || (MyString.str.charAt(i) == 'o') || (MyString.str.charAt(i) == 'u')) { vowels = String.valueOf(c); } } return vowels; }
tagged with: java
score: -1
tagged with: append
type: Question
tagged with: return
upvote count: 0

http://stackoverflow.com/a/39782281
answers question: http://stackoverflow.com/q/25558174
score: 3
type: Answer
upvote count: 3
downvote count: 0
has body: You need to set the advertised.host.name instead of host.name in the kafka server.properties configuration file.

http://stackoverflow.com/q/25643893
has body: what I'm trying to accomplish is to inject some spring repository object from context to any template. There is already possibility to call any method from anywhere, including templates, but "any method" must be defined as static, in such case, from template we can call @Class.staticMethod(). I want to do same thing but I need retrieve the "Class" from spring context
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25647036
has title: PlayFramework how to inject object to a template
accepted answer: http://stackoverflow.com/a/25647036
tagged with: playframework
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: spring-data

http://stackoverflow.com/a/35457198
answers question: http://stackoverflow.com/q/25598594
score: 3
type: Answer
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/72029710
has body: I got exactly the same problem after an unexpected power loss. Solutions mentioned before did not work so I compared the .metadata\.plugins\org.eclipse.core.resources folder with a backup. The backup did not have the .snap file which was present in the current workspace. After deleting this file, Eclipse did start again. (I first have tried the solution of Kainda, which did not work to me but did result in no open Editor tab's.) Eclipse version: Luna Release (4.4.0)

http://stackoverflow.com/comment/40157643
score: 0
type: Comment
has text: I updated my response with a batch processing design proposal.
type: AnswerComment
comment on: http://stackoverflow.com/a/25636666

http://stackoverflow.com/q/25598974
has comment: http://stackoverflow.com/comment/39986686
has answer: http://stackoverflow.com/a/25599193
has answer: http://stackoverflow.com/a/25598997
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/39986767
answer count: 3
downvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/39986675
has body: I need help with calling methods from definition class using an array in main method. public class Student{ private String id; public void setId(String id){ this.id=id; } public String getId(){ return id; } } and in main, with an array of students like this, public static void main(String[] args){ int numOfStudent=0; Student[] students = new Student[numOfStudent]; students[numOfStudent].setId(JOptionPane.showInputDialog("Enter id:")); numOfStudent++; } I keep getting an error message saying "java:6: error: cannot find symbol students[numOfStudent].setId(JOptionPane.showInputDialog("Enter id:")); symbol: variable JOptionPane location: class Whatever 1 error " what is the problem here??
favorite count: 0
has answer: http://stackoverflow.com/a/25598995
type: Question
has title: calling a method from another class using an array
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/40149574
type: Comment
comment on: http://stackoverflow.com/a/25682082
type: AnswerComment
has text: @Sotirios Delimanolis: You mean the binary search tree for hash collisions? It’s for improving the lookup performance in the first place. However it made certain other attempts of the past obsolete, which may improve the overall performance. E.g. earlier versions applied an improvement algorithm on every hashcode which now has been simplified.
score: 0

http://stackoverflow.com/a/25688118
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25688078
has body: If there is no constructor, there is default constructor, which also calls super's default constructor. But when you created constructor in parent, there is no default constructor in parent.

http://stackoverflow.com/a/25561128
has comment: http://stackoverflow.com/comment/39944381
answers question: http://stackoverflow.com/q/25556865
has comment: http://stackoverflow.com/comment/39945337
has comment: http://stackoverflow.com/comment/39948072
has comment: http://stackoverflow.com/comment/39932872
has comment: http://stackoverflow.com/comment/40308288
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25556865
has comment: http://stackoverflow.com/comment/39945639
type: Answer
has body: You should not have a Thread for each individual ball, this will not scale well, the more balls you add, the more threads you add. At some point, the amount of work it takes to manage the threads will exceed the benefit for using multiple threads... Also, I doubt if your need 1000fps...something like 25fps should be more than sufficient for your simple purposes. This will give the system some breathing room and allow other threads within the system time to execute. Lets start with a simple concept of a Ball. The Ball knows where it is and which direction it is moving it, it also knows how to paint itself, for example... public class Ball { private int x; private int y; private int deltaX; private int deltaY; private int dimeter; private Ellipse2D ball; private Color color; public Ball(Color color, Dimension bounds) { this.color = color; Random rnd = new Random(); dimeter = 5 + rnd.nextInt(15); x = rnd.nextInt(bounds.width - dimeter); y = rnd.nextInt(bounds.height - dimeter); if (x &lt; 0) { x = 0; } if (y &lt; 0) { y = 0; } int maxSpeed = 10; do { deltaX = rnd.nextInt(maxSpeed) - (maxSpeed / 2); } while (deltaX == 0); do { deltaY = rnd.nextInt(maxSpeed) - (maxSpeed / 2); } while (deltaY == 0); ball = new Ellipse2D.Float(0, 0, dimeter, dimeter); } public void update(Dimension bounds) { x += deltaX; y += deltaY; if (x &lt; 0) { x = 0; deltaX *= -1; } else if (x + dimeter &gt; bounds.width) { x = bounds.width - dimeter; deltaX *= -1; } if (y &lt; 0) { y = 0; deltaY *= -1; } else if (y + dimeter &gt; bounds.height) { y = bounds.height - dimeter; deltaY *= -1; } } public void paint(Graphics2D g2d) { g2d.translate(x, y); g2d.setColor(color); g2d.fill(ball); g2d.translate(-x, -y); } } Next, we need somewhere for the balls to move within, some kind of BallPit for example... public class BallPit extends JPanel { private List&lt;Ball&gt; balls; public BallPit() { balls = new ArrayList&lt;&gt;(25); balls.add(new Ball(Color.RED, getPreferredSize())); Timer timer = new Timer(40,…
has comment: http://stackoverflow.com/comment/39943821
score: 2
has comment: http://stackoverflow.com/comment/40484949
has comment: http://stackoverflow.com/comment/39944441
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39934016
downvote count: 0
has comment: http://stackoverflow.com/comment/39944255

http://stackoverflow.com/comment/40089530
score: 0
has text: Think about it in reverse. Does the group of elements 1,2,3 _contain_ your input?
type: Comment
comment on: http://stackoverflow.com/q/25655199
type: QuestionComment

http://stackoverflow.com/comment/39941938
score: 0
comment on: http://stackoverflow.com/q/25570582
type: QuestionComment
type: Comment
has text: What do you want to map? Columns? Tables? Schemas? Can you please explain a bit more?

http://stackoverflow.com/comment/40031850
has text: Is this not MAKING it faster by **editing** you code until it looks like this? :P
type: AnswerComment
score: 2
comment on: http://stackoverflow.com/a/25621332
type: Comment

hibernate
tags question: http://stackoverflow.com/q/25630316
tags question: http://stackoverflow.com/q/25584744
tags question: http://stackoverflow.com/q/25600292
tags question: http://stackoverflow.com/q/25563337
tags question: http://stackoverflow.com/q/25571520
tags question: http://stackoverflow.com/q/25601467
tags question: http://stackoverflow.com/q/25682727
tags question: http://stackoverflow.com/q/25571898
tags question: http://stackoverflow.com/q/25574776
tags question: http://stackoverflow.com/q/25684785
tags question: http://stackoverflow.com/q/25563062
tags question: http://stackoverflow.com/q/25659438
tags question: http://stackoverflow.com/q/25589180
tags question: http://stackoverflow.com/q/25707521
tags question: http://stackoverflow.com/q/25558111
tags question: http://stackoverflow.com/q/25691312
tags question: http://stackoverflow.com/q/25637058
tags question: http://stackoverflow.com/q/25584807
tags question: http://stackoverflow.com/q/25615952
tags question: http://stackoverflow.com/q/25698850
tags question: http://stackoverflow.com/q/25568279
tags question: http://stackoverflow.com/q/25639950
tags question: http://stackoverflow.com/q/25579825
tags question: http://stackoverflow.com/q/25629379
tags question: http://stackoverflow.com/q/25641727
tags question: http://stackoverflow.com/q/25680206
tags question: http://stackoverflow.com/q/25561418
tags question: http://stackoverflow.com/q/25610131
tags question: http://stackoverflow.com/q/25657305
tags question: http://stackoverflow.com/q/25667491
type: Tag
tags question: http://stackoverflow.com/q/25647835
tags question: http://stackoverflow.com/q/25689284
tags question: http://stackoverflow.com/q/25578973
tags question: http://stackoverflow.com/q/25553048
tags question: http://stackoverflow.com/q/25645812
tags question: http://stackoverflow.com/q/25600244
tags question: http://stackoverflow.com/q/25625289
tags question: http://stackoverflow.com/q/25643000
tags question: http://stackoverflow.com/q/25602557
tags question: http://stackoverflow.com/q/25650201
tags question: http://stackoverflow.com/q/25612997
tags question: http://stackoverflow.com/q/25571580
tags question: http://stackoverflow.com/q/25621722
tags question: http://stackoverflow.com/q/25609395
tags question: http://stackoverflow.com/q/25581653
tags question: http://stackoverflow.com/q/25691255
tags question: http://stackoverflow.com/q/25562646
tags question: http://stackoverflow.com/q/25698916
tags question: http://stackoverflow.com/q/25657554
tags question: http://stackoverflow.com/q/25630290
tags question: http://stackoverflow.com/q/25617578
tags question: http://stackoverflow.com/q/25586600
tags question: http://stackoverflow.com/q/25700052
tags question: http://stackoverflow.com/q/25688557
tags question: http://stackoverflow.com/q/25676103
tags question: http://stackoverflow.com/q/25600953
tags question: http://stackoverflow.com/q/25667809
tags question: http://stackoverflow.com/q/25650152
tags question: http://stackoverflow.com/q/25619278
tags question: http://stackoverflow.com/q/25589167
tags question: http://stackoverflow.com/q/25566851
tags question: http://stackoverflow.com/q/25690217
tags question: http://stackoverflow.com/q/25623458
tags question: http://stackoverflow.com/q/25649554
tags question: http://stackoverflow.com/q/25664452
tags question: http://stackoverflow.com/q/25603402
tags question: http://stackoverflow.com/q/25569565
tags question: http://stackoverflow.com/q/25638803
tags question: http://stackoverflow.com/q/25616337
tags question: http://stackoverflow.com/q/25673755
tags question: http://stackoverflow.com/q/25684581
tags question: http://stackoverflow.com/q/25640633
tags question: http://stackoverflow.com/q/25665420
tags question: http://stackoverflow.com/q/25611285
tags question: http://stackoverflow.com/q/25697700
tags question: http://stackoverflow.com/q/25642814
tags question: http://stackoverflow.com/q/25552094
tags question: http://stackoverflow.com/q/25702382
tags question: http://stackoverflow.com/q/25665662

http://stackoverflow.com/comment/39963942
score: 0
comment on: http://stackoverflow.com/q/25586050
has text: If that's not the case please update your question.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25693204
has comment: http://stackoverflow.com/comment/40158480
type: AnsweredQuestion
upvote count: 3
score: 3
has answer: http://stackoverflow.com/a/25693443
tagged with: java
has comment: http://stackoverflow.com/comment/40158287
tagged with: generics
type: Question
possible better answer: http://stackoverflow.com/a/25693514
answer count: 2
accepted answer: http://stackoverflow.com/a/25693443
downvote count: 0
has body: See the code Integer[] array = (Integer[]) new Object[size]; this obviously do not works, I understand perfectly. but why with generics works? T[] array = (T[]) new Object[size]; if T is Integer class, after that line the array will be Object[] type, but why cast is possible? does not throw ClassCastException?
has answer: http://stackoverflow.com/a/25693514
has comment: http://stackoverflow.com/comment/40158317
tagged with: arrays
has title: Object array to generic array
favorite count: 0

http://stackoverflow.com/a/28063094
has comment: http://stackoverflow.com/comment/54526972
has comment: http://stackoverflow.com/comment/54524161
answers question: http://stackoverflow.com/q/25565809
has body: I have some similar requirement. I tried to have the url for authentication as /auth/facebook?_spring_security_remember_me=true (refer AbstractRememberMeServices.rememberMeRequested). But then, org.springframework.social.security.SocialAuthenticationFilter.detectRejection wouldn't not let this pass. It is coded like this: protected boolean detectRejection(HttpServletRequest request) { Set&lt;?&gt; parameterKeys = request.getParameterMap().keySet(); return parameterKeys.size() &gt; 0 &amp;&amp; !parameterKeys.contains("oauth_token") &amp;&amp; !parameterKeys.contains("code") &amp;&amp; !parameterKeys.contains("scope"); } I think if we can add another clause there, it could work. Then I thought to override it by subclassing SocialAuthenticationFilter. But then in SpringSocialConfigurer it's not injected, but instanciated using the new keyword. Subclassing SpringSocialConfigurer also doesn't seem like a solution, because there are many useful private fields inside. So, I think a solution would be to just copy SpringSocialConfigurer into another class, and use that along with a subclassed SocialAuthenticationFilter. If I have understood all this correctly, all this seems like hacking, and I think we should create a ticket for proper remember me support. Of course, if we want remember me to be always on, that's easy by setting the alwaysRemember field of the RememberMeServices, and I am doing it this way: @Bean public RememberMeServices rememberMeServices() { TokenBasedRememberMeServices rememberMeServices = new TokenBasedRememberMeServices(rememberMeKey, userService); rememberMeServices.setAlwaysRemember(true); return rememberMeServices; }
type: Answer
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/a/25637323
score: 14
upvote count: 14
type: Answer
has comment: http://stackoverflow.com/comment/40079433
accepted answer of: http://stackoverflow.com/q/25635428
type: AcceptedAnswer
downvote count: 0
has body: It looks like your application data is all bound up inside your user interface objects. If everything you do can be done on the EDT, then you should be OK. You can make direct calls among the objects that need information from each other. Since all of this is on the EDT, it's effectively single-threaded, and there are no race conditions or deadlocks. This, however, can couple various parts of the UI code to each other rather too tightly. In that case you can use some kind of observer or listener pattern as the commenters have suggested. This works fine in a single-threaded, event-driven environment like with AWT/Swing. But then you say you might want to do this from some thread other than the EDT. That changes everything. (As an aside, this is the sort of thing that causes people to consider having all your application data bound up inside your UI objects to be an anti-pattern. It makes it quite difficult to get to this data from outside the UI subsystem.) You could add an observer pattern, but there are restrictions. The UI owns the data, so only the EDT can change the data and fire events to observers. The observers lists need to maintained in a thread-safe fashion. Presumably the observers will want to update data structures in response to events. These data structures will have to be thread-safe, since they're accessed both from the EDT and from your other thread. This approach will work, but you have to do a lot of thinking about which thread is calling which methods, and which data structures have to be made thread-safe. Assuming you don't want to go this route, let's return to your original question, which was about how to return something from invokeLater. Doing this would let you keep your data in the UI while allowing other threads to get data out of the UI when they need it. It is possible to do this, with a bit of indirection. It does have risks, though. Here's the code. This can be called from the "other" (non-EDT) thread. InfoObj getInfo() { RunnableFu…
answers question: http://stackoverflow.com/q/25635428

http://stackoverflow.com/comment/40157949
comment on: http://stackoverflow.com/q/25692444
has text: Yes, the deserialization should fail when it encounters `{"someArray": null}` or `{"someObject": null}`. Jackson has already the option to fail on omitted properties - [Deserialization Feature - FAIL_ON_IGNORED_PROPERTIES](https://github.com/FasterXML/jackson-databind/wiki/Deserialization-Features#failure-handling).
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/q/25561243
has answer: http://stackoverflow.com/a/25573729
tagged with: jetbrains-ide
type: AnsweredQuestion
answer count: 3
has answer: http://stackoverflow.com/a/40295365
tagged with: playframework
upvote count: 3
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/25561486
downvote count: 0
has body: How to create Play! Framework 2.3 JAVA application with JetBrains IntelliJ Idea 13? I only find the Play! Framework Scala application in IntelliJ Idea.
favorite count: 0
type: Question
has title: How to create Play! Framework JAVA application with JetBrains IntelliJ Idea 13? I only find the Scala project
accepted answer: http://stackoverflow.com/a/25561486
tagged with: intellij-idea
possible better answer: http://stackoverflow.com/a/25573729

http://stackoverflow.com/comment/40182398
type: QuestionComment
comment on: http://stackoverflow.com/q/25706209
type: Comment
score: 0
has text: The answers are correct but if you're new to Java you can basically think of a reference as a pointer (it isn't, but it is pretty close). The first call created a new object and assigns current to it, you then assign the current pointer to the front object losing your previous reference. The answer below is clear, but I find the "pointer logic" if you're coming from another language to be a good analogy (not the same, but close enough to think about).

http://stackoverflow.com/comment/40017021
comment on: http://stackoverflow.com/q/25609856
type: QuestionComment
has text: connection to database and query are correct because project works fine for many hours but when many users access the projects i.e load on server increases then only mysql error comes. and server page shows 500 Error
score: 0
type: Comment

http://stackoverflow.com/comment/39921407
has text: It behaves same as in the case if the permits is negative. We need to call release() on semaphore before calling acquire().
type: Comment
comment on: http://stackoverflow.com/q/25563640
score: 1
type: QuestionComment

http://stackoverflow.com/comment/40053170
has text: Cool glad to help. "bean" is actually short for JavaBean. It's just a [plain old java object (POJO)](http://en.wikipedia.org/wiki/Plain_Old_Java_Object) that follows [JavaBean conventions](http://en.wikipedia.org/wiki/JavaBeans)
comment on: http://stackoverflow.com/a/25627374
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40047654
score: 1
comment on: http://stackoverflow.com/a/25627374
has text: thanks a lot, it works fine. I didn' t know about beans. Thanks.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40086710
comment on: http://stackoverflow.com/a/25653310
type: Comment
type: AnswerComment
score: 1
has text: you do realize that you can upvote questions, right?

http://stackoverflow.com/comment/39948744
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25577603
score: 0
has text: I just saw your post about anonymous inner class. I tried that, but it was saying that I need to declare my count variable as final, which I think is the opposite of what I want, since I want that number able to be updated.

http://stackoverflow.com/a/25564713
answers question: http://stackoverflow.com/q/25552321
downvote count: 0
score: 3
has body: If you use a query_string query, your ANDs and ORs will be interpreted as such by the Lucene library. This allows you to search for (currentUserId OR currentCustomerId) AND currentComponent for instance. By default, the values will be searched for in all fields.
has comment: http://stackoverflow.com/comment/39923766
type: Answer
has comment: http://stackoverflow.com/comment/39923725
upvote count: 3

http://stackoverflow.com/comment/40036519
type: QuestionComment
has text: Minimum Working Example, in other words code one can compile and experiment with...
comment on: http://stackoverflow.com/q/25626108
score: 0
type: Comment

http://stackoverflow.com/comment/40168977
comment on: http://stackoverflow.com/q/25698932
score: 0
has text: No. Is it necessary to write code to connect my app to wifi networks manually or will it automatically detect any network my phone is connected to?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25580704
downvote count: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25579818
upvote count: 4
score: 4
has body: That's fine in XML Schema terms, you can have an element and a type with the same name without ambiguity as it's obvious from the context which you are referring to at any given time. In JAXB the type will map to a Java class Person and the element declaration will become a method on the ObjectFactory, with uses of the element mapping to JAXBElement&lt;Person&gt;. You only get an @XmlRootElement annotated class for elements that have an anonymous nested complexType (i.e. cases where the type can't be used for anything other than this specific root element).
accepted answer of: http://stackoverflow.com/q/25579818

http://stackoverflow.com/comment/80543085
comment on: http://stackoverflow.com/q/25551213
type: QuestionComment
has text: Possible duplicate of [Cannot change version of project facet Dynamic Web Module to 3.0?](https://stackoverflow.com/questions/18122336/cannot-change-version-of-project-facet-dynamic-web-module-to-3-0)
type: Comment
score: 0

http://stackoverflow.com/q/25600007
tagged with: java
has comment: http://stackoverflow.com/comment/39988758
answer count: 1
has comment: http://stackoverflow.com/comment/39989655
tagged with: eclipse
tagged with: generics
has comment: http://stackoverflow.com/comment/39989838
favorite count: 0
has comment: http://stackoverflow.com/comment/39990753
linked to: http://stackoverflow.com/q/156503
accepted answer: http://stackoverflow.com/a/25600182
has comment: http://stackoverflow.com/comment/39989987
type: Question
has comment: http://stackoverflow.com/comment/39988794
has answer: http://stackoverflow.com/a/25600182
has comment: http://stackoverflow.com/comment/39988632
upvote count: 2
has body: This question could be thought of as just the Java version of this c++ question: Unit test compile-time error I'm writing some utility classes that mess with generics in java and things have gotten weird enough that I find myself wishing I knew how to write a unit test for code that is supposed to cause a compiler error. I know how to make a unit test pass only when the expected exception is thrown. No idea how to make it pass only when I get the expected error. Is this possible? If so, how? Is there a typical way of doing this? Is there a jUnit way? An example would be using a method (lets say, one that performs a cast) in a way that should cause an error. I'd like a test that would only pass when the code calling that method produces an error. I'd run it along with other tests that should not cause an error. As another example read Generic And Parameterized Types and note how the comments often say things like "fails with ClassClassException" "should fail, but succeeds". Those seem like tests that could be automated. This is not to test the compiler. It's to test that the generic code I wrote does what it should do. My gut tells me this goes beyond what the compiler or libraries could do and is into the realm of IDE magic, strange project configuration, or static code analysis. I really have no idea. I just want to be just as sure that the code causes the errors it should as I am that it's not causing the errors it shouldn't. I use eclipse, ant, and jUnit so an answer that details how this could be done with them would be perfect.
has title: Test for expected compile time errors in java
tagged with: ant
downvote count: 0
has comment: http://stackoverflow.com/comment/39989033
has comment: http://stackoverflow.com/comment/39988626
has comment: http://stackoverflow.com/comment/39990571
has comment: http://stackoverflow.com/comment/39990216
tagged with: unit-testing
linked to: http://stackoverflow.com/q/605915
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/39988614
has comment: http://stackoverflow.com/comment/39990125

http://stackoverflow.com/q/25677682
tagged with: java
has title: How to set integer value ranging from 1000 to 9999 in Java?
type: Question
has body: This is my first time taking programming class. This is also my first assignment, and I got stuck on how to set the input of number from users ranging from 1000 to 9999. My assignment is create a code that ask user to enter four digit integer, then display those individual number 3 spaces from each other (hint: use division and remainder arithmetic). I finally get it to print out each number 3 space away from each other. The problem is when my teacher says that a four digit integer are ranging from 1000-9999. So when I try to put 0001, it print out: 0 0 0 1 And if I put 12345, it print out: 12 3 4 5 Is there anyway to do it? Thank you so much for help me out I can post a picture yet because im new to this forum. anyway here is my code import java.util.Scanner; public class DigitsDemo { public static void main ( String[] args ) { Scanner input = new Scanner ( System.in ); System.out.print ( "Enter four digit numbers: " );//prompt the user to enter numbers int n = input.nextInt();//read number entered by user // determine the 5 digits int Digit1 = n / 1000; int Digit2 = n % 1000 / 100; int Digit3 = n % 1000 % 100 / 10; int Digit4 = n % 1000 % 100 % 10 / 1; System.out.println ( "The four digits integers are:" ); System.out.printf ( "%d %d %d %d\n%s\n", Digit1, Digit2, Digit3, Digit4, "Written by blabla" ); } }
answer count: 1
has answer: http://stackoverflow.com/a/25677730
accepted answer: http://stackoverflow.com/a/25677730
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/40180258
score: 0
comment on: http://stackoverflow.com/a/25705126
type: AnswerComment
type: Comment
has text: [`Thread.interrupt()`](http://docs.oracle.com/javase/tutorial/essential/concurrency/interrupt.html) may also be useful.

http://stackoverflow.com/a/25705515
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: I have just rewritten your code to be able to compile it, and it works correctly: String line = "2 2 2"; ArrayList myIntArray = new ArrayList(); int charCounter = 0; int rawSize = 0; while(charCounter &lt; line.length()){ char a_char = line.charAt(charCounter); if(a_char != ' '){ System.out.print(String.valueOf(a_char)+" "); int temp = Character.digit(a_char, 10); myIntArray.add(temp); System.out.println(String.valueOf(myIntArray.get(rawSize))); rawSize++; } charCounter++; } Output: 2 2 2 2 2 2 Update: I have edited my code according your update. And again, it works correctly, but String.valueOf(...) indeed always return 1. This is because in the outer while you assign rawSize to zero, so you will always print the first three elements of myIntArray, which are '1's. Try to print the whole myIntArray, and you will see that it's filled as you expected. P.S. There are really a lot of more concise and nice ways to accomplish this, as another responder suggests, for instance.
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/40183959
accepted answer of: http://stackoverflow.com/q/25705478
answers question: http://stackoverflow.com/q/25705478

http://stackoverflow.com/comment/39998114
type: QuestionComment
score: 0
has text: Spring inspects the return type of the method (not the actual object). Might be, that you should return a DTO... See https://jira.spring.io/browse/SPR-9218
comment on: http://stackoverflow.com/q/25604477
type: Comment

http://stackoverflow.com/comment/40189290
type: QuestionComment
has text: @Prasad @ Niematojak I am using hibernate to access database and heroku provides a environment variable to connect to postgresSql database. Thank you for replying
comment on: http://stackoverflow.com/q/25705713
score: 0
type: Comment

http://stackoverflow.com/a/25677160
answers question: http://stackoverflow.com/q/25677119
has comment: http://stackoverflow.com/comment/40128794
upvote count: 1
has body: In Java 7, you can do: List&lt;String&gt; arrayList = new ArrayList&lt;&gt;(); arrayList.add("ex1"); arrayList.add("ex2"); arrayList.add("ex12"); for (String element : arrayList) { switch (element) { case "ex1": // Do something break; default: // Do something else } }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40128771
has comment: http://stackoverflow.com/comment/40128765
accepted answer of: http://stackoverflow.com/q/25677119
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/25594159
has comment: http://stackoverflow.com/comment/90084881
downvote count: 1
type: Answer
score: -1
has body: I'm not sure what version of PowerMock you are using, but with the later version, you should be using @RunWith(PowerMockRunner.class) @PrepareForTest(Util.class) Saying this, I find using PowerMock to be really problematic and a sure sign of a poor design. If you have the time/opportunity to change the design, I would try and do that first.
answers question: http://stackoverflow.com/q/25594090
upvote count: 0
has comment: http://stackoverflow.com/comment/39977872

http://stackoverflow.com/comment/40133440
comment on: http://stackoverflow.com/q/25679653
score: 0
type: Comment
type: QuestionComment
has text: But the first example works with weblaf?

http://stackoverflow.com/comment/40183402
type: QuestionComment
score: 0
has text: `System.currentTimeMillis` is timezone-independent. I don't see any problems, other than whether or not it is required to convert it to a `BIGINT` or not.
comment on: http://stackoverflow.com/q/25706875
type: Comment

http://stackoverflow.com/q/25621185
has comment: http://stackoverflow.com/comment/40027196
has answer: http://stackoverflow.com/a/25622051
linked to: http://stackoverflow.com/q/20426734
score: 0
tagged with: java
tagged with: hibernate
answer count: 1
has body: I have these two Entity java class which is referring the tables (jos_content &amp; jos_article_section). @Entity @Table(name="jos_content", uniqueConstraints={@UniqueConstraint(columnNames="id")}) public class ContentEntity implements Serializable { private int id; private Set&lt;ArticleSectionEntity&gt; josArticleSection; private String sefUrl; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id", unique = true, nullable = false) public int getId() { return id; } public void setId(int id) { this.id = id; } @Column(name="sef_url") public String getSefUrl() { return sefUrl; } public void setSefUrl(String sefUrl) { this.sefUrl = sefUrl; } @OneToMany(cascade = CascadeType.ALL) @JoinColumn(name="article_id") public Set&lt;ArticleSectionEntity&gt; getJosArticleSection() { return josArticleSection; } public void setJosArticleSection(Set&lt;ArticleSectionEntity&gt; josArticleSection) { this.josArticleSection = josArticleSection; } } @Entity @Table(name="jos_article_section", uniqueConstraints= {@UniqueConstraint(columnNames="id")}) public class ArticleSectionEntity implements Serializable { private int id; private int articleId; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id", nullable=false, length=10) public int getId() { return id; } public void setId(int id) { this.id = id; } @Column(name="article_id", nullable=false) public int getArticleId() { return articleId; } } I'm using Criteria interface with group by like this: Criteria contentCriteria = session.createCriteria(ContentEntity.class, "content"); // Join two tables (jos_content, jos_article_section) on jos_content.id = jos_acticle_section.article_id contentCriteria = contentCriteria.setFetchMode("josArticleSection", FetchMode.JOIN); contentCriteria = contentCriteria.add(Restrictions.eq("content.id", storyId)); contentCriteria = contentCriteria.add(Restrictions.eq("content.state",1)); //Start Group By Clause PropertyProjection propProjection = Projections.groupProperty("conte…
linked to: http://stackoverflow.com/q/25616056
type: Question
has comment: http://stackoverflow.com/comment/40028077
type: UnansweredQuestion
has title: Hibernate Criteria with group by getting error
has comment: http://stackoverflow.com/comment/40028195

http://stackoverflow.com/a/25639992
score: 0
answers question: http://stackoverflow.com/q/25639677
has body: "but i'm sure there is a better way to do it .." NO, you should use the Comparator, or let your Time class implement Comparable. Using Collections.sort() is the standard technique to sort data structures in Java.
type: Answer

eclipse-plugin
tags question: http://stackoverflow.com/q/25629986
tags question: http://stackoverflow.com/q/25551713
tags question: http://stackoverflow.com/q/25665108
tags question: http://stackoverflow.com/q/25705343
tags question: http://stackoverflow.com/q/25600243
tags question: http://stackoverflow.com/q/25597424
tags question: http://stackoverflow.com/q/25607632
tags question: http://stackoverflow.com/q/25661254
tags question: http://stackoverflow.com/q/25611528
type: Tag
tags question: http://stackoverflow.com/q/25637939
tags question: http://stackoverflow.com/q/25618439
tags question: http://stackoverflow.com/q/25701892
tags question: http://stackoverflow.com/q/25556721
tags question: http://stackoverflow.com/q/25555678
tags question: http://stackoverflow.com/q/25684990
tags question: http://stackoverflow.com/q/25561596
tag name: eclipse-plugin

http://stackoverflow.com/a/25616887
has body: try long myLong = 3600L*24*365*70; as your code is multiplying as int and then converting to a Long. The value as an int is overflowing the max value for an int, but will be OK as a long.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25616873
type: Answer
accepted answer of: http://stackoverflow.com/q/25616873

http://stackoverflow.com/a/25578274
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25573616
upvote count: 2
has comment: http://stackoverflow.com/comment/39953502
downvote count: 0
has comment: http://stackoverflow.com/comment/39951910
type: Answer
score: 2
has body: I'd give ImmutableSortedMap a try, assuming you can use it. It's based on a sorted array rather then a balanced tree, so I guess its overhead is much smaller(*). For building it, you need to employ biziclop's idea as the builder supports no removals. (*) There's a call to Collection.sort there, but it should be harmless as the collection is already sorted and TimSort is optimized for such a case. In case your original map doesn't change after creating onDates, maybe a view could help. In case it does, you'd need some "persistent" map, which sounds rather complicated. Maybe some hacky solution based on sorted arrays and binary search could be fastest, maybe you could even convert LocalDate first to int and then to double and put everything into a single interleaved double[] in order to save memory (and hopefully also time). You'd need your own binary search, but this is rather trivial. The view idea is rather simple, assuming that you don't need all NavigableMap methods, but just a couple of methods the original map doesn't change only a few elements are missing in retainDates An example method: public double lastPriceAt(LocalDate date) { Map.Entry&lt;LocalDate, Double&gt; price = prices.floorEntry(date); while (!retainDates.contains(price.getKey()) { price = prices.lowerEntry(price.getKey()); // after some null checks } return price.getValue(); // after some null checks }
accepted answer of: http://stackoverflow.com/q/25573616
has comment: http://stackoverflow.com/comment/39955126
has comment: http://stackoverflow.com/comment/39952366

http://stackoverflow.com/a/25673364
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25673306
accepted answer of: http://stackoverflow.com/q/25673306
type: Answer
has body: You need to replace the following line: num [i] = Integer.parseInt(cc.substring(0, 1)); with: num [i] = Integer.parseInt(cc.substring(i, i+1)); if you want to iterate the characters. Otherwise you'll keep choosing the same character over and over again.
has comment: http://stackoverflow.com/comment/40121758
upvote count: 2
score: 2

http://stackoverflow.com/comment/40012787
has text: @PatrickW.McMahon You may should check the `Singleton` pattern. That way you can be sure that there is only one instance of your `Foo` (or `Main`) class.
score: 0
comment on: http://stackoverflow.com/a/25613039
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40116822
type: AnswerComment
comment on: http://stackoverflow.com/a/25670552
type: Comment
has text: You ought to escape the parentheses: `Si(.*?)\([IP]\)`
score: 0

http://stackoverflow.com/comment/40083620
comment on: http://stackoverflow.com/q/25652010
score: 0
type: Comment
has text: At first glance, it looks like you're creating it in-line with the menu class itself. Is there other code that generates a menu before this you may be seeing? Check out this previous question for examples, http://stackoverflow.com/questions/7555677/working-with-japplet-with-menus
type: QuestionComment

http://stackoverflow.com/a/25642376
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/25641586
has body: You link the Spinner models rather than the spinners themselves. SpinnerNumberModel model1 = new SpinnerNumberModel( 10, 10, 90, 10 ); model1.addChangeListener( this ); SpinnerNumberModel model2 = new SpinnerNumberModel( 10, 10, 19, 1 ); The idea is to let spinner 1 step from 10 to 90 by 10 and force spinner 2 into the interval [spinner1.getValue(), spinner1.getValue()+9] This is done by the ChangeListener method public void stateChanged(ChangeEvent e){ SpinnerNumberModel model = (SpinnerNumberModel)e.getSource(); Integer value = (Integer)model.getValue(); model2.setMinimum( value ); model2.setMaximum( value + 9 ); if( (Integer)model2.getValue() &lt; value ){ model2.setValue( value ); } else if( (Integer)model2.getValue() &gt; value + 9 ){ model2.setValue( value + 9 ); } } The models are passed to the JSpinner constructor: JSpinner spinner1 = new JSpinner( model1 ); JSpinner spinner2 = new JSpinner( model2 );
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25641586

http://stackoverflow.com/comment/39969945
type: Comment
comment on: http://stackoverflow.com/q/25589728
score: 0
has text: I fixed your code formatting. For current and future posts, please only provide the necessary data to replicate the problem. Also, you can edit the question to see how the code is formatted for future questions.
type: QuestionComment

http://stackoverflow.com/comment/40104814
comment on: http://stackoverflow.com/q/25663403
score: 2
type: Comment
type: QuestionComment
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal, Complete, Verifiable Example).

http://stackoverflow.com/a/25593895
accepted answer of: http://stackoverflow.com/q/25593843
score: 0
answers question: http://stackoverflow.com/q/25593843
has comment: http://stackoverflow.com/comment/39977449
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39977736
has body: Have you told eclipse to use the jar? From your Eclipse workspace, right click your project on the left pane -> Properties -> Java Build Path -> Add Jars -> add your jars here.
type: Answer

http://stackoverflow.com/comment/40190827
score: 1
type: Comment
type: QuestionComment
has text: no you dont need the +, Maff. Can you try omitting the space if you really have it? I mean 'return "redirect:index"; ' do redirection works in any case?
comment on: http://stackoverflow.com/q/25710763

http://stackoverflow.com/q/25603306
favorite count: 0
type: Question
has body: I am trying to import live data from a webpage. However the webpage seems to be written in a script so I can't seem to be able to import the data into excel. I am trying to run a macro. I did a search and found the following thread very useful; Import Data in Excel from a table created by a script in a WebPage (first answer) but I don't have enough knowledge to tweak the code for my website? Can someone help me? Thanks
score: 1
has answer: http://stackoverflow.com/a/25627485
accepted answer: http://stackoverflow.com/a/25627485
tagged with: java
tagged with: http://stackoverflow.com/tag/html
has title: Import data into excel from a webpage written in script
tagged with: import
type: AnsweredQuestion
downvote count: 0
upvote count: 1
linked to: http://stackoverflow.com/q/21039677
answer count: 1
tagged with: javascript
tagged with: excel

http://stackoverflow.com/q/25575522
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25576544
has comment: http://stackoverflow.com/comment/39944030
has comment: http://stackoverflow.com/comment/39945273
type: Question
has body: I am trying to launch a brand new activity that will display a new string when I touch the screen. Here is the MainActivity code. My first activity displays a "hello world", and my new activity should simply displays a new string. All the resource files and the manifest are correct. However, the run keeps crashing after the onClick. package com.example.myfirsttest; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; public class MainActivity extends Activity{ @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.activity_main); //Call the NewActivity from the MainActivity View view = getWindow().getDecorView().findViewById(android.R.id.content); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent startIntent = new Intent(MainActivity.this,NewActivity.class); startActivity(startIntent); } }); } }
has title: Launching a new activity just by touching the screen
answer count: 1
has answer: http://stackoverflow.com/a/25576544
has comment: http://stackoverflow.com/comment/39944432
has comment: http://stackoverflow.com/comment/39944377
has comment: http://stackoverflow.com/comment/39944233
has comment: http://stackoverflow.com/comment/39944414
has comment: http://stackoverflow.com/comment/39944031
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39945065
score: 0

http://stackoverflow.com/q/25557359
tagged with: java
score: 1
favorite count: 0
has title: apps error in android studio
type: Question
has comment: http://stackoverflow.com/comment/39910604
has comment: http://stackoverflow.com/comment/39909830
answer count: 0
type: UnansweredQuestion
downvote count: 0
has body: I'm new to android development and I've started to develop an app in android studio. In Gradle it's telling that BUILD SUCCESSFUL. It crashes when it lunches in the mobile device and providing the following error in 'logcat'. I tried to understand the error message, but it doesn't make much sense to me. Any idea how to approach this problem? It was fine before and app lunches properly. I have four java files which are provided after the error message. 08-28 16:09:06.645 15906-15906/com.example.uadmin.weatherapp D/libEGL﹕ loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so 08-28 16:09:06.653 15906-15906/com.example.uadmin.weatherapp D/libEGL﹕ loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so 08-28 16:09:06.661 15906-15906/com.example.uadmin.weatherapp D/libEGL﹕ loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so 08-28 16:09:06.723 15906-15906/com.example.uadmin.weatherapp D/OpenGLRenderer﹕ Enabling debug mode 0 08-28 16:09:07.309 15906-15906/com.example.uadmin.weatherapp D/AndroidRuntime﹕ Shutting down VM 08-28 16:09:07.309 15906-15906/com.example.uadmin.weatherapp W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41840700) 08-28 16:09:07.340 15906-15906/com.example.uadmin.weatherapp E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:394) at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362) at android.widget.AbsListView.obtainView(AbsListView.java:2177) at android.widget.ListView.makeAndAddView(ListView.java:1840) at android.widget.ListView.fillDown(ListView.java:675) at android.widget.ListView.fillFromTop(ListView.java:736) at android.widget.ListView.layoutChildren(ListView.java:1641) at android.widget.AbsListView.onLayout(AbsListView.java:2012) at android.view.View.layout(View.java:14289) at android.view.ViewGroup.layout(ViewGroup.java:4559) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View…
upvote count: 1
has comment: http://stackoverflow.com/comment/39909626
tagged with: android

wsimport
tags question: http://stackoverflow.com/q/25647381
tags question: http://stackoverflow.com/q/25568407
type: Tag
tag name: wsimport

http://stackoverflow.com/q/25551100
upvote count: 1
favorite count: 0
type: Question
has body: I first save an image to Google Cloud Storage also setting the mime type to something like "image/png" and name it randomly with the file ending e.g. ".png". The files seem to be stored correctly. I can see them in the datastore viewer: But if I try to load it again with the com.google.appengine.api.images.ImagesService and call ImagesService.getServigUrl(), it throws the error: java.lang.IllegalArgumentException: NOT_IMAGE: Failed to read image So this seems to think it is not an image. But why? It has the mime typ set, it has the file ending. The code looks like this: ImagesService imagesService = ImagesServiceFactory.getImagesService(); Image newImage = imagesService.applyTransform(crop, oldImage); final GcsService gcsService = GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance()); AppIdentityService appservice = com.google.appengine.api.appidentity.AppIdentityServiceFactory.getAppIdentityService(); GcsFilename fileName = new GcsFilename(appservice.getDefaultGcsBucketName(), Long.toString(random.nextLong(), 36)+"."+newImage.getFormat().toString().toLowerCase()); GcsFileOptions gcsOptions = new GcsFileOptions.Builder() .mimeType("image/"+newImage.getFormat().toString().toLowerCase()) .acl("public-read").build(); GcsOutputChannel outputChannel = gcsService.createOrReplace(fileName, gcsOptions); ObjectOutputStream oout = new ObjectOutputStream(Channels.newOutputStream(outputChannel)); oout.writeObject(newImage.getImageData()); oout.close(); ServingUrlOptions suo = ServingUrlOptions.Builder.withGoogleStorageFileName("/gs/"+fileName.getBucketName()+"/"+fileName.getObjectName()).secureUrl(true); String s = imagesService.getServingUrl(suo); System.out.println(s);
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/55892343
tagged with: google-app-engine
score: 1
linked to: http://stackoverflow.com/q/12868646
tagged with: java
linked to: http://stackoverflow.com/q/23778367
has comment: http://stackoverflow.com/comment/39899307
tagged with: google-cloud-storage
has comment: http://stackoverflow.com/comment/39899056
has title: Can not get serving URL for images from Google Cloud Storage -> "NOT_IMAGE: Failed to read image"
has comment: http://stackoverflow.com/comment/39897904
answer count: 1
has answer: http://stackoverflow.com/a/27372893
downvote count: 0

http://stackoverflow.com/comment/40007535
type: QuestionComment
comment on: http://stackoverflow.com/q/25610298
has text: @PeterLawrey Do you have a source for that claim? The docs don't seem to mention it, though they do allow the trace to omit frames…
type: Comment
score: 1

http://stackoverflow.com/a/25581378
answers question: http://stackoverflow.com/q/25581334
type: Answer
has body: Java works by references, you will never obtain a copy of a non primitive type with the assignment operator, unless you are explicitly requesting a copy (by an instance method for example). Actually it works by value, on references: what is effectively assigned (and copied) is the reference on the heap to the object. What I mean is that if you have YourObject o = otherComplex.path.to.a.different.variable; What's happening is that o is an alias to the other variable, they both refer to the same object on the heap so they both have same performance implications. You don't neither need to assign it back, eg YourObject o = otherComplex.path.to.a.different.variable; o.method(); o.field = ...; otherComplex.path.to.a.different.variable = o; This is unnecessary as you are just reassigning values which are already equivalent.
has comment: http://stackoverflow.com/comment/39954988
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25581334

http://stackoverflow.com/q/25677143
tagged with: linked-list
type: UnansweredQuestion
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/40129408
upvote count: 1
has title: Order a list with pointers
has comment: http://stackoverflow.com/comment/40129285
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40129228
has comment: http://stackoverflow.com/comment/40128889
has comment: http://stackoverflow.com/comment/40129350
has comment: http://stackoverflow.com/comment/40129201
tagged with: java
has comment: http://stackoverflow.com/comment/40128823
has comment: http://stackoverflow.com/comment/40129035
score: -1
tagged with: singly-linked-list
has answer: http://stackoverflow.com/a/25678125
has body: I'm supposed to order the numbers inserted in this list. I have to order it backwards too. I've been trying to do it for the last couple of hours but I haven't come up with anything. I'm a beginner and to me the hardest part is to order it using of its pointers. public class MyList { private static class MyList { public int num; public MyList nextn; } public static void main(String[] args) { Scanner input = new Scanner(System.in); MyList start = null; MyList end = null; MyList aux; MyList before; int op, number, found; do{ System.out.println("1- insert number in the beginning list"); System.out.println("2- insert in the end of the list"); System.out.println("3- query list"); System.out.println("4- remove from list"); System.out.println("5- empty list"); System.out.println("6- exit"); System.out.print("choose: "); op = input.nextInt(); if(op &lt; 1||op&gt;6) { System.out.println("invalid number"); } if(op == 1) { System.out.println("type the number to be inserted in the beginning of the list"); MyList newl = new MyList(); newl.num = input.nextInt(); if(start == null) { start = newl; end = newl; newl.nextn = null; } else { newl.nextn = start; start = newl; } System.out.println("number inserted"); } if(op == 2) { System.out.println("type the number to be inserted in the end of the list"); MyList newl = new MyList(); newl.num = input.nextInt(); if(start == null) { start = newl; end = newl; newl.nextn = null; } else { end.nextn = newl; end = newl; newl.nextn = null; } System.out.println("number inserted"); } if(op == 3) { if(start == null) { System.out.println("list is empty"); } else { System.out.println("\nquerying the list\n"); aux = start; while(aux!=null) { System.out.print(aux.num+ " "); aux = aux.nextn; } } } if(op == 4) { if(start == null) { System.out.println("list is empty"); } else { System.out.println("\ntype the number to be removed:\n"); number = input.nextInt(); aux = start; before = null; found = 0; while(aux!=null) { if(aux.num == number) { found = found…
has comment: http://stackoverflow.com/comment/40129113

http://stackoverflow.com/q/25698753
score: -5
has comment: http://stackoverflow.com/comment/40175378
tagged with: java
has body: Write a program called CaseConverter with a main method that converts a single uppercase letter to a lowercase letter. You have to declare a char variable to hold the lowercase letter. public class CaseConverter { public static void main (String [] args){ int offset = 'a' - 'A'; char temp = 'X'; // or any other uppercase alphabet System.out.println("uppercase: " + temp); // insert code here System.out.println("lowercase: " + temp); } }
upvote count: 1
accepted answer: http://stackoverflow.com/a/25698800
has comment: http://stackoverflow.com/comment/40168613
has answer: http://stackoverflow.com/a/25698836
has answer: http://stackoverflow.com/a/25698796
favorite count: 0
has title: convert uppercase letter to lowercase letter
has answer: http://stackoverflow.com/a/25698800
type: Question
possible better answer: http://stackoverflow.com/a/25698922
has comment: http://stackoverflow.com/comment/40168540
has answer: http://stackoverflow.com/a/25698922
answer count: 6
has answer: http://stackoverflow.com/a/25698797
downvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25698849

http://stackoverflow.com/comment/40055518
has text: You get a string and have to use DecimalFormat, to fromat convert to number.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25636632

http://stackoverflow.com/comment/100253895
comment on: http://stackoverflow.com/q/25712650
type: Comment
has text: static final is preferred according to JLS!
score: 0
type: QuestionComment

http://stackoverflow.com/a/25667112
downvote count: 0
answers question: http://stackoverflow.com/q/25667069
has comment: http://stackoverflow.com/comment/40110416
score: 13
upvote count: 13
has comment: http://stackoverflow.com/comment/40110568
type: Answer
has body: The semicolon after the if terminates the statement if(!all_filenames.contains(audio_isixhosa)); { // &lt;-- new block separate from if. and so the body is an empty block. Remove the semicolon. if(!all_filenames.contains(audio_isixhosa)) {
accepted answer of: http://stackoverflow.com/q/25667069
type: AcceptedAnswer

algorithm
tags question: http://stackoverflow.com/q/25635713
tags question: http://stackoverflow.com/q/25608731
tags question: http://stackoverflow.com/q/25671967
tags question: http://stackoverflow.com/q/25657880
tags question: http://stackoverflow.com/q/25711999
tags question: http://stackoverflow.com/q/25591464
tags question: http://stackoverflow.com/q/25668352
tags question: http://stackoverflow.com/q/25625508
type: Tag
tags question: http://stackoverflow.com/q/25587003
tags question: http://stackoverflow.com/q/25617389
tags question: http://stackoverflow.com/q/25569208
tag name: algorithm
tags question: http://stackoverflow.com/q/25620837
tags question: http://stackoverflow.com/q/25711406
tags question: http://stackoverflow.com/q/25706665
tags question: http://stackoverflow.com/q/25615312
tags question: http://stackoverflow.com/q/25659045
tags question: http://stackoverflow.com/q/25605726
tags question: http://stackoverflow.com/q/25699499
tags question: http://stackoverflow.com/q/25626841
tags question: http://stackoverflow.com/q/25707636
tags question: http://stackoverflow.com/q/25595725
tags question: http://stackoverflow.com/q/25659613
tags question: http://stackoverflow.com/q/25566729
tags question: http://stackoverflow.com/q/25598497
tags question: http://stackoverflow.com/q/25661519
tags question: http://stackoverflow.com/q/25622220
tags question: http://stackoverflow.com/q/25554001
tags question: http://stackoverflow.com/q/25552209
tags question: http://stackoverflow.com/q/25646482
tags question: http://stackoverflow.com/q/25579273
tags question: http://stackoverflow.com/q/25593313
tags question: http://stackoverflow.com/q/25569437
tags question: http://stackoverflow.com/q/25660816
tags question: http://stackoverflow.com/q/25561392
tags question: http://stackoverflow.com/q/25555827
tags question: http://stackoverflow.com/q/25676463
tags question: http://stackoverflow.com/q/25608857
tags question: http://stackoverflow.com/q/25683299
tags question: http://stackoverflow.com/q/25661064
tags question: http://stackoverflow.com/q/25656544
tags question: http://stackoverflow.com/q/25602251
tags question: http://stackoverflow.com/q/25587180
tags question: http://stackoverflow.com/q/25621014
tags question: http://stackoverflow.com/q/25571821
tags question: http://stackoverflow.com/q/25597831
tags question: http://stackoverflow.com/q/25583733
tags question: http://stackoverflow.com/q/25702561
tags question: http://stackoverflow.com/q/25675832
tags question: http://stackoverflow.com/q/25666067
tags question: http://stackoverflow.com/q/25665377

http://stackoverflow.com/q/25688557
tagged with: architecture
tagged with: spring
score: 0
tagged with: message-queue
has body: Issue: I have a single process request start that breaks up into multiple levels of queues / MDBs to speed up processing through parallelism. The question is, what is the best way to know when each level of processing is complete to do a close out process? Keep in mind I am dealing with high volumes of messages so performance has to be taken into consideration. Technology Stack: EJB 3.0 MDB's Hibernate 4.2.11 () Spring 4.0.1 Websphere MQ's Oracle 11g database. Solution 1 Attempted: Parent process polls sub process until its complete at each sub-level. This means an open MDB session that will consistently poll a response queue for messages at each level for it's sub process to complete. Advantage: You avoid calls constantly to the database to determine, "Am I done yet" . Disadvantage: This solution maintains consistent open input connections to MQ while it waits and polls for the process to complete. Number of connections go up as you scale. If any messages are lost, it will throw off the count of the polling mechanism. Not very reliable. If you have persistence turned on ( which you should most times ) it will re-process the initial request since it will still be open, re-doing the entire request. Solution 2 Proposal: Instead of using polling mechanism, use more MDB's binded to response queues at each level of processing. Have everything work in isolation. How to determine if the process is complete? As each message comes to response MDB , it can check the database status table to determine if its complete. Advantage: List item All messages work in isolation. Better suited for supporting high availability and persistent messages. Prevents any long running open processes against the MQ. Disadvantage: This could mean many calls to the database for determining completeness. I think this would be a major scalability issue as the number of messages go up. I haven't used Spring batch and Spring Integration a lot but maybe that is where I should be looking for solution. Ho…
tagged with: java
tagged with: hibernate
answer count: 1
has title: JMS - Asynchronous Processing - Dealing with Parent / Child processes Dependencies
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25701575

http://stackoverflow.com/comment/39971288
has text: I did a quick test with your same Gson dependency and it works for me. I'm on Tomcat 7 though, I don't know if there could be any problem with JBoss modules. I this it's a runtime problem, since `NoClassDefFoundError` is thrown when [the searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found](http://docs.oracle.com/javase/7/docs/api/java/lang/NoClassDefFoundError.html). Is that your whole POM? Did you do a `mvn clean`, just in case? How do you deploy your *war* in JBoss?
comment on: http://stackoverflow.com/q/25590303
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25553180
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/39902039
answer count: 1
tagged with: baseadapter
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39902324
tagged with: android
tagged with: java
has body: I have a BaseAdapter class using ViewHolders to display a list of checked apps. I store the checked apps with SharedPreferences so the apps that are checked stay checked. What I am trying to achieve is getting the checked apps in my Service Class as ideally store it in an arraylist or something of the sort. The problem is that the keys are what I used to the get the values are in the BaseAdapter class too and I can't get it from the service class so I had to recreate the methods for getting the list of packages and iterating through with a for loop. I also cannot checked if the holder checkbox is checked in my Service class since that is done in my BaseAdapter class. Despite passing the context in BaseAdapter and using getApplicationContext with SharedPreferences I cannot get the list of checked apps in the service class. I am not sure where to turn now. I have tried everything from messing around with static variables, trying everything with getting the context from the BaseAdapter class etc. Here is my Adapter Class (I have commented where I get the apps which are checked): package com.ibc.android.demo.appslist.app; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.TextView; import com.spicycurryman.getdisciplined10.app.R; import java.util.ArrayList; import java.util.List; // public class ApkAdapter extends BaseAdapter { //Pastebin link: http://pastebin.com/LGRicg4U , http://pastebin.com/c4WfmhMK , http://pastebin.com/gFuuM4dY, http://pastebin.com/4Q7EP9G4 // http://pastebin.com/Te2g072w, http://pastebin.com/NLT5iUiA , SharedPreferences sharedPre…
has comment: http://stackoverflow.com/comment/39924246
tagged with: android-service
has answer: http://stackoverflow.com/a/25574864
has comment: http://stackoverflow.com/comment/39904950
has title: Getting data from BaseAdapter in Service class

http://stackoverflow.com/comment/40181978
type: Comment
comment on: http://stackoverflow.com/a/25696270
type: AnswerComment
has text: Hi, I wonder why i get error when i run this code: int moddivide= firstnumber % secondnumber; System.out.printf("%d % %d = %d/n", firstnumber, secondnumber, moddivide); Thank
score: 0

http://stackoverflow.com/comment/40197571
has text: You might be right, but what I mean is like in this example here: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml?view=markup there is a bean "entityManagerFactory" But yes I see the "@PersistenceContext" is the right annotation to use. so +1 to your answer Vlad.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25714395

http://stackoverflow.com/q/25627778
tagged with: java
tagged with: selenium-webdriver
type: UnansweredQuestion
score: 0
answer count: 1
tagged with: selenium
has title: How to run firefox browser as a different user with Selenium Webdriver?
type: Question
has answer: http://stackoverflow.com/a/25640200
has body: I'm trying to run Firefox as a different user in my Selenium tests. How can I tell Selenium to 'run as' a specified user? My application has a windows authentication, and I need to run tests with different roles.

http://stackoverflow.com/comment/40127542
has text: You're right, I now realize that you've answered your own question faster than I did, and you referred to the correct `floorKey` method rather than the wrong `floorEntry` that I used; I'm getting old... :)
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25676415

http://stackoverflow.com/comment/39951295
comment on: http://stackoverflow.com/a/25566557
score: 0
type: Comment
has text: MigLayout is not LAF.
type: AnswerComment

http://stackoverflow.com/a/25601803
has comment: http://stackoverflow.com/comment/39993963
has body: You can do it with reflection: for (String string : classNameList) { Class actualClass = Class.forName(className); Object classObj = actualClass.newInstance(); Method doOp = this.getClass().getDeclaredMethod("doOperation", actualClass); doOp.setAccessible(true); doOp.invoke(this, classObj); }
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39993354
answers question: http://stackoverflow.com/q/25601539
accepted answer of: http://stackoverflow.com/q/25601539
type: Answer

http://stackoverflow.com/q/25630913
tagged with: jsp
accepted answer: http://stackoverflow.com/a/25631020
has body: I am trying to run my struts application but I am getting a error action is not mapped I have seen the namespace it is correct but still getting the error? struts.xml: <?xml version="1.0" encoding="UTF-8" ?> <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devMode" value="false" /> <include file="register.xml"/> And my register.xml: <?xml version="1.0" encoding="UTF-8" ?> /register.jsp register.jsp I am validating my register page and the validation XML as follows RegisterAction-validation.xml: <message key="requiredstring"/> <message key="requiredstring"/> 6 true <message key="requiredpassword"/> <message key="requiredstring"/> <message key="requiredemail"/> <message key="requiredstring"/> <message key="requiredstring"/> ^\d*$ <message key="requiredinteger"/> And my register.jsp as follows: <%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> Validation Struts page <s:head/> <s:form action="Register"> <s:textfield key="username"/> <s:password key="password" /> <s:textfield key="email" /> <s:select headerKey="" headerValue="Select Gender" key="gender" list="#{'M':'Male','F':'Female'}" /> <s:textfield key="postalcode" /> <s:submit/> </s:form> My Project Structure as Follows: Strutsvalidation --src--> com.struts2(package)--> register.xml, registeraction-validation.xml, javaclasses, struts.xml --webcontent--> web-inf--> web.xml register.jsp(in web content) I am getting the error as follows? There is no Action mapped for action name Register. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185) at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63) at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58) at org.apache.struts2.dispatcher.Dispatcher.serviceActi…
has answer: http://stackoverflow.com/a/25631020
tagged with: struts2
type: AnsweredQuestion
score: 2
tagged with: java
answer count: 1
tagged with: xml-configuration
has comment: http://stackoverflow.com/comment/40072019
favorite count: 0
type: Question
has title: Regarding the Action Mapping in Struts2 - There is no Action mapped
upvote count: 2
tagged with: actionresult
downvote count: 0

http://stackoverflow.com/comment/40243483
type: Comment
type: QuestionComment
has text: reported the issue at alfresco jira and fix is going to be in the next release https://issues.alfresco.com/jira/browse/ALF-21093
comment on: http://stackoverflow.com/q/25647239
score: 1

http://stackoverflow.com/comment/87011313
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25680258
has text: We have at least: UPPERCASE, lowercase, camelCase, PascalCase, snake_case, SCREAMING_SNAKE_CASE, hyphen-case, dot.case.
score: 0

http://stackoverflow.com/comment/40202472
score: 0
has text: Your question embodies a contradiction in terms. You state that you know it isn't mandatory: therefore you don't 'need' one at all. You can *use* one, to run Java code: applets or JWS applications.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25712364

http://stackoverflow.com/comment/39999351
comment on: http://stackoverflow.com/q/25570356
score: 0
has text: Yes I do, it is actually a jersey-client dependency. jersey-guava(2.11) which depends on Google Guava. I will try to make it a direct dependency, just in case. Thanks for the heads up.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25572302
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/39939954
has comment: http://stackoverflow.com/comment/39940624
has comment: http://stackoverflow.com/comment/39940384
has body: Why not simply make use of ByteArrayOutputStream.writeTo(B)? Edit: So after dragging out what you really want to do; forget streams for this. The problem could be solved with streams, but its not simpler than just copying bytes. Since streams are intended for I/O, you end up with extra exception handling, but no extra value for the problem. Use a member variable to remember leftover bytes from previous calls to B() and just fill your array using an ordinary loop, requesting more data from A() when leftovers are out.
has comment: http://stackoverflow.com/comment/39940922
answers question: http://stackoverflow.com/q/25571107
has comment: http://stackoverflow.com/comment/39939192

http://stackoverflow.com/comment/39903914
has text: Would you like a full GUI solution is Swing?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25554137

http://stackoverflow.com/a/25796192
type: Answer
answers question: http://stackoverflow.com/q/25644023
has body: Using SAXparser can be a nightmare. This is the most widely used XML parser in java and every one have end up using either directly or indirectly. JDK 8 have JAXB already available . So if you are using JDK 8 then only possible way should be removing the maven dependency. I had this issue as well so I tried removing the maven dependency but not happened. Then I thought why not revert to older version if java and VOILLA I got success. I am using jdk 7 currently and my tests run smoothly. I guess this is the only solution.
score: 0
has comment: http://stackoverflow.com/comment/58401733
has comment: http://stackoverflow.com/comment/40364645
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/25569969
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25570098
has body: I'd like to have an action handler, when I edit a jTree line. For exemple, as I need to update some values in a database, I need my program to detect if a line is being edited, so I can do what I want with this new line. Is there any action handler who does it? "valueChanged" one detects the selection, not changes. Otherwise, It could be even perfect if the action hadler detects when I exit from "editing a line", clicking on ENTER. Any help will be appreciated! Thank you!
type: Question
has answer: http://stackoverflow.com/a/25570098
has title: Jtree : Action handler if text changes?
tagged with: jtree
answer count: 1
tagged with: event-handling
type: AnsweredQuestion

http://stackoverflow.com/a/32246212
answers question: http://stackoverflow.com/q/25665867
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25665867
has body: As long as your foo directory contains only .class files, you can safely set the Class-Path: header like this: Class-Path: foo/ Since you have non executable jars in it, you should use a build tool like Maven to generate the Class-Path: entry for you. The non executable jars will be dependencies of your Maven project. Reference: JAR : MANIFEST.MF Class-Path referencing a directory
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/52381652
score: 3

http://stackoverflow.com/comment/40008543
comment on: http://stackoverflow.com/q/25610917
score: 3
type: Comment
has text: Why wouldn't you specify the error?
type: QuestionComment

http://stackoverflow.com/a/25554898
score: 0
has body: We can't change the string to add additional escape character. I guess that is not possible because \n has a special meaning when used in String. Escape the backslash with double backslash like this \\n This shall give you length as 2 String str = "\\n"; System.out.println(str.length()); Or try using apache commons-lang's StringEscapeUtils#escapeJava()
type: Answer
answers question: http://stackoverflow.com/q/25554846
has comment: http://stackoverflow.com/comment/39904759

http://stackoverflow.com/comment/40106767
type: Comment
has text: I want to try. Please, upload it.
comment on: http://stackoverflow.com/q/25663637
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39915103
has text: have you tried with `if(dataPlat!=null && !dataPlat.isEmpty());`?
score: 0
comment on: http://stackoverflow.com/q/25560241
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25600494
has comment: http://stackoverflow.com/comment/39991682
score: 0
has comment: http://stackoverflow.com/comment/39992443
has comment: http://stackoverflow.com/comment/40002971
answers question: http://stackoverflow.com/q/25595634
has body: If you look at SDL_android_main.c, you will find, e.g. void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj) { ... } Which defines a native method of class SDLActivity in package org.libsdl.app. You must rename all such functions in your .c files if the package of the SDLActivity is renamed. On the other hand, there is no need to rename the package of the Java class when you rename the APK package. It is also often convenient to create a small "native wrapper" Java class, and move all native methods to this class; then call them from this class. This is especially relevant for static native methods. ==== Update ==== Here is another place where the package name is hardwired: See class com.van.gba.SelectGameActivity String strTempPath = Environment.getExternalStorageDirectory().getAbsolutePath(); strTempPath += "/Android/data/"; strTempPath += SelectGameActivity.this.getPackageName(); File dir = new File(strTempPath); It is looking for some files based on its package name; it assumes that its package name is equal to the APK package name. There are probably more places like this in your code. When you have them fixed, you will be able to rename the APK package.
type: Answer
has comment: http://stackoverflow.com/comment/39996621

http://stackoverflow.com/comment/42531058
comment on: http://stackoverflow.com/q/25569896
type: Comment
score: 0
type: QuestionComment
has text: yes, I had to give permission to yahoo app to return the response

http://stackoverflow.com/a/25614842
upvote count: 1
has body: // MyClass2.java public class MyClass2{ public static MyClass1 MY_CLASS1 = new MyClass1();//you have already instantiated MyClass1 by new operator here public MyClass2(){ MY_CLASS1.new MyNestedClass1(); //so now intantiate only inner class by new operator } }
type: Answer
answers question: http://stackoverflow.com/q/25614799
score: 1
downvote count: 0

http://stackoverflow.com/comment/40150592
comment on: http://stackoverflow.com/a/25678504
score: 0
type: AnswerComment
type: Comment
has text: I tried that but when I rebuild the project I have the error: package com.mycompany.package doesnt exist. I'm using Android Studio

http://stackoverflow.com/a/25623594
upvote count: 1
has comment: http://stackoverflow.com/comment/40035740
downvote count: 0
answers question: http://stackoverflow.com/q/25623265
type: Answer
has body: I would try re-using the Document object. I've had looping issues with the garbage collection where my loops are too fast for the gc to reasonably keep up, and re-use of objects solved all my issues. I haven't tried re-using the Document object personally, but if it's possible, it may work for you.
score: 1

http://stackoverflow.com/q/25606959
score: 1
has title: MultiThread with one Webservice Client Stub
tagged with: java
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/40001691
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40001682
has comment: http://stackoverflow.com/comment/40001734
tagged with: web-services
has comment: http://stackoverflow.com/comment/40001648
linked to: http://stackoverflow.com/q/1950080
has body: Can more than one Thread use same stub instance to invoke webservice call without loosing parallelism? if each webservice call open a new socket connection, using one stub instance does not allow loosing parallel method invocation. Any comments will be be appreciated. I am using Axis, jax-ws, java-ee 6
has comment: http://stackoverflow.com/comment/40002013
answer count: 0

http://stackoverflow.com/a/25698122
upvote count: 1
has body: You don't store the numbers directly in the list and create it recursively: [null] -> 0 [null -> Nat1(pre=null)] -> 1 [null -> Nat1(pre=null) -> Nat2(pre=Nat1)] -> 2 etc Why the plus() works: Now we can observe that addition x+y can be changed to (x-1)+(y+1) etc. until 0 + (y + x). In your code you are not really interested in addition per se but you want to get to the Nat which represents the result of the summation. You do that recursively by using the above transformation until other is 0 - this is your base case which simply counts the recursive calls and makes sure you do them x times. Example: [null -&gt; Nat1(pre=null) -&gt; Nat2(pre=Nat1) -&gt; Nat3(pre=Nat2) -&gt; Nat4(pre=Nat3) -&gt; Nat5(pre=Nat5)] And let's say you want to add 3 and 2. First you start with other=Nat2 and call it on Nat3, so you get Nat3's successor which is Nat4 and call plus() on it using other's predecessor which is Nat1, still no zero so you call plus() on Nat4's successor (Nat5) with Nat1's predecessor which is null, you hit your base case and return this which at this point of recursion is Nat5.
type: Answer
answers question: http://stackoverflow.com/q/25697996
downvote count: 0
score: 1

http://stackoverflow.com/q/25649554
tagged with: java
tagged with: hibernate
tagged with: mysql
has body: I am working in java hibernate and mysql. I want to use transaction settimeout for a payment functionality of application. I just test the code as below for settimeout to work. Transaction tx = (Transaction) threadTransaction.get(); try { if (tx == null) { Session session = (Session) threadSession.get(); session.getTransaction().setTimeout(5); tx=session.beginTransaction(); try { Thread.sleep(6000); } catch (InterruptedException e) { e.printStackTrace(); } if(session.getTransaction().isActive()) { System.out.println("session active"); } else { System.out.println("session inactive"); } threadTransaction.set(tx); } } catch (HibernateException e) { throw new HibernateException("", e); } But it print session active, means the timeout doesnt work. What is the reason? please help !
type: Question
answer count: 1
type: AnsweredQuestion
score: 0
has title: hibernate settimeout not working mysql
has answer: http://stackoverflow.com/a/25654665
accepted answer: http://stackoverflow.com/a/25654665

http://stackoverflow.com/q/25683624
score: -1
has body: I'm building a Java method to sum arithmetically two time periods, using JodaTime library. My code works fine, but I think that it's possible optimize to reduce the time execution... Unfortunately, I'm new on JodaTime. This is my code: import org.joda.time.Period; import org.joda.time.PeriodType; import org.joda.time.format.PeriodFormatter; import org.joda.time.format.PeriodFormatterBuilder; public class Test { public static void main(String[] args) { String time1 = "08:00"; String time2 = "08:00"; System.out.println(Operation_Sum(time1,time2)); } private static String Operation_Sum(String time1, String time2) { String output; long start = System.currentTimeMillis(); if (time1.equals("00:00") &amp;&amp; time2.equals("00:00")) { output = "00:00"; } else if (time1.equals("00:00")) { output = time2; } else if (time2.equals("00:00")) { output = time1; } else { boolean sign_time1 = false; boolean sign_time2 = false; String[] time1_out, time2_out; boolean negative = false; String output_split[]; if (time1.contains("-")) { time1_out = time1.split(":"); time1_out[0] = time1_out[0].replace("-", ""); time1_out[1] = time1_out[1].replace("-", ""); time1 = time1_out[0] + ':' + time1_out[1]; sign_time1 = true; } if (time2.contains("-")) { time2_out = time2.split(":"); time2_out[0] = time2_out[0].replace("-", ""); time2_out[1] = time2_out[1].replace("-", ""); time2 = time2_out[0] + ':' + time2_out[1]; sign_time2 = true; } PeriodFormatterBuilder builder = new PeriodFormatterBuilder(); builder.minimumPrintedDigits(2); builder.printZeroAlways(); builder.appendHours(); builder.appendLiteral(":"); builder.appendMinutes(); PeriodFormatter pf = builder.toFormatter(); Period period1 = pf.parsePeriod(time1); Period period2 = pf.parsePeriod(time2); Period normalized; Period total = null; if (sign_time1 &amp;&amp; sign_time2) { total = period1.plus(period2); negative = true; } if (sign_time1 &amp;&amp; !sign_time2) { total = period2.minus(period1); } if (!sign_time1 &amp;&amp; sign_time2) { …
tagged with: optimization
tagged with: performance
has comment: http://stackoverflow.com/comment/40140172
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40140303
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25684360
tagged with: jodatime
has comment: http://stackoverflow.com/comment/40140135
has title: How can I optimize this code? (JodaTime required)
upvote count: 0
tagged with: period
type: UnansweredQuestion

http://stackoverflow.com/q/25610966
type: AnsweredQuestion
answer count: 2
tagged with: extract
accepted answer: http://stackoverflow.com/a/25611076
has answer: http://stackoverflow.com/a/25611057
upvote count: 0
has answer: http://stackoverflow.com/a/25611076
downvote count: 1
tagged with: youtube
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25611057
has title: Java - Extract information out of HTML-String with RegEx
has body: I am trying to extract informations out of the HTML-Code of a Youtube Playlist page. (Playlist Name, Video Names, Video Links) I know it is bad practice to use Regex but since this programm is just for personal use and I only read in 1 line per video in the playlist it doesn't need to be very sophisticated. Like I said per video there is basicly only 1 line I need. Example: &lt;tr class="pl-video yt-uix-tile " data-video-id="VIDEO-ID" data-set-video-id="" data-title="TITLE"&gt;&lt;td class="pl-video-handle "&gt;&lt;/td&gt;&lt;td class="pl-video-index"&gt;&lt;/td&gt;&lt;td class="pl-video-thumbnail"&gt;&lt;a href="reflink inside palylist" class="ux-thumb-wrap yt-uix-sessionlink contains-addto pl-video-thumb" data-sessionlink="sessionlink"&gt; &lt;span class="video-thumb yt-thumb yt-thumb-72" The only 2 information I basicly need are VIDEO-ID and TITLE. My RegEx pattern looks like this so far: Pattern pLine = Pattern.compile("&lt;tr class=\"(?&lt;line&gt;.*)"); He finds exactly the lines I need but every attempt from me to get only TITLE and VIDEO-ID got me no results :/ I'm sorry if this is a trivial question or one that shouldn't be asked here. But that is my situation so far. And no this is NO homework ;)
tagged with: java
tagged with: http://stackoverflow.com/tag/html
score: -1
tagged with: regex

http://stackoverflow.com/a/41869979
score: 1
answers question: http://stackoverflow.com/q/25583227
type: Answer
has body: first add your custom font to assets->fonts directory Like this image then add this code to attrs.xml file value folder &lt;declare-styleable name="TextViewCustomFont"&gt; &lt;attr name="showText" format="boolean" /&gt; &lt;attr name="custom_font" format="enum"&gt; &lt;enum name="roboto_Regular" value="0"/&gt; &lt;enum name="roboto_bold" value="1"/&gt; &lt;enum name="roboto_medium" value="2"/&gt; &lt;/attr&gt; &lt;/declare-styleable&gt; now add this custom class extending TextView. one thing is that the default is robot regular and it has default value 0. so when the custom:custom_font attribute is not set than a.getInteger(R.styleable.TextViewCustomFont_custom_font, 0) is returning 0. public class CustomFontTextView extends TextView { public CustomFontTextView(Context context) { super(context); } public CustomFontTextView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context,attrs); } public CustomFontTextView(Context context, AttributeSet attrs) { super(context, attrs); init(context,attrs); } private void init(Context context, AttributeSet attrs) { int fontFlag; TypedArray a = context.getTheme().obtainStyledAttributes( attrs, R.styleable.TextViewCustomFont, 0, 0); try { fontFlag = a.getInteger(R.styleable.TextViewCustomFont_custom_font, 0); Log.v("fontFlag", fontFlag + ""); } finally { a.recycle(); } Typeface tf = null; if (fontFlag == 0) tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/Roboto-Regular.ttf"); else if (fontFlag == 1) tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/Roboto-Bold.ttf"); else if (fontFlag == 2) tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/Roboto-Medium.ttf"); setTypeface(tf); } } now use this class in your layout file &lt;com.example.tomal.CustomFontTextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:text="@string/title" your_choice:custom_font="roboto_medium" /&gt; ad…
downvote count: 0
upvote count: 1

jtree
tags question: http://stackoverflow.com/q/25710678
tags question: http://stackoverflow.com/q/25567436
tag name: jtree
type: Tag
tags question: http://stackoverflow.com/q/25569969

http://stackoverflow.com/q/25685383
has answer: http://stackoverflow.com/a/25685551
answer count: 7
tagged with: mysql
tagged with: jsp
has title: How to retrieve a Java variable from a JavaScript function?
has answer: http://stackoverflow.com/a/25685659
has answer: http://stackoverflow.com/a/25788243
type: Question
has answer: http://stackoverflow.com/a/25685576
has body: I have a Java class Controller.java. In the controller I can retrieve to MySQL database and keep the user informations into a list by List&lt;User&gt; users = userDAO.findAllUsers(); There is no problem so far. To check, I can retrieve users from index.jsp by &lt;c:forEach var="user" items="${users}"&gt; &lt;li&gt;${user.id}&lt;/li&gt; &lt;/c:forEach&gt; I also have a myScripts.js file. I wrote scripts into it and I imported the file by &lt;script src="myScript.js"&gt;&lt;/script&gt;. There is still no problem so far. I want to sketch a HighCharts line chart by using user list. It means, I have to retrieve a Java variable from a JavaScript function. How can I do this? Thanks a lot.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25685678
tagged with: javascript
linked to: http://stackoverflow.com/q/3177733
has answer: http://stackoverflow.com/a/25685709
score: 0
has answer: http://stackoverflow.com/a/25685525
linked to: http://stackoverflow.com/q/11536455
tagged with: java

http://stackoverflow.com/q/25567111
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/46149030
favorite count: 0
has answer: http://stackoverflow.com/a/73890924
has title: intelliJ plugin installation path
type: Question
has body: I have installed visualvm plugin in from the dedicated intelliJ panel. I am now the plugin path. I can't find it, I tried : ~/Library/Application Support/IntelliJIdeaXX but I only get the two files availables.xml extensions.xml. I suppose the path I am asked is the jar file of the installed plugin, but I don't know where it is stored. Could someone help ?
score: 3
has comment: http://stackoverflow.com/comment/39927690
has comment: http://stackoverflow.com/comment/39928069
has comment: http://stackoverflow.com/comment/39927660
tagged with: intellij-idea
tagged with: path
tagged with: plugins
has comment: http://stackoverflow.com/comment/39928764
has comment: http://stackoverflow.com/comment/39928363
upvote count: 3
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/67169778

http://stackoverflow.com/a/25623402
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25623265
has body: As far as I can see you do not write your stuff to file as far as you get it. Instead you try to create full DOM object and then flush it to file. This strategy is good for limited amount of objects. In your case when you have to deal with millions of them (as you said) you should not use DOM. Instead you should be able to create your XML fragments and write them to file while you are receiving the data. This will reduce your memory consumption and hopefully improve the performance.
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25623265
has comment: http://stackoverflow.com/comment/40035674

http://stackoverflow.com/comment/40149956
comment on: http://stackoverflow.com/a/25688865
type: Comment
has text: If they are used as key in the map, the map will have a reference to them, so as long as the map does not go out of scope, even if you exit the loop you will not loose them .. if this is what you're asking.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25662956
type: Question
has comment: http://stackoverflow.com/comment/40103216
has comment: http://stackoverflow.com/comment/40103278
answer count: 0
has body: I am facing problems when using try/catch I created an exception class called EmptyQueueException that extends from Exception Unfortunately, Eclipse throws me an error :" Catched expected instead" public class Testclass { public static void main(String[] args) { ArrayQueue arrayy = new ArrayQueue(); try{ arrayy.dequeue(); } catch(EmptyQueueException s){ // what to do here ? } } // end main } // end testclass Here is my Exception class: public class EmptyQueueException extends Exception { // automatically done by eclipse, what for? private static final long serialVersionUID = 1L; public EmptyQueueException() { } public EmptyQueueException(String s){ super("Queue is empty"); } } This is my dequeue method: public int dequeue() throws EmptyQueueException { if (empty()){ throw new EmptyQueueException(); } int retour = head(); head = ++head % array.length; return retour; }
has comment: http://stackoverflow.com/comment/40102853
has comment: http://stackoverflow.com/comment/40102904
has comment: http://stackoverflow.com/comment/40102929
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40103002
has comment: http://stackoverflow.com/comment/40102948
has comment: http://stackoverflow.com/comment/40102988
score: 0
tagged with: java
has title: Error when using try catch in Java
has comment: http://stackoverflow.com/comment/40103154
has comment: http://stackoverflow.com/comment/40102985

http://stackoverflow.com/comment/40228181
has text: I think you may need to make add a specific event handler to the anchor element. And in the anchor element event listener call. event.preventDefault(). Otherwise the browser will automatically handle the default anchor click. The anchor element may be capturing the click event and not propagating the event to your ulPanel. I know what you are doing may work but it I have had problems with this in the past and decided to add the handler to the li element itself rather than the container.
comment on: http://stackoverflow.com/q/25634257
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/25674257
favorite count: 0
type: Question
has body: My web application is running in tomcat 6. We are using DOJO for UI and web services for data access. Currently, there is a webservice available to clear/build the cache in our application. As we are access this using a https/http, it is holding huge memory and taking much time to process. so currently we are planning to take this process out of web services and wanted to execute as a standalone app. I need to have a standalone (backend) application (may be main class) which should do the above activity. The problem is that all beans used to clear/build the cache are available in application context (meaning inside the tomcat container). I want to access the same available beans in external main class and do the process.. (possible ?) How to get the application context outside the tomcat scope, I mean in external java class ? Else, can i have another application (jar file with one main class file) which i will deploy it with the same application and trigger it via tomcat (possible?), so that the application context is available for the main class thereby we can access the beans/context. Earlier in my previous project, we have used EJB home and remote interface to connect to main class (jar file with only one main class containing EJB connecting code) deployed along with the application. But the applciation server is WEBSPHERE. can we do the same thing in tomcat. kindly help on this... thanks in advance for your replies...
type: UnansweredQuestion
tagged with: spring
score: 0
tagged with: java
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25674630
tagged with: web-services
tagged with: tomcat
has title: How to access existing application context running in tomcat in external main class
tagged with: backend
downvote count: 1

http://stackoverflow.com/comment/40201874
has text: Hi, i'm not supposed to use parse to do the operations, my assignment is to do the arithmetic character by character. also, do you mean do input checking where if the user enters a negative number i call the method that does the operation for negative numbers?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25700451
type: Comment

http://stackoverflow.com/comment/40027784
score: 0
has text: I can agree on end users' dumbness, still we're considering an user that actually knows how to install a module, so the assumption he/she can locate the installation folder of a game is kinda good.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25620852

http://stackoverflow.com/comment/40191957
comment on: http://stackoverflow.com/a/25711118
type: Comment
type: AnswerComment
has text: What do you expect me to do with that image?
score: 0

http://stackoverflow.com/comment/40184812
type: QuestionComment
has text: @Adam I am using (\d+|\d+.\d+) as my regex on the input mentioned above.
score: 0
comment on: http://stackoverflow.com/q/25707779
type: Comment

http://stackoverflow.com/q/25593790
possible better answer: http://stackoverflow.com/a/25594038
has answer: http://stackoverflow.com/a/25594284
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25594038
tagged with: http://stackoverflow.com/tag/json
answer count: 3
has comment: http://stackoverflow.com/comment/39977252
has answer: http://stackoverflow.com/a/25593922
has body: I have a JSON data which is parsed to an Android App. {"tag":"Login","tdata":[{"ID":"C1","C2","Name":"ABC","PQR"}]} I want to extract the data C1, C2, ABC, PQR in separate string variables. How can I do it? When I tried the following code: JSONObject json=data.getJsonArray(0); JSONArray id=json.getJSONArray("ID"); System.out.println(id); This was the output: "C1","C2"
has comment: http://stackoverflow.com/comment/39977664
has comment: http://stackoverflow.com/comment/39977354
type: Question
has comment: http://stackoverflow.com/comment/39978265
has title: JSON data parsing to Android App
tagged with: android
accepted answer: http://stackoverflow.com/a/25594284

jdk6
tag name: jdk6
tags question: http://stackoverflow.com/q/25655283
type: Tag

http://stackoverflow.com/comment/40019584
comment on: http://stackoverflow.com/a/25596210
score: 0
type: AnswerComment
type: Comment
has text: Actually Jenkins still get "Unauthorized" even with this setting

yahoo
type: Tag
tag name: yahoo
tags question: http://stackoverflow.com/q/25569896

http://stackoverflow.com/q/25626477
has title: Remote running spark job
upvote count: 1
has answer: http://stackoverflow.com/a/28933832
has comment: http://stackoverflow.com/comment/40437199
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/29808679
has comment: http://stackoverflow.com/comment/40415269
has body: Trying to run start Spark job. Spark installed as parcel inside Cloudera Hadoop. How to start Spark job remotely with Java API?
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/44929772
tagged with: hadoop
answer count: 2
tagged with: apache-spark
tagged with: cloudera
downvote count: 0

http://stackoverflow.com/comment/40038430
has text: Yes, start both thread, **then** join them.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25626790

http://stackoverflow.com/a/25618517
type: Answer
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25618435
has body: Use Capturing Groups: \d+~?\d+~?\w+~(.*) group(1) contains the part you want. Another solution is using String#split: String[] splitted = myString.split("~"); String res = splitted[splitted.length() - 1];

http://stackoverflow.com/a/27399844
has body: An easy way would be to have a Class for constants package com.my.pakage; public class FormConstants { public static final String formInput1="formInput1"; } and then do the imports in jsp: &lt;%@ page import="com.my.pakage.FormConstants" %&gt; to use it like this: &lt;input type="text" name="&lt;%=FormConstants.formInput1%&gt;"&gt; and normally in your Java files: import com.my.pakage.FormConstants
accepted answer of: http://stackoverflow.com/q/25561515
score: 3
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/76249760
answers question: http://stackoverflow.com/q/25561515
type: AcceptedAnswer
downvote count: 0

elasticsearch
tags question: http://stackoverflow.com/q/25552321
tags question: http://stackoverflow.com/q/25639866
tags question: http://stackoverflow.com/q/25632207
tags question: http://stackoverflow.com/q/25555228
tags question: http://stackoverflow.com/q/25573431
type: Tag
tags question: http://stackoverflow.com/q/25698381
tags question: http://stackoverflow.com/q/25579876
tags question: http://stackoverflow.com/q/25706044
tag name: elasticsearch
tags question: http://stackoverflow.com/q/25620471
tags question: http://stackoverflow.com/q/25553494
tags question: http://stackoverflow.com/q/25689800
tags question: http://stackoverflow.com/q/25644182
tags question: http://stackoverflow.com/q/25711426

http://stackoverflow.com/comment/39965086
type: AnswerComment
comment on: http://stackoverflow.com/a/25587088
has text: I think you have confused me... So when you save to the database, the changes apear in the database for contact 1, but if you retreve the object contact 2(witch should have a reference to contact1) from the database, Contact partner is null?
score: 0
type: Comment

http://stackoverflow.com/comment/40173161
type: AnswerComment
has text: t is an implemenation of a "Query" interface. The outer class (SomeOtherClass in your case), is an implementation of a parameterized builder interface which constructs instances of objects which can be used to execute queries against a data store (for example, Criteria for hibernate, a SearchQueryBuilder for elasticsearch, etc). So as you can see, the problem with having t do the work is that it would require knowledge of HOW to construct these criteria which is beyond its intended purpose of just containing information about WHAT to query.
comment on: http://stackoverflow.com/a/25701302
type: Comment
score: 0

http://stackoverflow.com/comment/40181023
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25601229
type: AnswerComment
has text: When i call test2() and i try to print x Content i get result it work but line after that when i try to save this content its Crash

http://stackoverflow.com/comment/40129035
comment on: http://stackoverflow.com/q/25677143
type: QuestionComment
type: Comment
score: 0
has text: @user3816423, are you trying to implement a linked list? Can you clarify which part of your code you are struggling with?

http://stackoverflow.com/comment/40063298
comment on: http://stackoverflow.com/q/25640760
score: 0
has text: Please don't clarify as comment but extend your initial question that way all information is grouped together.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40057884
score: 0
has text: Basically same remarks than those in the Processing forum: don't compare two floats, or a float with an integer. Here, you can do `if (c == it(percentage))` although comparing a "percentage" with a "color" seems strange...
comment on: http://stackoverflow.com/q/25605628
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40145810
comment on: http://stackoverflow.com/a/25677092
score: 0
has text: It depends on the SDK you're using to execute it, not the SDK's you're theoretically targeting. Try doing what the answer linked specifies.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25666876
upvote count: 1
score: 1
type: Answer
has body: Consider the following design: inside our A element, we have a frob attribute with the value 'Y' or the value 'N'. If frob='Y', then A must contain B, C, and zero or more occurrences of D; if frob='N', then the contents of A are X, Y, Z. As you say, XSD 1.0 cannot enforce the consistency of the frob attribute with the contents of A. Now consider the following design: the A element contains either B and C followed by zero or more occurrences of D, or else X, Y, and Z in that order. XSD 1.0 can express this design very simply. For every XML instance correct against the first design, there is a corresponding instance which is correct against the second design, and vice versa. In other words, the two designs contain exactly the same information. Under these circumstances, my suggestion would be to ask yourself why you want the redundant frob attribute, when it conveys no useful information not already conveyed by the content of A.
has comment: http://stackoverflow.com/comment/40110298
has comment: http://stackoverflow.com/comment/40118606
answers question: http://stackoverflow.com/q/25666135
has comment: http://stackoverflow.com/comment/40110444
downvote count: 0
has comment: http://stackoverflow.com/comment/40112913

http://stackoverflow.com/comment/40056382
comment on: http://stackoverflow.com/a/25636931
score: 0
type: AnswerComment
has text: @SotiriosDelimanolis Thanks for noticing. I just wrote and quit this page. Did'nt know about the edit. Me too edited the post.
type: Comment

http://stackoverflow.com/comment/40179512
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25703535
has text: Can you edit your question and show us full code ? I would have redirected you to this thread about [passing a double value by reference](http://stackoverflow.com/questions/5749251/java-passing-a-double-value-by-reference) which is what I meant by "you need to pass an object's reference to your set method", but that solution requires to write a new class (MutableDouble) and I **really** doubt that it's what your instructor are expecting from you at this point. By seeing your full code, I may be able to understand what was your intention in the first place ;)
score: 0

http://stackoverflow.com/q/25615690
tagged with: android-annotations
has comment: http://stackoverflow.com/comment/40038593
tagged with: android
has body: Is it possible to set a custom title with the Android Annotations api? Previously I would call requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_layout); in the onCreate method, but this doesn't appear to be possible in the @AfterViews annotated method, since it has to be done before the contentView is set. Is there a way to achieve this?
has comment: http://stackoverflow.com/comment/40040016
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25616492
has answer: http://stackoverflow.com/a/25616492
answer count: 1
has comment: http://stackoverflow.com/comment/40017900
tagged with: android-titlebar
has comment: http://stackoverflow.com/comment/40018489
type: Question
has title: Custom title with Android Annotations

http://stackoverflow.com/comment/39976357
type: QuestionComment
has text: Sorry for the delay, added @AnubianNoob, thanks!
score: 0
comment on: http://stackoverflow.com/q/25588526
type: Comment

http://stackoverflow.com/comment/40054017
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25635597
type: AnswerComment
has text: This is my output. I need to simply subtract the first two methods to get 0.77 but instead i get -256. I dont why this is the output. --------------------Configuration: <Default>-------------------- 384.77000000000004 384 -256.05 Process completed.

ssh
tags question: http://stackoverflow.com/q/25624065
tags question: http://stackoverflow.com/q/25689842
type: Tag
tags question: http://stackoverflow.com/q/25690600
tag name: ssh

http://stackoverflow.com/q/25640998
tagged with: selenium
has title: How to find an element inside a tablelayout using xpath in appium for android
type: Question
tagged with: xpath
tagged with: appium
type: UnansweredQuestion
tagged with: android
has body: How to find an element inside a tablelayout using xpath in appium for android. I have tried the following syntax WebElement username=driver.findElement(By.xpath("//android.widget.TableLayout[@index='1']//android.widget.TableRow[@index='0']/android.widget.EditText[@index='0']")); username.sendKeys("sampletext"); but I am getting the following exception. "org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters." When I tried the following WebElement username=driver.findElement(By.xpath("//android.widget.EditText[@index='0']")); It is working fine. The problem arises when I tried to add the parent followed by the child. 1.How can i access all the childs of table layout using a for loop? 2.How can I find a child followed by parent using xpath.Pls help
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25688689

http://stackoverflow.com/comment/44779525
comment on: http://stackoverflow.com/q/25587681
score: 0
type: Comment
type: QuestionComment
has text: You really need to be catching a 403 to deal with flow control, and you need to trace the http to see what's happening on the wire. I suggest you post your question to https://groups.google.com/forum/#!forum/google-http-java-client

http://stackoverflow.com/a/25590217
has comment: http://stackoverflow.com/comment/39977042
has body: The servlet-api.jar is part of your server (Tomcat in this case). You need to either state a reference to that jar in your POM and mark it in 'provided' scope or (if you are not using maven for some reason) you need to add it to your classpath (the libraries of your web module in your project). The chances are perhaps that your Tomcat installation forder or maven repo is different after your HD reinstall. It seems to be like an environmental issue.
has comment: http://stackoverflow.com/comment/58498596
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25589152
has comment: http://stackoverflow.com/comment/39976833
has comment: http://stackoverflow.com/comment/39976841
score: 31
upvote count: 31
accepted answer of: http://stackoverflow.com/q/25589152
type: AcceptedAnswer

http://stackoverflow.com/q/25587346
has title: My sentinel controlled while loop is not working
favorite count: 0
type: Question
has body: I can't get the while loop to work. The Program prompt user whether (s)he wants to continue, enter 0 toquit or any other integer to continue. If the user wants to c ontinue, the program will loop back to themenu, otherwise, it will exit. Thus, you should have a sentinel-controlled loop that will end when a 0 is entered import java.util.Scanner; public class AdoptAPet { public static void main(String[] args) { Scanner input = new Scanner(System.in); int gender = 0; double costAdoption = 0.0; double costGenderSelect = 0.0; double costAnyGender = 0.0; double costProcessing = 0.0; double total = 0.0; int genderCounter = 0; System.out.println("Choose from the following options: 1 for male, 2 for female, 3 for any"); while(gender != 0);//begin sentinel controlled while loop { System.out.print("Please choose the gender of the cat you wish to purchase:"); gender = input.nextInt(); if(gender &lt; 0) { System.out.println("INVALID CHOICE! "); System.out.print("enter 0 to quit: 0 or enter any other nunber to continue:"); gender = input.nextInt(); } if(gender == 1) { costAdoption = 9.50; costAdoption += costProcessing + 2.00; total += costAdoption; System.out.printf("Your Choice is: " ); System.out.printf("male and the total is $%.2f", total); } if(gender == 2) { costGenderSelect = 11.50; costGenderSelect += costProcessing + 2.00; total += costGenderSelect; System.out.printf("Your Choice is: " ); System.out.printf("female and the total is $%.2f", total); } if(gender == 3) { costAnyGender = 9.50; costAnyGender += costProcessing + 2.00; total += costAnyGender; System.out.printf("Your Choice is: " ); System.out.printf("Any gender and the total is $%.2f", total); } } } }
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/25588298
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25588488
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/40133068
type: Comment
comment on: http://stackoverflow.com/a/25679384
has text: could you please recommend a product ? i am familiar with jdbc concepts
score: 0
type: AnswerComment

http://stackoverflow.com/a/49736145
answers question: http://stackoverflow.com/q/25563640
has body: When I first read the documentation of the Semaphore I also misinterpreted the explanation. The main point I missed was the part of '...INITIAL number of permits...'. Somehow I though this would be the number of permits which would be available as a MAXIMUM, but that is NOT the case. In the end the semaphore just counts up from any number but only starts the enable waiting threads (which use the acquire) when the semaphore permits are above 1. A simple piece of (non threading) code shows this too: @Test public void testNegativeSemaphore() { Semaphore semaphore = new Semaphore(-2); assertEquals(-2, semaphore.availablePermits()); semaphore.release(); assertEquals(-1, semaphore.availablePermits()); semaphore.release(); assertEquals(0, semaphore.availablePermits()); semaphore.release(); assertEquals(1, semaphore.availablePermits()); } As the code shows, the available permits increase upon each release, only to allow other threads to acquire a permit once the value reaches 1 or above. NOTE that from there on the availablePermits cannot become negative by using the aqcuire because if there are 0 permits the whole point of the semaphore is to wait for a permit to become available again!
type: Answer
downvote count: 0
score: 7
upvote count: 7

http://stackoverflow.com/comment/39993603
type: Comment
type: QuestionComment
score: 0
has text: Because then I would have x LOAD-statements that each load one train file, while I need 1 LOAD-statement that loads x train files at once
comment on: http://stackoverflow.com/q/25601779

http://stackoverflow.com/q/25666420
downvote count: 1
has title: hangman input won't be read
has comment: http://stackoverflow.com/comment/40109016
favorite count: 0
has answer: http://stackoverflow.com/a/25666522
type: Question
has body: I've got a hangman assignment in java and most of my program works except when it tries to read the input and save it. i only use string because i don't want to mess with converting char to string my main: public static void main(String[] args) { Scanner input = new Scanner(System.in); boolean active = true; do { startGame(); do { System.out.println("You have "+(numGuesses)+" guesses left"); drawBoard(); System.out.println(); System.out.println("Please enter your next guess: "); String mainGuess = input.nextLine(); if ("stop".equals(mainGuess)) currentState = End;//stops game if player chooses else { wordCondition(mainGuess); winLose(); } } while (currentState == Play); if (currentState == Win) System.out.println("Coongradulations you won!"); else if (currentState == Lose) System.out.println("Sorry, You lost"); System.out.println("Would you like to play again? 1)yes 2)no"); int answer=input.nextInt(); active = (answer==1); } while (active);//creates a new game as much as user wants } and my problem block public static void wordCondition(String guess) { if (guess.contains(word))//check if letter is in word and substitutes the letter { board[guess.indexOf(word)]=guess; total++; } and my drawing block public static void drawBoard() { System.out.println("Current word:"); for(int i=0;i&lt;word.length();i++) System.out.print(board[i]); } for example the word is "name" what i want You have 7 guesses left Current word: _ _ _ _ Please enter your next guess: a You have 7 guesses left Current word: _ a _ _ Please enter your next guess: what i get You have 7 guesses left Current word:_ _ _ _ Please enter your next guess: a You have 6 guesses left Current word:_ _ _ _ Please enter your next guess: or something like that, formatting is a little off please help :)
has comment: http://stackoverflow.com/comment/40109172
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40109149
has comment: http://stackoverflow.com/comment/40109148
has comment: http://stackoverflow.com/comment/40109207
tagged with: netbeans
score: 0
has comment: http://stackoverflow.com/comment/40108981
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40109164
answer count: 1

http://stackoverflow.com/a/25676197
has body: You can split your text using a regex like this: (?=[\s\W])|(?&lt;=[\s\W]) Working demo You will have your text splitted as below: Your code would be: public void testSplit() { String str = "public static void main(String[] args){"; String[] arr = str.split("(?=[\\s\\W])|(?&lt;=[\\s\\W])"); System.out.println(Arrays.asList(arr)); } // Print: // [public, , static, , void, , main, (, String, [, ], , args, ), {, ] Then you can clean the empty string from your array.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25675868
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/39910606
comment on: http://stackoverflow.com/q/25557499
type: Comment
type: QuestionComment
has text: How does the edittext appear, when a user touches the textview? Is it possible that the edittext appears in the same area where the textview once was?
score: 0

ms-word
tag name: ms-word
type: Tag
tags question: http://stackoverflow.com/q/25710251
tags question: http://stackoverflow.com/q/25709775
tags question: http://stackoverflow.com/q/25695480

http://stackoverflow.com/q/25675968
has comment: http://stackoverflow.com/comment/40126932
favorite count: 0
has answer: http://stackoverflow.com/a/25676169
possible better answer: http://stackoverflow.com/a/25676177
type: Question
has answer: http://stackoverflow.com/a/25676177
has comment: http://stackoverflow.com/comment/40126838
has comment: http://stackoverflow.com/comment/40126905
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40127004
answer count: 3
has body: I could only find a c# link for this and couldn't understand it so here goes.. I have a Player and a Target class in my program, and I want to be able to make like this: public Player(int difficulty) { if(difficulty == 1) health = hArray[0]; else health = hArray[1]; } where hArray is my array of possible health values. This works, but I also deal with playerHealth inside of my Target class just for ease of use because I'm new to java sort of and didn't know how else to do it, so that has something like this: private int playerHealth; public int getPlayerHealth() { return playerHealth; } public void setPlayerHealth(int playerHealth){ this.playerHealth = playerHealth; } But I don't know how to call this anymore because originally I had it set for Player to always start with 100 health. I changed it because I need to set the option of health value in Player as a requirement and now when I call this in main (psuedo-ish): Your starting health: " + tgt.getPlayerHealth() It just says 0 because the health was defined in Player. So I know why it isn't working but I'm not sure how to fix it, or if I can fix it with my current layout. Here are my declarations/instanstiations (is this a word?): Target tgt = new Target(dif); Player p1 = new Player(dif); Based off of: System.out.println("\nEnter a difficulty 1-2 (entering an integer " + "other than 1 or 2 will default to 2):"); dif = scn.nextInt(); any help is appreciated
has title: Two of the same variables in different classes
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25676072
downvote count: 0
has comment: http://stackoverflow.com/comment/40126877
has comment: http://stackoverflow.com/comment/40126965
upvote count: 1
accepted answer: http://stackoverflow.com/a/25676169

http://stackoverflow.com/q/25652009
has title: Proguard causing SherlockMapActivity to lose access to MapActivity
favorite count: 0
tagged with: proguard
type: Question
tagged with: google-maps-android-api-2
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has body: I'm getting the following console warnings from Proguard during package export: Warning: com.actionbarsherlock.app.SherlockMapActivity: can't find superclass or interface com.google.android.maps.MapActivity Warning: com.actionbarsherlock.app.SherlockMapActivity: can't find referenced class com.google.android.maps.MapActivity Using -dontwarn com.google.android.maps.MapActivity results in app crash (retraced stack trace) I'm using a standard up-to-date proguard-android.txt and I've added the following to my proguard-project.txt (in addition to the rules specified by Google Play )to try and resolve (a bit redundant perhaps but I'm trying not to miss anything): -keep class * extends com.google.android.maps.MapActivity -keep class com.google.android.maps** -keep class com.google.android.maps.* -keep class com.google.android.maps.MapActivity Still new to Proguard, am I missing something obvious here?
tagged with: actionbarsherlock
score: 1
tagged with: android
tagged with: java

http://stackoverflow.com/a/25647642
type: Answer
has comment: http://stackoverflow.com/comment/40075137
answers question: http://stackoverflow.com/q/25646346
has comment: http://stackoverflow.com/comment/40075242
has body: It’s not clear what you are trying to achieve. If you are confident that the class you loaded dynamically is Emp (or a subclass of it) it is sufficient to do the type cast like you did in your question. If you have doubts about the dynamically loaded type being compatible with Emp, because of the one hundred other classes you have, then it’s not clear what you expect from us. What you can do is to separate the type checking from the instantiation, e.g. Class&lt;? extends Emp&gt; type = Class.forName(className).asSubclass(Emp.class); Emp instance = type.newInstance(); This checks whether the type is compatible with Emp in the first line, thus the second line is guaranteed to return an instance of Emp. However, the way, an incompatible type is reported does not change. It will be done by throwing a ClassCastException. If that’s not what you were asking for, you should reword your question.
score: 0
has comment: http://stackoverflow.com/comment/40075417
has comment: http://stackoverflow.com/comment/40075201

http://stackoverflow.com/comment/39924506
type: QuestionComment
comment on: http://stackoverflow.com/q/25565095
has text: I removed both the BufferedInputStream and BufferedOutputStream but it has no effect on the outcome.
score: 0
type: Comment

http://stackoverflow.com/comment/39956491
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25580887
type: Comment
has text: Are you saying you're calling oncreateview manually?

http://stackoverflow.com/q/25665353
tagged with: swing
has comment: http://stackoverflow.com/comment/40107154
has comment: http://stackoverflow.com/comment/40108497
answer count: 0
has comment: http://stackoverflow.com/comment/40107222
has title: Graphical glitches in swing
score: 2
has comment: http://stackoverflow.com/comment/40107292
tagged with: java
has comment: http://stackoverflow.com/comment/40107041
linked to: http://stackoverflow.com/q/22737535
has comment: http://stackoverflow.com/comment/40108659
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40107022
has comment: http://stackoverflow.com/comment/40107061
upvote count: 2
has comment: http://stackoverflow.com/comment/40107999
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/22737535
has body: I am working on a simple mailing list program and I have been using Netbeans WYSIWYG GUI designer. My GUI runs and works fine, and when I run it from the IDE it looks as it should do. However I have made a batch file to the jar from the command line and now I get this odd graphical glitch: When it initially loads, the boxes are fine, but as soon as you type stuff in , they glitch out. Additionally, before anything is typed in the Surname jLable has the small glitch on the letter 'n', whereas the other two labels are completely fine. I asked a friend to run it on his Linux machine and there were no problems there, so it has to be something to do with my PC. I've attempted to reinstall my GPU drivers but that hasn't changed anything.
downvote count: 0

http://stackoverflow.com/q/25676995
has body: I am using hazelcast (hazelcast client and server jars on the client side and server jar on the server - both versions are the same i.e. 3.2.4). The server is running on a different box - I specified that IP address in my client. It appears that the server is running (I can see that the process is up and binding on the 5701 port). My client tries to connect to the remote IP address and port but is unable to do so and the hazlecast messages do not help much (unless I misconfigured logging). Output below: Sep 04, 2014 8:30:45 PM com.hazelcast.core.LifecycleService INFO: HazelcastClient[hz.client_0_dev][3.2.4] is STARTING Sep 04, 2014 8:30:46 PM com.hazelcast.core.LifecycleService INFO: HazelcastClient[hz.client_0_dev][3.2.4] is STARTED Sep 04, 2014 8:30:49 PM com.hazelcast.client.spi.ClientClusterService WARNING: Unable to get alive cluster connection, try in 0 ms later, attempt 1 of 2. Sep 04, 2014 8:30:52 PM com.hazelcast.client.spi.ClientClusterService WARNING: Unable to get alive cluster connection, try in 0 ms later, attempt 2 of 2. Sep 04, 2014 8:30:55 PM com.hazelcast.client.spi.ClientClusterService Config file section: 5701 0 224.2.2.3 54327 127.0.0.1 10.10.1.* <ssl enabled="false" /> <socket-interceptor enabled="false" /> PBEWithMD5AndDES fakesalt fakepwd 19 any help in troubleshooting would be great Edit I was able to vlaidate network traffic between the two servers (hosting the client and server via port 5701) using iperf. ------------------------------------------------------------ Server listening on TCP port 5701 TCP window size: 85.3 KByte (default) ------------------------------------------------------------ ------------------------------------------------------------ Client connecting to xxx.xxx.xxx.xxx, TCP port 5701 TCP window size: 101 KByte (default) ------------------------------------------------------------ [ 3] local xxx.xxx.xxx.xxx port 40937 connected with xxx.xxx.xxx.xxx port 5701 [ 5] local xxx.xxx.xxx.xxx port 5701 connected with xxx.xxx.…
has comment: http://stackoverflow.com/comment/40129224
downvote count: 0
answer count: 1
tagged with: hazelcast
has comment: http://stackoverflow.com/comment/40129868
has answer: http://stackoverflow.com/a/25693976
accepted answer: http://stackoverflow.com/a/25693976
has comment: http://stackoverflow.com/comment/40128835
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40129544
score: 3
has comment: http://stackoverflow.com/comment/40129785
has title: hazelcast client unable to connect to server
tagged with: java
has comment: http://stackoverflow.com/comment/40129437
has comment: http://stackoverflow.com/comment/40129484
type: AnsweredQuestion
upvote count: 3

http://stackoverflow.com/comment/40164663
has text: ummmm what i really mean is: is there any way to get average without divide by 2?
type: Comment
comment on: http://stackoverflow.com/a/25696262
type: AnswerComment
score: 0

http://stackoverflow.com/a/31527444
score: 0
answers question: http://stackoverflow.com/q/25661215
type: Answer
has body: Looks like "1" is the option you want, but you've got an off-by-one error. 0,0 to 15,15 is actually supposed to be 16 pixels. If you want 15 pixels, you'll need 0,0 to 14,14. If it is specifically 15x15 with a predefined color, you can pre-render in a some image editing program and just use drawImage. You can also consider translating by .5,.5. See what #2 looks like when you do Ellipse.Double(.5,.5,15.5,15.5) You may be happier with that result.

http://stackoverflow.com/comment/40112162
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25667842
has text: Should it not be requestHeaders.get("Authentication").get(0)?
score: 0

http://stackoverflow.com/comment/39972802
type: Comment
has text: whats `(LoginActivity.java:118)` ?
type: QuestionComment
comment on: http://stackoverflow.com/q/25591205
score: 0

http://stackoverflow.com/comment/40060728
comment on: http://stackoverflow.com/a/25639491
type: Comment
has text: Great explanation, but why doesn't Java close and and start a new buffer for every input?? it might make things more practical.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40135681
type: Comment
comment on: http://stackoverflow.com/a/25675344
type: AnswerComment
has text: Thanks! ROUTE_CONTROLLER and ROUTE_ACTION_METHOD gave the desired result.
score: 0

http://stackoverflow.com/a/25681304
answers question: http://stackoverflow.com/q/25680929
has body: Possible solution: private HashMap&lt;String, Object&gt; getHashMapFromJson(String json) throws JSONException { HashMap&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); JSONObject jsonObject = new JSONObject(json); for (Iterator&lt;String&gt; it = jsonObject.keys(); it.hasNext();) { String key = it.next(); map.put(key, jsonObject.get(key)); } return map; } Testing with your example JSON string: private void test() { String json = " {\"id\" : 12345, \"value\" : \"123\", \"person\" : \"1\"}"; try { HashMap&lt;String, Object&gt; map = getHashMapFromJson(json); for (String key : map.keySet()) { Log.i("JsonTest", key + ": " + map.get(key)); } } catch (JSONException e) { Log.e("JsonTest", "Failed parsing " + json, e); } } Output: I/JsonTest(24833): id: 12345 I/JsonTest(24833): value: 123 I/JsonTest(24833): person: 1 Note: This is not ideal and I just wrote it real quick.
score: 3
has comment: http://stackoverflow.com/comment/107125824
upvote count: 3
downvote count: 0
type: Answer

http://stackoverflow.com/comment/116583481
type: AnswerComment
comment on: http://stackoverflow.com/a/58567307
score: 0
type: Comment
has text: I wonder if we can hit an issue with duplicated counting, let's say some inner implementation would call write like that: write(byte[] b, int off, int len) followed by write(int b) for every byte in the array. We run into the issue with those bytes counted twice.

http://stackoverflow.com/comment/40187301
type: AnswerComment
comment on: http://stackoverflow.com/a/25700305
score: 0
has text: I have a couple of questions @Pieter. In my example above I have a class that establishes a connection to the database. I then create an instance of this class in the checkUser method and in several other methods. At the end of these methods I close the connection by calling the disconnect method of each instance of the connection class. If this not actually what is happening? Also in your example above. I think I understand the datasource now, but where would I establish the database connection details, like in my top example I establish the driver, hostname etc?
type: Comment

http://stackoverflow.com/comment/40124561
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25674642
has text: make sure context-fragment.xml is loaded correctly

http://stackoverflow.com/a/25663975
type: AcceptedAnswer
downvote count: 0
has body: You need to read the data outputted by the process. A process has 2 output streams: standard output and error output. You have to read both because the process might write to both of those outputs. The output streams of the process have buffers. If the buffer of an output stream is filled, attempt to write further data to that by the process is blocked. Do something like this: InputStream in = proc.getInputStream(); // To read process standard output InputStream err = proc.getErrorStream(); // To read process error output while (proc.isAlive()) { while (in.available() &gt; 0) in.read(); // You might wanna echo it to your console to see progress while (err.available() &gt; 0) err.read(); // You might wanna echo it to your console to see progress Thread.sleep(1); }
answers question: http://stackoverflow.com/q/25663450
type: Answer
accepted answer of: http://stackoverflow.com/q/25663450
score: 3
upvote count: 3

http://stackoverflow.com/q/25577880
has body: I have an interesting problem. I need to be able to have a window that allows users input commands as if they were in a terminal and using python. When you type in 'python' on a mac it allows you to run a python commands. I can access the 'python' function, but it will not let me write python commands to the terminal through my custom command line interface. Does button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String text = textField.getText(); try { Process p = Runtime.getRuntime().exec(text); //Nothing after this line } catch (IOException i) { // TODO Auto-generated catch block i.printStackTrace(); } } }); As you can see I have an event listener that runs every time a button is clicked. When I type 'python' in my command line it will not allow me to type in the sub command line, for python commands. I have a feeling it is because of this line: Process p = Runtime.getRuntime().exec(text); Any suggestions to allow me to use my python commands? Thank you for reading
type: UnansweredQuestion
tagged with: python
has answer: http://stackoverflow.com/a/25577891
tagged with: terminal
has title: How to use the Python terminal function in Java
score: 0
tagged with: java
answer count: 1
tagged with: macos
type: Question

http://stackoverflow.com/comment/40064897
has text: @bigdestroyer what if the key or value contains "\" ?
comment on: http://stackoverflow.com/q/25641985
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/25598525
downvote count: 1
has answer: http://stackoverflow.com/a/25598718
has comment: http://stackoverflow.com/comment/40164049
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25598944
answer count: 3
has comment: http://stackoverflow.com/comment/39986328
favorite count: 0
score: -1
tagged with: java.util.scanner
has body: Okay so the problem is to write a program that will identify vowels from consonant. I need to use Scanner and hasNext() the output should look like this Enter a letter: a a is vowel Enter a letter: b b is consonant Enter a letter: 1 1 is invalid input It will keep reading until it reaches the end of file professor hinted to use hasNext because it will return false when there is no input So here is what i have so far Scanner input = new Scanner(System.in); System.out.print("Enter a letter: "); char letter = input.next().charAt(0); if (letter=='a'||letter=='A'||letter=='e'||letter=='E'||letter=='i'||letter=='I'||letter=='o'||letter=='O'||letter=='u'||letter=='U'){ System.out.println(letter + " is a vowel"); } else if(Character.isLetter(letter)){ System.out.println(letter + " is a consonant"); } else { System.out.println(letter + " is an invalid input"); } What i need is to loop it to after entering any input it would ask it again to enter a letter. And continue looping it until it reaches the end of file with the use of has Next
type: Question
possible better answer: http://stackoverflow.com/a/25598806
upvote count: 0
has title: How to use hasNext for this code?
has answer: http://stackoverflow.com/a/25598806
accepted answer: http://stackoverflow.com/a/25598718

http://stackoverflow.com/a/25690007
has comment: http://stackoverflow.com/comment/40152346
downvote count: 1
has comment: http://stackoverflow.com/comment/40152054
answers question: http://stackoverflow.com/q/25689871
has comment: http://stackoverflow.com/comment/40152444
score: 3
has body: As David said, flushing forces the download to go through, instead of holding all the unwritten data in memory. Flushing in a loop is not a problem per se, but you probably don't want to flush every single time the loop runs. Just make sure you're not writing too much (like 200MB) of data before flushing. Edit: jtahlborn made a good point. BufferedWriter automatically flushes. The other answer on here is better but for those curious, this is what goes on when you write! That's the source of the public void write(char, int, int) of BufferedWriter. You can see on line 182, it will automatically flush after the buffer size has been reached (default 8,192)
has comment: http://stackoverflow.com/comment/40160458
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/40162466

http://stackoverflow.com/a/25645573
has comment: http://stackoverflow.com/comment/40071978
score: 0
has comment: http://stackoverflow.com/comment/40072106
answers question: http://stackoverflow.com/q/25645392
has body: The answer (per the release notes) is 2.19 - The May 29 2012 release notes for 2.22 read (in part) - Selenium 2.22 is the first version that requires Java 6 it also notes that Since Java 5 was "end of lifed" in 2009, we don’t expect this to impact many users. and if scroll down one entry we see the previous release was on Wednesday the 8th of February 2012 and the previous release was version 2.19
type: Answer
has comment: http://stackoverflow.com/comment/40071864

http://stackoverflow.com/comment/39992860
comment on: http://stackoverflow.com/q/25602206
has text: Why don't you use a HTTP-session?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25647121
has body: //Hide the Keyboard InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(serverURL.getWindowToken(), 0); //Show the Keyboard imm.showSoftInputFromInputMethod(serverURL.getWindowToken(), 0); but under post runnable over the view.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25646882

http://stackoverflow.com/q/25679284
tagged with: netbeans
score: 0
type: UnansweredQuestion
answer count: 1
has title: Getting null pointer exception while compiling via netbeans but same source code works in another class
has answer: http://stackoverflow.com/a/25679380
has body: under generated code am getting an additional line of generated code like query1 = java.beans.Beans.isDesignTime() ? null : ((javax.persistence.EntityManager)null).createQuery(""); Am not able to delete this. how to get rid of this problem.
tagged with: java
has comment: http://stackoverflow.com/comment/40132637
has comment: http://stackoverflow.com/comment/40132525
has comment: http://stackoverflow.com/comment/40132609
type: Question

http://stackoverflow.com/a/25689761
has comment: http://stackoverflow.com/comment/40151657
downvote count: 0
answers question: http://stackoverflow.com/q/25689509
has comment: http://stackoverflow.com/comment/40152110
type: AcceptedAnswer
has body: Try placing the package.properties file at path src/main/resources of your maven project, Maven picks the files in resources directory. Refer to this link to understand where to place the properties file: Struts 2 – Resource bundle example Alternatively if you don't want to place the files in resources directory then you can refer to this below link to understand how to pick properties file from src/main/java : In maven how can I include non-java src files in the same place in the output jar?
has comment: http://stackoverflow.com/comment/40151705
score: 3
has comment: http://stackoverflow.com/comment/40151996
type: Answer
has comment: http://stackoverflow.com/comment/40153835
accepted answer of: http://stackoverflow.com/q/25689509
upvote count: 3

http://stackoverflow.com/a/25560731
downvote count: 0
score: 28
answers question: http://stackoverflow.com/q/25560601
has comment: http://stackoverflow.com/comment/39950274
type: Answer
has comment: http://stackoverflow.com/comment/39926495
has comment: http://stackoverflow.com/comment/96141991
upvote count: 28
has body: I found the solution: The following line is the culprit: RequestBody body = RequestBody.create(mediaType, media); create has 3 signatures for media: String byte[] File When I pass a String, it disregards the supplied mediaType and adds the charset to it. Even for image/jpeg it would send image/jpeg; charset=utf-8 to the server. Using byte[] or File suppresses that behavior. I hope this helps you! [Stupid me - for simplicity I gave it a String during testing, as I didn't care about the body ;-( ]

http://stackoverflow.com/a/25598075
type: Answer
has comment: http://stackoverflow.com/comment/39985403
has comment: http://stackoverflow.com/comment/40054198
has comment: http://stackoverflow.com/comment/39985566
has comment: http://stackoverflow.com/comment/39985339
has comment: http://stackoverflow.com/comment/39985488
answers question: http://stackoverflow.com/q/25598023
has comment: http://stackoverflow.com/comment/39985512
score: 0
has comment: http://stackoverflow.com/comment/39985322
has body: Let's start by creating a proper test framework (at least a toy testing framework) - public static void main(String[] args) { String input = "1234567890987654"; String expected = "1234" + "8765" + "9098" + "4567"; String result = reverse(input); if (result.equals(expected)) { System.out.println("result matches expected result"); } else { System.out.println("result does not match expected result"); } System.out.printf("input='%s', result = '%s'%n", input, result); } Now we can tell when the result we receive matches our expected result, and what the input and output String(s) are. Next, we need to fix your reversing algorithm. You want to get 4 character then reverse 4 characters, so each iteration is 8 characters. Something like, public static String reverse(String a) { StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; a.length(); i += 8) { // &lt;-- increment by 8. sb.append(a.substring(i, i + 4)); // &lt;-- pass 1,4 // get characters 4 to 8 StringBuilder sb2 = new StringBuilder(a.substring(i + 4, i + 8)); // reverse and append sb.append(sb2.reverse().toString()); } return sb.toString(); } Output is result matches expected result input='1234567890987654', result = '1234876590984567' Edit Based on your comments below (and edited question), add something like this to main String[] arr = new String[4]; long calc = 1; // &lt;-- int would overflow for (int count = 0, i = 0; i &lt; result.length(); count++, i += 4) { arr[count] = result.substring(i, i + 4); calc *= Integer.parseInt(arr[count]); } System.out.printf("Array = %s, multiplication = %d%n", Arrays.toString(arr), calc); And now the output is result matches expected result input='1234567890987654', result = '1234876590984567' Array = [1234, 8765, 9098, 4567], multiplication = 449411337361660

http://stackoverflow.com/comment/108192048
type: AnswerComment
score: 0
has text: For solution please see the answer here: https://stackoverflow.com/a/61157228/1785788
comment on: http://stackoverflow.com/a/26240165
type: Comment

http://stackoverflow.com/a/25652523
has comment: http://stackoverflow.com/comment/40084244
answers question: http://stackoverflow.com/q/25652483
has comment: http://stackoverflow.com/comment/40084370
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/40084403
has comment: http://stackoverflow.com/comment/40147088
has body: Try this: byte[][] arrays = new byte[5][10];
has comment: http://stackoverflow.com/comment/40084342
score: 2
has comment: http://stackoverflow.com/comment/40084444
has comment: http://stackoverflow.com/comment/40084431
has comment: http://stackoverflow.com/comment/40084276
has comment: http://stackoverflow.com/comment/40084594
downvote count: 1

http://stackoverflow.com/a/26190692
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: you will need to copy ffmpeg binaries to res/raw folder as discussed here. you may also need to build them first (dont just copy from above project), and make sure they can run on the device you are planning to test.
accepted answer of: http://stackoverflow.com/q/25598382
score: 2
type: Answer
answers question: http://stackoverflow.com/q/25598382

http://stackoverflow.com/a/25707814
has body: Q: My libJNI Library Should Contain Both my own libmymath.so and JNI.o. Am i Right? It sounds like your JNI.o calls code in libmymath.so. So yes, you need to specify libmylibmath.so in your link command, and you also need to make sure it's available at runtime. Q: When I am Trying to Generate the .so which is Combination of libmymath.so and JNI.o. It is giving error undefined symbol 'add' can not be used when making a shared object; recompile with -fPIC I would run "nm" against libmymath.so and make sure you actually have an "add". Perhaps you inadvertantly compiled one or more functions with C++, and the name is mangled? It wouldn't hurt to do what the error says, and make sure everything is consistently built with "-fPIC".
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25707780
answers question: http://stackoverflow.com/q/25707780
score: 1
type: Answer

http://stackoverflow.com/comment/39966439
has text: also what is your expected outcome?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25586673
type: QuestionComment

http://stackoverflow.com/q/25556339
tagged with: swing
has answer: http://stackoverflow.com/a/25984561
downvote count: 1
type: Question
score: 0
tagged with: dialog
tagged with: java
has title: How to find the java window dialog that is dependent on its parent for closing
has comment: http://stackoverflow.com/comment/39907657
has body: public class Settings extends JDialog { public Settings() { setSize(200,200); } } I've been trying to find the java window dialog that is dependent on its parent for closing. A typical window that goes "bang" when you try to access its parent window without first satisfied it. I'll appreciate your input.
favorite count: 0
has comment: http://stackoverflow.com/comment/39910695
answer count: 2
has answer: http://stackoverflow.com/a/25556609
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/25581377
has body: Not a mysql wizard but can't you do it like this? select MAX(b.authors.size) from BookImpl b
answers question: http://stackoverflow.com/q/25581219
has comment: http://stackoverflow.com/comment/39954883
upvote count: 3
type: AcceptedAnswer
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/25581219
type: Answer

http://stackoverflow.com/comment/40069555
type: Comment
has text: So, although this method works, MaskFormatter still requires the input to be all 5 (or what ever number you choose) characters. If it isn't, it just doesn't take the input. My thing is that it should take the input regardless of it is the maximum amount of characters or not. I will also be looking at the links you provided. Thanks for the response!
type: AnswerComment
comment on: http://stackoverflow.com/a/25634926
score: 0

http://stackoverflow.com/comment/40084509
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25652091
has text: You can declare getInterest() in SavingsAccount class, and then override it in the other classes
score: 0

http://stackoverflow.com/q/25587338
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/25587598
has answer: http://stackoverflow.com/a/25587598
has answer: http://stackoverflow.com/a/25587387
answer count: 2
tagged with: jersey
has title: Get jersey to deserialize into subclass
possible better answer: http://stackoverflow.com/a/25587387
type: Question
tagged with: serialization
has body: I'm trying to get Jersey to automatically deserialize into a subclass instance of the declared class for me. Say A has one string field named "a". B extends A has one string field named "b". Similarly, C extends A has one string field named "c". I'd like for an input which has fields "a" and "b" to be deserialized into an instance of B, and an input which has fields "a" and "c" to be deserialized into an instance of C with one endpoint definition, specifying the post body parameter type as A, as follow. @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public ServerResponse translateClientRequest(final A postBody) throws ProxyException { .. } This example doesn't work. Is what I'm asking for possible? If so, how?
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/40193615
type: QuestionComment
score: 0
has text: I'd import the files into the database and compare them using SQL.
type: Comment
comment on: http://stackoverflow.com/q/25712132

http://stackoverflow.com/comment/40108338
score: 0
type: Comment
has text: @Duncan Thanks, will look into it. Other solutions are welcome in meantime.
type: QuestionComment
comment on: http://stackoverflow.com/q/25665899

http://stackoverflow.com/comment/39966199
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25587720
score: 0
has text: I understand what you are wanting here.

http://stackoverflow.com/q/25636517
has comment: http://stackoverflow.com/comment/40068021
has body: Evening everyone. I REALLY need some help. I've had some issues in the past getting apps to compile but this current situation is nearly enough to make me want to NOT quit my day job. I have an Android application that was running perfectly fine in eclipse. However, ever since the upgrade last week i have not been able to get it back running. Its been so bad that I decided to import the application to the Android Studio. Now I have imported the application to Android studio,which i do like btw, and I have an error that I just can't seem to figure out. If I compile the application w/o "android-async-http-1.4.5.jar" I get errors stating: Error:(29, 30) error: package com.loopj.android.http does not exist for each area in the app where there is an Async function is called. However, once I add "android-sync-http-1.4.5.jar" I get the following error throughout the app each time the function is called: Error:(74, 104) error: &lt;anonymous com.peekatucorp.peekatu.ChatActivity$1&gt; is not abstract and does not override abstract method onFailure(int,Header[],byte[],Throwable) in AsyncHttpResponseHandler Error:(75, 13) error: method does not override or implement a method from a supertype Please help. I dont know what Im missing. ChatActivity.java package com.peekatucorp.peekatu; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.View.OnKeyListener; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ListView; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.AsyncHttpResponseHandler; import com.loopj.…
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/56689902
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40079636
type: Question
has answer: http://stackoverflow.com/a/34863672
upvote count: 2
has title: <anonymous> is not abstract and does not override abstract method onFailure(int,Header[],byte[],Throwable) in AsyncHttpResponseHandler
type: UnansweredQuestion
tagged with: android
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40078747
tagged with: android-studio
score: 2
has comment: http://stackoverflow.com/comment/40078926
tagged with: abstract-class

http://stackoverflow.com/a/36058278
type: Answer
has body: In October 2015, Gson version 2.4 (changelog) added the ability to use alternate/multiple names for @SerializedName when deserializing. No more custom TypeAdapter needed! Usage: java @SerializedName(value="name", alternate={"person", "user"}) kotlin @SerializedName(value="name", alternate= ["person", "user"]) https://www.javadoc.io/doc/com.google.code.gson/gson/2.6.2/com/google/gson/annotations/SerializedName.html
answers question: http://stackoverflow.com/q/25707728
score: 310
downvote count: 0
has comment: http://stackoverflow.com/comment/78228130
has comment: http://stackoverflow.com/comment/130128480
has comment: http://stackoverflow.com/comment/119580140
has comment: http://stackoverflow.com/comment/139958444
upvote count: 310

http://stackoverflow.com/comment/42499547
comment on: http://stackoverflow.com/a/26000741
score: 2
has text: Actually, as you start using the more exotic features of Java 8 more often, this workaround seems to stop working, unfortunately. :(
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25564651
tagged with: multithreading
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39925392
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/39925945
has comment: http://stackoverflow.com/comment/39929241
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25569034
has title: JUnique locked application doesn't run if the application crashes
score: 1
tagged with: java
has body: I'm developing a Java application. And I wanted to prevent a user to run simultaneously more instances of the same Java application. I used JUnique app locking library for Java and it works great. But has a serious issue when it crashes. The application cannot be started if it crashes, it just returns AlreadyLockedException. The code I used to lock my application is below. public static boolean isRunning() { boolean alreadyRunning = false; try { JUnique.acquireLock(appId); alreadyRunning = false; } catch (AlreadyLockedException e) { logger.error("Unable to acquire lock. There is an instance already running"); alreadyRunning = true; } catch (Throwable t) { logger.error("Unable to acquire lock. ", t); } return alreadyRunning; } And code to release my lock is: public static void release() { try { JUnique.releaseLock(appId); } catch (Throwable t) { logger.error("Error releasing the lock", t); } } I can use release() method for dealing with expected crashes. But the real problem occurs when application crashes unexpectedly during runtime. The application is terminated without releasing the acquired lock for application. How can we release JUnique lock if the application unexpectedly crashes?
tagged with: uncaughtexceptionhandler
accepted answer: http://stackoverflow.com/a/25569034
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39923122
has comment: http://stackoverflow.com/comment/39923428
has comment: http://stackoverflow.com/comment/39925454

http://stackoverflow.com/comment/39899823
type: AnswerComment
score: 0
has text: When I do that, I can not longer pass in a function as an argument though. http://stackoverflow.com/questions/9410/how-do-you-pass-a-function-as-a-parameter-in-c
type: Comment
comment on: http://stackoverflow.com/a/25551826

http://stackoverflow.com/comment/39994081
has text: Glad to help you can you please upvote if it is useful to you ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25602855
type: Comment

http://stackoverflow.com/a/25615009
score: 3
type: Answer
upvote count: 3
has body: In this line double totalPrice = Double.parseDouble(totalPriceTV.toString()); Change totalPriceTV.toString() to totalPriceTV.getText().toString() and try again.
answers question: http://stackoverflow.com/q/25614983
downvote count: 0

http://stackoverflow.com/comment/81391514
score: 0
comment on: http://stackoverflow.com/q/25574776
type: Comment
type: QuestionComment
has text: any solutions ?

http://stackoverflow.com/q/25646191
score: 4
type: UnansweredQuestion
answer count: 1
downvote count: 0
has title: Google Guava RangeMap Iteration Order
favorite count: 0
has answer: http://stackoverflow.com/a/25646849
tagged with: guava
has body: We have been using the com.google.common.collect.RangeMap class in Google's guava library and have found it very useful. In particular, I would like to use the asMapOfRanges() method and depend on the iteration order of the returned Map to be in the order of the Ranges in each entry. The implementation of com.google.common.collect.ImmutableRangeMap seems to explicitly adhere to this implementation, but it doesn't seem to be mentioned in the JavaDoc anywhere. I'm wondering if I can depend on this behavior on any RangeMap, and it was just missed in the JavaDoc, or if iteration order is intended to be unspecified, in which case I should order the results before I iterate. Thanks for your help.
tagged with: java
type: Question
upvote count: 4

http://stackoverflow.com/a/25640242
has body: public boolean hasNext() Returns true if this scanner has another token in its input. This method may block while waiting for input to scan. The scanner does not advance past any input. The problem is that you never receive any input because your loop condition never gets resolved. Your program is stuck in while(in.hasNext()) You could, for example, pick a word that will end your program, like the string "end" and stop the loop that way. (Another example would be to use a negative value for age to stop the loop) public static void main(String[] args) { Hashtable&lt;String, Integer&gt; names = new Hashtable&lt;String, Integer&gt;(); String name = ""; int age = 0; Scanner in = new Scanner(System.in); while (true) { System.out.println("Enter name:"); name = in.next(); if (name.equals("end")) { break; } System.out.println("Enter age:"); age = Integer.valueOf(in.next()); names.put(name, age); } // print the hashtable data System.out.println("\nHashtable:\n"); for(String n : names.keySet()) { System.out.println("Name:\t" + n + "\nAge:\t" + names.get(n) + "\n"); } }
type: Answer
answers question: http://stackoverflow.com/q/25640126
score: 1
downvote count: 0
upvote count: 1

routes
type: Tag
tags question: http://stackoverflow.com/q/25659613
tag name: routes

http://stackoverflow.com/comment/39928338
comment on: http://stackoverflow.com/a/25567439
score: 0
type: Comment
type: AnswerComment
has text: It still blinks, its not because they are constantly being rerendered?

http://stackoverflow.com/a/25637157
answers question: http://stackoverflow.com/q/25636822
score: 0
has body: Reflection is one way to do it but it is not good enough. One possible way is to make the activity in library project abstract: Activity in Project B (Library proejct) public abstract class LibraryActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set up activity // Suppose you want to start the activity when a button is clicked Button btn = (Button)findViewById(R.id.btn); btn.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { startOtherActivity(); } }); } public abstract void startOtherActivity(); } Implement the abstract function in your main project: public class LibraryActivityImpl extends LibraryActivity { @Override public void startOtherActivity() { startActivity(new Intent(this, MainProjectActivity.class)); } } Now in your main project, start LibraryActivityImpl instead of LibraryActivity. This way, you do not need to worry about weird access to classes that are unknown to your library project.
type: Answer

http://stackoverflow.com/q/25664234
downvote count: 1
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25664941
has comment: http://stackoverflow.com/comment/40106050
has comment: http://stackoverflow.com/comment/40105366
has body: 9/4/2014 3:55:10 AM here is my current date and time i want to add +10 hour so that i cam match with Current time of device please tell me how we can implement public static void main(String[] args) { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); String currentDateandTime =" 9/4/2014 3:55:10 AM "; Date date = formatter.parse(currentDateandTime); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.HOUR, 10); System.out.println("Time here "+calendar.getTime()); } This Code am trying but i am not able to Impalement please help me where am doing mistake .
has answer: http://stackoverflow.com/a/25664941
has answer: http://stackoverflow.com/a/25664339
tagged with: android
linked to: http://stackoverflow.com/q/7096366
linked to: http://stackoverflow.com/q/13853910
answer count: 4
has comment: http://stackoverflow.com/comment/40105258
has answer: http://stackoverflow.com/a/25664328
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3581258
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25664458
has comment: http://stackoverflow.com/comment/60593054
has title: how to add 10 hour in current date and time in java
has answer: http://stackoverflow.com/a/25664458

testing
tags question: http://stackoverflow.com/q/25551001
type: Tag
tags question: http://stackoverflow.com/q/25711781
tags question: http://stackoverflow.com/q/25659756
tag name: testing
tags question: http://stackoverflow.com/q/25564154
tags question: http://stackoverflow.com/q/25551108
tags question: http://stackoverflow.com/q/25640768
tags question: http://stackoverflow.com/q/25696739
tags question: http://stackoverflow.com/q/25625401
tags question: http://stackoverflow.com/q/25660909
tags question: http://stackoverflow.com/q/25617942

http://stackoverflow.com/comment/42018290
has text: Using the lint-api.jar from adt-bundle-mac-x86_64-20140702, still getting the same error.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26532351
type: Comment

http://stackoverflow.com/comment/40186369
has text: What have you tried so far? Please read [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask).
comment on: http://stackoverflow.com/q/25708613
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25657330
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25657348
accepted answer: http://stackoverflow.com/a/25657348
tagged with: jframe
has comment: http://stackoverflow.com/comment/40093430
tagged with: jpanel
has title: Issue with JPanel, JFrame, BoxLayout
score: 1
tagged with: java
answer count: 1
downvote count: 0
has body: Hello I am having an issue with this. I am trying to create 2 panels. One with the labels stacked on top of each other in a BoxLayout and the other panel with TextFields also with a BoxLayout stacked up that correspond with the labels. I have tried various setups and keep getting errors. I am setting Layout on JFrame as FlowLayout() and using this to set the panels layoutManager leftPanel = new JPanel(new BoxLayout(this, BoxLayout.Y_AXIS)); This is something I have done before without issue. what is wrong now? ERROR: Exception in thread "main" java.awt.AWTError: BoxLayout can't be shared at javax.swing.BoxLayout.checkContainer(BoxLayout.java:465) at javax.swing.BoxLayout.invalidateLayout(BoxLayout.java:249) at javax.swing.BoxLayout.addLayoutComponent(BoxLayout.java:282) at java.awt.Container.addImpl(Container.java:1125) at java.awt.Container.add(Container.java:415) at DataWriteExample.BuildLeftPanel(DataWriteExample.java:37) at DataWriteExample.&lt;init&gt;(DataWriteExample.java:24) at DataWriteExample.main(DataWriteExample.java:58) Java Result: 1
upvote count: 1
tagged with: swing
tagged with: boxlayout
favorite count: 0
type: Question

http://stackoverflow.com/a/25679833
type: Answer
upvote count: 1
has body: Type issue of id column This is probably due to spacing difference or another subtle difference that gives the impression that they are the same. The strings ' 123 ' or '00123' (for example) are not equivalent to '123' in VARCHAR2 type, while they are equivalent in NUMERIC type, as Oracle converts all those strings to the numeral 123. You are better off using a NUMERIC column as your id to avoid such problems. It also makes sense to limit your valid id values to whole numbers, rather than any arbitrary string. With Oracle you can continue to use setString as it will automatically cast the string to an integer. But I recommend you to use setInt or setLong instead (after the conversion of the id column), as other database solutions like Postgres will not accept a string to match a NUMERIC column. Exception handling issue When you catch a Throwable or an Exception (or their subtypes), be sure to think about whether it can be ignored, or it must be thrown for further handling (for example, to stop the program, alert the user or correct the problem). In your code, the catch block catches the SQLException and prints the stack trace. But it doesn't do anything else. } catch (SQLException e) { e.printStackTrace(); } ... This means that you are ignoring the exception and continuing the program as though nothing happened. The execution will continue on to return result; after completing the finally block. The caller of your method will never know that an SQLException occurred, and it will wrongly assume that there were no errors and the returned data is correct. Unless that is what you really want, what you ought to do is as follows: } catch (SQLException e) { e.printStackTrace(); //it doesn't matter what you do here. the next line is what's important. throw e; //throw the exception after printing stack trace, logging, etc. } ... In this case your method will throw the SQLException to the caller after completing the finally block. The execution will not continue to return res…
accepted answer of: http://stackoverflow.com/q/25679372
score: 1
has comment: http://stackoverflow.com/comment/40134059
has comment: http://stackoverflow.com/comment/40134208
answers question: http://stackoverflow.com/q/25679372
has comment: http://stackoverflow.com/comment/40134154
has comment: http://stackoverflow.com/comment/40133667
has comment: http://stackoverflow.com/comment/40133613
has comment: http://stackoverflow.com/comment/40133751
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25604532
tagged with: maven
has comment: http://stackoverflow.com/comment/40039362
tagged with: eclipse
upvote count: 4
score: 4
type: AnsweredQuestion
tagged with: java
downvote count: 0
answer count: 1
tagged with: classpath
favorite count: 0
has title: NoClassDefFoundError when deploying WebLogic application from Eclipse
accepted answer: http://stackoverflow.com/a/25668414
has body: I'm working with Maven and WebLogic. When building my application with Maven, I can successfully install it manually on my local Weblogic, using the Admin Console. When trying to deploy this same application on the server using Eclipse IDE, I get a NoClassDefFoundError. (I tried both with "Publish as virtual application" and "Publish as an exploded archive" in the Oracle Weblogic Server tools in Eclipse). The structure of my application is the following: MyApp.ear contains: - MyWar1.war - MyWar2.war - MyEjb.jar (ejb module, using maven-ejb-plugin) - MyJar.jar (another project, as dependency) And it's this MyJar.jar that seems to be not found in the classpath. I've checked that in the Eclipse settings, this project is include in the Java Build Path\Project, Java Build Path/Order and Export and in the Deployment Assembly for the MyEjb project. I've also checked the folder build by Eclipse, eclipse-workspace\.metadata\.plugins\org.eclipse.core.resources\.projects\MyApp, where I can see the folder APP-INF\lib\MyJar.jar with the corresponding .class files. And when I try to manually manually install this folder, I got the same error (NoClassDefFoundError). I'm using Weblogic 10.3.3, Maven 3.2.1, Eclipse 4.4.0 (20140612-0600) and Oracle WebLogic Server Tools 7.2.1.201407111426. Any ideas how I can investigate this problem ?
tagged with: weblogic
type: Question
has answer: http://stackoverflow.com/a/25668414

http://stackoverflow.com/comment/40030154
score: 1
comment on: http://stackoverflow.com/a/25622051
type: Comment
type: AnswerComment
has text: Look, I can hardly help more. You should think about what the query should look like. If you need GROUP BY... then you need projections. But subquery also help. You have to create inner query and then filter by it the root query. Root query, can later contain some associations/joins... But I tried to answer your exception: int cannot be treated as ContentEntity.. good luck with Hibernate

http://stackoverflow.com/comment/39909625
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Managing assets between desktop and device version in libgdx](http://stackoverflow.com/questions/9892964/managing-assets-between-desktop-and-device-version-in-libgdx)
comment on: http://stackoverflow.com/q/25553166

http://stackoverflow.com/q/25604202
has comment: http://stackoverflow.com/comment/39996408
type: UnansweredQuestion
has title: DynamicJasper Issue - Cannot run program "javac": java.io.IOException: error=24, Too many open files
tagged with: dynamic-jasper
score: 0
answer count: 0
tagged with: java
has body: When generating the reports using the DynamicJasper API, the below exception is getting thrown. In my logic, around 5000 to 10000 reports will be generating in single execution. Due to this exception, the report generation exception is totally blocked. Please suggest how to fix this solution without increasing the ulimit option as we can not increase depends on the no.of reports. net.sf.jasperreports.engine.JRException: Error compiling report java source files : /home/gscsfo/Report_1409558503418_133890.java com.bnp.scm.services.common.exception.BNPApplicationException: net.sf.jasperreports.engine.JRException: Error compiling report java source files : /home/gscsfo/Report_1409558503418_133890.java at com.bnp.scm.services.scheduler.common.SystemLogger.profile(SystemLogger.java:54) at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621) at com.bnp.scm.services.scheduler.events.EmailAlertAttachment$$EnhancerByCGLIB$$3c6f687d.getPDFAttachment(&lt;generated&gt;) at com.bnp.scm.services.scheduler.events.ScheduleEmailEvent.processEvent(ScheduleEmailEvent.java:1039) at com.bnp.scm.s…
has comment: http://stackoverflow.com/comment/45776572
type: Question
tagged with: jasper-reports

http://stackoverflow.com/comment/40060080
type: QuestionComment
has text: service restarts somehow. Notification bar dissapers and apears back with different data. private static JsonHistoryList activities; <-- this list is beeing cleared after stopping main app by system or user
type: Comment
comment on: http://stackoverflow.com/q/25639075
score: 0

http://stackoverflow.com/a/25656476
downvote count: 0
has comment: http://stackoverflow.com/comment/40094383
has comment: http://stackoverflow.com/comment/40093153
type: Answer
accepted answer of: http://stackoverflow.com/q/25656452
has comment: http://stackoverflow.com/comment/40095335
has body: The means by which content is displayed within a JList is not defined by the JList but is defined by the ListCellRenderer assigned to the JList, so showlist.setFont(new Font("Tahoma", Font.PLAIN, 20)); Will have no effect on the content displayed within the JList Take a look at Writing a Custom Cell Renderer for more details As an example... import java.awt.Component; import java.awt.EventQueue; import java.awt.Font; import javax.swing.DefaultListCellRenderer; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JScrollPane; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class Test1 { public static void main(String[] args) { new Test1(); } public Test1() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JList list = new JList(new String[]{"Happy list", "of happy things", "bunnies", "unicorns", "sharks"}); list.setCellRenderer(new BigFontListCellRenderer()); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(list)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class BigFontListCellRenderer extends DefaultListCellRenderer { @Override public Component getListCellRendererComponent(JList&lt;?&gt; list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); setFont(new Font("Tahoma", Font.PLAIN, 20)); return this; } } }
score: 3
answers question: http://stackoverflow.com/q/25656452
has comment: http://stackoverflow.com/comment/40095423
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/25657524
has body: i have created an string[] array of row values of a csv file and stored it in array list. i need to group it based on arr[0] and delete any duplicate array values in that group. there can be n number columns each time. I have taken 3 columns for example List&lt;String[]&gt; rowList = new ArrayList&lt;String[]&gt;(); BufferedReader reader = null; reader = new BufferedReader(new FileReader("C:\\test.csv")); String[] currLineSplitted; while (reader.ready()) { currLineSplitted = reader.readLine().split(","); rowList.add(currLineSplitted); } Set&lt;String[]&gt; s = new TreeSet&lt;String[]&gt;(new Comparator&lt;String[]&gt;() { @Override public int compare(String[] o1, String[] o2) { int cmp = 0; if((o1[0]).compareTo(o2[0])==1){ for(int i=1;i&lt;currLineSplitted.length;i++){ cmp = (o1[i]).compareTo(o2[i]); } } else { cmp=0; } return cmp; } }); s.addAll(rowList); List&lt;Object&gt; res = Arrays.asList(s.toArray()); for(Object obj:res){ String[] arr = (String[])obj; System.out.println(arr[0]+","+arr[1]+","+arr[2]); } input file: {"1","a","gh"} {"1","a","rs"} {"1","b","cd"} {"2","a","xy"} {"2","b","xy"} {"3","a","pq"} output: 1,a,gh 2,b,xy Required output: 1,a,gh 1,a,rs //should be deleted as in group 1 a is repeated 1,b,cd 2,a,xy 2,b,xy //should be deleted as in group 2 xy is repeated 3,a,pq
downvote count: 0
upvote count: 1
tagged with: collections
favorite count: 0
has comment: http://stackoverflow.com/comment/40094314
type: Question
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/25662013
has title: remove duplicate column values inside a group
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25662013
possible better answer: http://stackoverflow.com/a/25658128
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25658128
answer count: 2
tagged with: treeset

http://stackoverflow.com/q/25579319
type: Question
tagged with: postgresql
has answer: http://stackoverflow.com/a/25580391
type: UnansweredQuestion
tagged with: java
has title: CountMatches() equivalent Postgres query
tagged with: string-utils
score: 0
has comment: http://stackoverflow.com/comment/39951790
answer count: 3
has body: We know the stringutils function CountMatches() - CountMatches - counts the number of occurrences of one String in another. I need an equivalent query in postgresql to count the number of occurence of a string in another. Any idea would appreciated
has answer: http://stackoverflow.com/a/25582213
has answer: http://stackoverflow.com/a/25586331

http://stackoverflow.com/comment/40096974
has text: you should try and run it first.
comment on: http://stackoverflow.com/q/25659395
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40029939
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25622712
has text: How are you testing it ? If the classes are recompiled and deployed, as per hbm2ddl, will create tables as per the definition. BTW how are you creating tables --> script / entity java classes ?

http://stackoverflow.com/comment/39937492
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25571813
has text: I didn't keep these in the while
type: Comment

http://stackoverflow.com/comment/40066538
type: Comment
has text: try setting -Dhttp.proxyHost=yourproxyhost through the command line
type: AnswerComment
comment on: http://stackoverflow.com/a/25642336
score: 1

http://stackoverflow.com/q/25645669
linked to: http://stackoverflow.com/q/14233337
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40074233
has body: I am trying to secure my controller paths on Spring MVC as follows: web.xml contextConfigLocation classpath*:/applicationContext.xml myApp org.springframework.web.servlet.DispatcherServlet 1 myApp / /welcomePage.jsp org.springframework.web.context.ContextLoaderListener <web-resource-collection> myApp *.do </web-resource-collection> allow all users * Encryption is not required for the application in general. NONE Role to allow authentication INTERNET myApp-servlet.xml (I'm excluding the bean tags so the dont take space) <mvc:annotation-driven /> <property name="prefix" value="/WEB-INF/views/"/> <property name="suffix" value=".jsp"/> <mvc:default-servlet-handler /> <import resource="classpath:applicationContext.xml"/> My Controller: @Controller public class HelloController { @RequestMapping(value = "/home.do", method = RequestMethod.GET) public ModelAndView getHome(HttpSession httpSession) { return new ModelAndView("home"); } } My home.jsp is located in /WEB-INF/views/ Right now even though I have logged, I am receiving a 403 status for the home.jsp Is there a more appropriate way to isolate the controller paths and return the requested jsp's normally?
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
answer count: 0
downvote count: 0
score: 1
upvote count: 1
tagged with: java
has title: Spring MVC Security Contraint - web.xml
has comment: http://stackoverflow.com/comment/40071969

http://stackoverflow.com/comment/39913162
has text: This is not a coding service. Is that a school assignment? You should try and come up with an attempted solution yourself. Ask specific questions if you get stuck at some point.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25559010
score: 0

http://stackoverflow.com/a/25700903
has body: You need to make your application multithreaded so that the painting runs in a separate thread. Otherwise you will have the painting blocked while waiting for the next key. This is not a trivial change to your code though.
score: 0
accepted answer of: http://stackoverflow.com/q/25699800
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25699800

http://stackoverflow.com/q/25705913
has title: Set up 404 page in tomcat for multiple webapps
has body: I need to configure a custom 404 page in tomcat 6 and I want to avoid duplicating the files for each webapp (my plan B is to use symlinks but I'd like to avoid those as well). This SO thread suggests creating a new 'error' webapp and putting the custom page files in there. But then I haven't figured out how I set up the custom 404 configuration in web.xml to use this url http://host:port/error/NotFound.html If I set it up like this: 404 /error/NotFound.html It's relative to the root of the particular webapp that the user is in at that time.
type: AnsweredQuestion
score: 1
tagged with: tomcat6
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25728061
upvote count: 1
accepted answer: http://stackoverflow.com/a/25728061
linked to: http://stackoverflow.com/q/13914575
answer count: 1
tagged with: java
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/comment/40000367
score: 0
type: Comment
has text: Take a look at http://stackoverflow.com/questions/20828834/spring-3-2-responsebody-not-working-with-a-model-return-value?rq=1
type: QuestionComment
comment on: http://stackoverflow.com/q/25604477

http://stackoverflow.com/q/25628800
answer count: 2
type: UnansweredQuestion
tagged with: java
tagged with: highcharts
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/25639859
has title: Click event on Donut Highchart with GWT
has answer: http://stackoverflow.com/a/25636635
has body: I'm using the Highchart librairy with GWT to display multiseries Donut charts. I would like to be able to click on one point (one series' subpart) and retrieve within the event handler the name of this point. I tried "setPointLegendItemClickEventHandler" in the "PiePlotOption" that I set to my series but that's not working. I can't find anything in the documentation that helps me. Any idea ?
score: 0

http://stackoverflow.com/q/25601575
has title: Get instance of the class of a ClassFile
has body: i've a folder which contains jar files. i load all of those files, then i load all of the class files which are in the jar files. now i want to make an instance of every class of the class files. ClassFile[] classFiles = loadClassFiles(); Object[] objects = new Object[classFiles.length]; for(int i = 0; i &lt; classFiles.length; i++){ objects[i] = getNewInstanceOf(classfiles[i]); } This is what i ve so far. only the method getNewInstaceOf(Classfile file) is missed. Can anyone tell me how to do this? If there is an easier way to load all classes from a jar file, you can also tell me. i don't have to get the classFiles or to load the jarfile, if there is any other way. Also you might should know, that every Class does have a constructor without parameters thanks for help :)
tagged with: .class-file
has comment: http://stackoverflow.com/comment/39991498
type: Question
tagged with: instantiation
has answer: http://stackoverflow.com/a/25602182
tagged with: classloader
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25602182
score: 0
has comment: http://stackoverflow.com/comment/39992021
has comment: http://stackoverflow.com/comment/39991910
has comment: http://stackoverflow.com/comment/39992256
has comment: http://stackoverflow.com/comment/39991698
tagged with: java
answer count: 1

http://stackoverflow.com/a/25606283
has body: Here's a mathematic method, I started from -5 to 5 and converted in -1 to 1 max=1; min=-1; maxold=-5; minold=5; value=2; newvalue= (max-min)/(maxold-minold)*(value-minold)+min; alert(newvalue);
answers question: http://stackoverflow.com/q/25606134
has comment: http://stackoverflow.com/comment/40000353
has comment: http://stackoverflow.com/comment/40000775
type: Answer
has comment: http://stackoverflow.com/comment/40010357
score: 0

http://stackoverflow.com/q/25572084
has comment: http://stackoverflow.com/comment/39950382
has title: Missing URI element. For link operations, URI element must be specified
score: 0
tagged with: rest-client
tagged with: java
answer count: 1
tagged with: odata
has comment: http://stackoverflow.com/comment/39942696
type: Question
has body: I am trying to create links b/w Products(ID =1 and ID =2) and Category(ID=12) using the OData service- http://services.odata.org/(S(egpbfjhhvili4slwaq1p2lvt))/V2/OData/OData.svc/Categories(12)/$links/Products using the payload: <?xml version="1.0" encoding="utf-8"?> http://services.odata.org/(S(egpbfjhhvili4slwaq1p2lvt))/V2/OData/OData.svc/Products(7) http://services.odata.org/(S(egpbfjhhvili4slwaq1p2lvt))/V2/OData/OData.svc/Products(8) But I am getting an 400 bad request error: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <message xml:lang="en-US">Missing URI element. For link operations, URI element must be specified. Any suggestion?? Am I doing something wrong here??
has answer: http://stackoverflow.com/a/25615511
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39942752
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/25696942
has comment: http://stackoverflow.com/comment/40165700
has comment: http://stackoverflow.com/comment/40165652
has answer: http://stackoverflow.com/a/25696998
has answer: http://stackoverflow.com/a/26162917
has answer: http://stackoverflow.com/a/25696997
has answer: http://stackoverflow.com/a/25696999
tagged with: fibonacci
has title: Return statement doesn't break out of block, even though condition is true
type: Question
tagged with: math
tagged with: java
possible better answer: http://stackoverflow.com/a/25696998
accepted answer: http://stackoverflow.com/a/25696997
has comment: http://stackoverflow.com/comment/40165657
has comment: http://stackoverflow.com/comment/40165586
has body: This is a simple program to check if a number if Fibonnacci. I have a mysterious bug: the "return true" statement isn't triggered. Instead, "hi" will be printed many times. Return should break out of the method, does anyone have insight as to why it's not? Thanks! import java.util.*; public class Solution { public static boolean listFibs (long oldestFib, long oldFib, long input) { long newFib = oldestFib + oldFib; while (newFib &lt; Math.pow(10,10)) { if (newFib == input) { System.out.println("hi"); return true; } listFibs(oldFib, newFib, input); } return false; } public static void main(String[] args) { /*Scanner in = new Scanner(System.in); int testCases = in.nextInt(); for (int i = 0; i &lt; testCases; i++) { int a = in.nextInt(); System.out.println("A= " + a); System.out.println(listFibs(0, 1, a)); }*/ System.out.println(listFibs(0, 1, 5)); } }
has comment: http://stackoverflow.com/comment/40165837
answer count: 4
tagged with: return
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40165726

http://stackoverflow.com/comment/40151288
comment on: http://stackoverflow.com/a/25678504
type: Comment
type: AnswerComment
has text: Yes, but when I rebuild the project and deploy into the Android Emulator, It doesn't load because the my dependency is not loaded into the apk.
score: 0

http://stackoverflow.com/comment/40185690
score: 0
comment on: http://stackoverflow.com/q/25708251
has text: Can you show thw code please?
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25554125
has body: Unfortunately, any byte or any byte combination might be a character depending on your character encoding. You are probably trying to separate the human-readable characters. In that case, a good encoding would be ISO_8859-1 (standard 1 byte encoding): byte[] array = ...; //this is your byte array String string = new String(array, "ISO_8859-1"); //convert ALL the bytes to characters Now, you can use the Character class to check what kind of characters you have: for(int i = 0; i &lt; array.length; i++) { char ch = string.charAt(i); //now perform your tests on the character if(.../*character is good*/) System.out.println(ch); else /*character shouldn't be displayed*/ System.out.prinln(((int)ch)); } For example, you can print all the characters that represent valid letters: if(Character.isLetter(ch)) ... I think this should do what you're intending to do, but it's highly questionable why you would do this.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25553908
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25553908
type: AcceptedAnswer

http://stackoverflow.com/comment/40087079
has text: But basically you are asking us to recommend or find a book, tool, software library, tutorial or other off-site resource, right?
type: Comment
comment on: http://stackoverflow.com/q/25653748
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39944823
has text: next question would be what is in the lib folder? does it have the jar that contains MappingDispatchAction?
type: QuestionComment
comment on: http://stackoverflow.com/q/25575591
score: 0
type: Comment

http://stackoverflow.com/q/25571934
has body: I am reading a properties file which contains € euro symbol. When it prints on the screen which looks totally different. I compared the string from props file and by declaring another string with same text using equals method it is false. properties file: your purchase order is € string text="your purchase order is €"; on comparing the above strings it fails. ************************ public String getProperty(String arg0) { Properties prop = new Properties(); InputStream input = null; try { input = new FileInputStream("C:/text.properties"); } catch (FileNotFoundException e) { e.printStackTrace(); } try { prop.load(input); } catch (IOException e) { e.printStackTrace(); } return prop.getProperty(arg0); }
type: UnansweredQuestion
has title: Euro symbol not displayed properly from a properties file
has comment: http://stackoverflow.com/comment/127732837
score: 2
has comment: http://stackoverflow.com/comment/39937348
has answer: http://stackoverflow.com/a/25572048
tagged with: java
answer count: 1
downvote count: 0
tagged with: character-encoding
favorite count: 0
type: Question
tagged with: properties-file
has comment: http://stackoverflow.com/comment/39937143
upvote count: 2

http://stackoverflow.com/comment/40093265
score: 0
type: AnswerComment
has text: @Kayaman that can't be a sufficient explanation, because then a `List<String>` would also "lose type safety".
comment on: http://stackoverflow.com/a/25655726
type: Comment

http://stackoverflow.com/comment/40169753
score: 0
type: Comment
type: QuestionComment
has text: Can you point in the code the line getting the error? Don't want to count up to 39 :)
comment on: http://stackoverflow.com/q/25699428

http://stackoverflow.com/a/25677752
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/71257433
score: 8
upvote count: 8
has comment: http://stackoverflow.com/comment/71257421
answers question: http://stackoverflow.com/q/25677690
has body: The better way would be to convert the String array to an array of Date Date[] arrayOfDates = new Date[dates.length]; for (int index = 0; index &lt; dates.length; index++) { arrayOfDates[index] = sdf.parse(dates[index]); } Then sort the arrayOfDates and if you need to, use the SimpleDateFormat to format the results back to the dates array... Arrays.sort(arrayOfDates); for (int index = 0; index &lt; dates.length; index++) { dates[index] = sdf.format(arrayOfDates[index]); } This provides you with much more control over what you should do if one or more of the values in the dates array is an invalid format. Another, "dirty" solution, would be to use a custom Comparator that would convert the values to a Date inline and compare them. This is okay if you can guarantee the validity of the dates, but starts to fall apart when you can't, for example... import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Comparator; import java.util.logging.Level; import java.util.logging.Logger; public class DirtySort { public static void main(String[] args) { String dates[] = {"05-11-2014", "23-08-2014","05-02-2013"}; Arrays.sort(dates, new Comparator&lt;String&gt;() { private SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd-MM-yyyy"); @Override public int compare(String o1, String o2) { int result = -1; try { result = sdf.parse(o1).compareTo(sdf.parse(o2)); } catch (ParseException ex) { ex.printStackTrace(); } return result; } }); for (String date : dates) { System.out.println(date); } } }
type: Answer
accepted answer of: http://stackoverflow.com/q/25677690

http://stackoverflow.com/a/25652638
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25651695
has body: You should be able to get the resource ids dynamically, using the code below: for (int i = 1; i &lt; 21; i++) { int resID = getResources().getIdentifier("button"+i , "id", getPackageName()); ((ImageView) findViewById(resID)).setImageResource(R.drawable.grafika); } Although, not sure how performant this will be.
score: 0
answers question: http://stackoverflow.com/q/25651695

http://stackoverflow.com/comment/40191819
type: QuestionComment
has text: So do you want the Bitmap to fill the whole screen or not to be cropped like in the images above?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25711528

http://stackoverflow.com/comment/40151108
type: QuestionComment
comment on: http://stackoverflow.com/q/25689473
score: 0
type: Comment
has text: @bhargavg yea from command line only

http://stackoverflow.com/comment/39919636
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25550955
type: QuestionComment
has text: Hi i have added code and screenshot.Could you please help me in this

http://stackoverflow.com/q/25553813
linked to: http://stackoverflow.com/q/25357533
has comment: http://stackoverflow.com/comment/132689068
has comment: http://stackoverflow.com/comment/39903866
linked to: http://stackoverflow.com/q/9299133
downvote count: 1
has comment: http://stackoverflow.com/comment/40214538
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40263367
has comment: http://stackoverflow.com/comment/39904770
linked to: http://stackoverflow.com/q/23686259
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/25750328
has answer: http://stackoverflow.com/a/25750328
tagged with: java
has answer: http://stackoverflow.com/a/25633985
tagged with: ssl
possible better answer: http://stackoverflow.com/a/25557286
linked to: http://stackoverflow.com/q/6659360
has comment: http://stackoverflow.com/comment/39906205
has answer: http://stackoverflow.com/a/25557286
upvote count: 4
has title: SSL error from Java client but works form POSTER in Firefox
answer count: 3
has comment: http://stackoverflow.com/comment/40127886
has body: I just setup SSL certs on my server. I am pretty sure they are setup right. When go to https://mydomain.com/myapp in the browser the page loads correctly and the Green Lock shows in the address bar. Doing a POST from Firefox>POSTER to this HTTPS url I get a valid response. If I do the same POST from my Java client I get the following error: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target On my server I have put the CA_ROOT certs in the JAVA.../jre/lib/security/cacert keystore. Here is my posting code from my Java client. URL url = new URL(Global.SERVER_URL); HttpsURLConnection connection = null; connection = (HttpsURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setDoInput(true); connection.setReadTimeout(45000); connection.setRequestProperty("Content-Type", "text/json"); connection.connect(); PLease Note: THIS IS NOT A SELF SIGNED CERT. It was issued by a CA I have a feeling that Glassfish is not sending the full Cert Chain. I looked at the cert that the browser got and it was the full cert chain. I looked at the SSL error and that was only the Intermediate Cert and that for my domain. How do I get Glassfish to send the full Cert chain? Check SSL Chain openssl.exe s_client -connect mydomain.com:443 Returns WARNING: can't open config file: /usr/local/ssl/openssl.cnf Loading 'screen' into random state - done CONNECTED(00000190) depth=0 C = US, ST = &lt;edited&gt;, L = &lt;edited&gt;, O = &lt;edited&gt;, OU = &lt;edited&gt;, CN = &lt;edited&gt; verify error:num=20:unable to get local issuer certificate verify return:1 depth=0 C = US, ST = &lt;edited&gt;, L = &lt;edited&gt;, O = &lt;edited&gt;, OU = &lt;edited&gt;, CN = &lt;edited&gt; verify error:num=27:certificate not trusted verify return:1 depth=0 C = US, ST = &lt;edited&gt;…

http://stackoverflow.com/comment/39994052
has text: @Keppil I agree that it's in scope for Code Review, but I don't see that that makes it out of scope here. There are lots of questions that could legitimately be asked in more than one place. A large number of the questions on SO are of the form where someone posts some "working" but inefficient code and wants some clues for how to improve it, e.g., http://stackoverflow.com/questions/25576302/wary-of-flattening-longish-liststring-into-string , to which no one would object.
comment on: http://stackoverflow.com/q/25595844
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40101979
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25660816
has text: Firstly, if one letter occurs with frequency more than `ceil(n/2)`, then it's impossible, by the pigeonhole principle. Now, since you want the lexicographically smallest solution, you first thought should be the greedy algorithm that assigns the minimal letter at each step (eg. aabc -> abac). Is this correct? Yes, *while it works*. It may happen at the end you have a surplus of the last letter (eg. aabcc -> abac—one c left over). At this point, you have a *lexicographically smallest* solution to the subproblem. Think how you can fit the last letter(s) keeping minimality.
score: 1

http://stackoverflow.com/q/25673912
type: AnsweredQuestion
answer count: 2
has body: I would like to have this code be able to locate more than one X and output it as Location1, location2,....... i.e input: xuyx i would have it output 0,3 import java.util.Scanner; public class findinline { public static void main(String[] args) { Scanner input = new Scanner(System.in); String str; str = input.nextLine(); int pos = str.indexOf("x"); if (pos &lt; 0){ System.out.println("No X Detected"); } else{ System.out.println(pos); } } }
has answer: http://stackoverflow.com/a/25674172
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40123675
downvote count: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/5034442
accepted answer: http://stackoverflow.com/a/25673981
score: -1
has title: More then one Indexes
has answer: http://stackoverflow.com/a/25673981
possible better answer: http://stackoverflow.com/a/25674172

http://stackoverflow.com/comment/39968077
comment on: http://stackoverflow.com/q/25586853
type: Comment
score: 0
type: QuestionComment
has text: I moved everything into a single replica set and hit that directly (bypassing the mongos completely) and got only slightly better performance. I guess the network latency is just an absolute killer for mongo perf.

http://stackoverflow.com/a/25616330
score: 2
type: Answer
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25616307
has body: I would like to suggest you to learn about List. And the second would be to create a class that holds everything that comes from your query. And finally save each object of the class to the array. Example Suppose you get id, name and address columns from your query Create a class public class YourClass{ int id; String name, address; //create getters and setters or use a constructor //example of setter to set field id public void setId(int id){ this.id = id; } } And then while retrieving the records from query, create an object of your class and set the columns as field of your class as follow: YourClass anObject = new YourClass(); anObject.setId(id);// get similar columns from query anObject.setName(name); And finally add the object to the ArrayList as below: yourArrayList.add(anObject); To take care of multiple number of records you need to keep these code inside the while loop And define your List before while loop as follow: List&lt;YourClass&gt; yourArrayList = new ArrayList&lt;YourClass&gt;(); And I think this is the best approach as it uses OOP that you should begin using instead of using bare array.

http://stackoverflow.com/comment/40032629
has text: ok, lets say you have two classes A and B, you create a middle man CD now CD will have many to many with both A and B. and CD will have its own PK.
score: 0
comment on: http://stackoverflow.com/q/25623458
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25582527
type: Question
tagged with: ftp
answer count: 2
has answer: http://stackoverflow.com/a/25582719
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25582819
tagged with: android
linked to: http://stackoverflow.com/q/16333754
has body: Hello i am trying to show list of files and folder in ListView in a android app but i am unable to do that. I got succeeded to show the sdcard files but not able to show the files from ftp server. Can someone help me with this? FTPFile[] list = client.list(); String[] fileNames = new String[list.length]; for (int i = 0; i &lt; list.length; i++) { fileNames[i] = list[i].getName(); fileList[i]=list[i].getName(); Now i want to use this array in array adapter but don't know how to? Tried few ways but application force stopped.
score: 0
has comment: http://stackoverflow.com/comment/39956913
tagged with: java
has title: How to use listview in android to show list of files for a remote ftp
has comment: http://stackoverflow.com/comment/39956807

http://stackoverflow.com/comment/40054506
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25635813
has text: Which is line 117? And are you sure that stack trace is complete?
score: 0

http://stackoverflow.com/a/25600490
accepted answer of: http://stackoverflow.com/q/25597778
has comment: http://stackoverflow.com/comment/58179531
has comment: http://stackoverflow.com/comment/58180289
answers question: http://stackoverflow.com/q/25597778
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/58175223
has comment: http://stackoverflow.com/comment/58178953
has comment: http://stackoverflow.com/comment/58174159
has comment: http://stackoverflow.com/comment/58179697
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/58179442
has body: This probably has to do with generics. While Result.map() takes a RecordMapper&lt;? super R,E&gt; argument type, Record.map() takes RecordMapper&lt;Record,E&gt;, because Record has no recursive generic type definition for R. In other words, if you want to reuse the same mapper for both Result.map() and Record.map(), unfortunately, you will need to make it a RecordMapper&lt;Record, E&gt;, which means you'll lose some of the type safety on the record type. A workaround would be to create a new result just for the sake of mapping: Result&lt;TableRecord&gt; result = DSL.using(configuration).newResult(TABLE); result.add(record); Something pojo = result.map(mapper).get(0);

http://stackoverflow.com/comment/40031832
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25622268
type: Comment
has text: Looking for http://docs.oracle.com/javase/tutorial/uiswing/components/internalframe.html ?

http://stackoverflow.com/comment/40173562
has text: thanks for your reply. I know the difference between list and object. I just wanted to know if there are differences in sending a list (arraylist or linked list) or a single object. so, it is only a matter of best performances. thanks again
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25701617
type: AnswerComment

http://stackoverflow.com/a/25577603
answers question: http://stackoverflow.com/q/25577580
has comment: http://stackoverflow.com/comment/39948669
accepted answer of: http://stackoverflow.com/q/25577580
has comment: http://stackoverflow.com/comment/39948735
upvote count: 2
has comment: http://stackoverflow.com/comment/39948768
has comment: http://stackoverflow.com/comment/39948792
type: Answer
has comment: http://stackoverflow.com/comment/39948730
has comment: http://stackoverflow.com/comment/39948744
has comment: http://stackoverflow.com/comment/39948893
has body: Your code is not structured for correct Swing GUI event-driven programming but rather looks like a linear console program that is being shoe-horned into a GUI. Get rid of that while loop, get rid of that static boolean variable. Instead give your class a non-static (instance) int counter variable and a JTextField non-static variable and simply increment your counter in the actionPerformed method and display the results in the JTextField (or JLabel if you prefer). So the actionPerformed could look something like: public void actionPerformed(ActionEVent e) { counter++; // increment the counter variable charCount.setText("Count: " + counter); // display the results } and again, counter and charCount are non-static and are declared and initialized in the class, not inside of the constructor or any method. Edit Additional notes: Why does your class extend JFrame when you don't use it as a JFrame? In general, it's a good idea to start all Swing proggrams on the Swing Event Dispatch Thread or EDT. This can be done by passing a Runnable with your start-up code in it to the SwingUtilities static method invokeLater(...). For example: public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { // create and display your GUI from in here MainGui mainGui = new MainGui(); JFrame mainFrame = new JFrame("Main GUI"); mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); mainFrame.add(mainGui); mainFrame.pack(); mainFrame.setLocationRelativeTo(null); mainFrame.setVisible(true); } Edit 2 Oops, I read your requirements wrong. You need to count the chars in a String, and so you will need another class instance JTextField, one to hold the user's String, get rid of the counter instance field since it no longer will be needed, and then in the actionPerformed method, simply get the String from the JTextField, get its length, and display the length in another JTextField or…
has comment: http://stackoverflow.com/comment/39948661
score: 2
has comment: http://stackoverflow.com/comment/39948578
has comment: http://stackoverflow.com/comment/39948557
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39951477
has comment: http://stackoverflow.com/comment/39951520
has comment: http://stackoverflow.com/comment/39952080

http://stackoverflow.com/q/25644309
has answer: http://stackoverflow.com/a/25645307
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: user-interface
answer count: 1
tagged with: swing
tagged with: jtextfield
has title: JTextField permanent Position/Location?
favorite count: 0
type: Question
upvote count: 2
has body: So I am a having a problem regarding my JTextField. What I'm trying to do is to put the JTextField box below the picture(map of a certain town). Yeah, I used .setBounds and it was already below the image, but what I want to happen is that if I do .pack();, it must be still visible. Unfortunately, it wasn't. I tried using the .setBorder(BorderFactory.createEmptyBorder(5,50,0,50)); and I saw that the box is below the picture but it is no longer available for putting a text. And to conclude, I want the JTextField below the picture and still must be visible whenever I pack it. Please Help. Thank you. I am still on the stage of discovering new things about GUI. Sorry for the noob question. import java.awt.BorderLayout; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Font; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.JTextField; class ProgDraftMain { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run() { ProgDraft gui = new ProgDraft(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setResizable(false); gui.pack(); //gui.setSize(1000 , 1000); gui.setVisible(true); } }); } } class ProgDraft extends JFrame { private ImageIcon image1; private JLabel label1; private JTextField textField1; ProgDraft() { /***Panel**/ JPanel panel = new JPanel(); panel.setLayout(new FlowLayout(FlowLayout.LEADING)); /***Title***/ JLabel title = new JLabel("Perimeter Check", JLabel.CENTER); Font font = new Font("Gigi", Font.BOLD, 50); title.setFont(font); /***Image***/ ImageIcon pics = new ImageIcon(getClass().getResource("antipolo.png")); JLabel logo = new JLabel(pics); logo.setBorder(BorderFactory.createEmptyBorder(10, 70, 0, 50)); logo.setToolTipText("Ito raw kunware yung barangay."); panel.add(logo); /***Info ANtipolo***/ String text = "Ito kunware ang ANtipolo" + "&…
downvote count: 0
has comment: http://stackoverflow.com/comment/40069904
tagged with: jcreator
accepted answer: http://stackoverflow.com/a/25645307

http://stackoverflow.com/q/25615641
score: 0
tagged with: java
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/25615962
has answer: http://stackoverflow.com/a/25615962
type: Question
possible better answer: http://stackoverflow.com/a/25616551
tagged with: oracle-database
answer count: 2
tagged with: database
has answer: http://stackoverflow.com/a/25616551
tagged with: tomcat
has title: How to debug oracle connection?
type: AnsweredQuestion
has body: I'm using oracle database. Say I used a jdbc connection in my java web application deployed in a tomcat server running in eclipse, and I forget to close this connection in code after using it. Then, if I stop the tomcat server, will the connection be released and everything is OK, or it will cause some side effects in the oracle database, say some dead connections, and gradually cause the database down? And how to debug this kind of problems? I mean are there any tools which can let me see the active(and 'dead', if any) connections in my database, and their client address, etc?

http://stackoverflow.com/comment/39902345
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25552357
has text: I found something over internet, check [here](http://beginnersbook.com/2013/12/how-to-sort-hashmap-in-java-by-keys-and-values/). I think this is what you r looking for

http://stackoverflow.com/a/25583429
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25580887
has body: This is the solution! I find on the forum so thank you all. public void onDestroyView() { super.onDestroyView(); Fragment fragment = (getFragmentManager().findFragmentById(R.id.map)); FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); ft.remove(fragment); ft.commit(); }
accepted answer of: http://stackoverflow.com/q/25580887
type: AcceptedAnswer

http://stackoverflow.com/comment/39990781
has text: You can use bytecode manipulation, as described in "edit 2" of my answer.
comment on: http://stackoverflow.com/a/25600384
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25639153
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25638994
type: Answer
has body: I havent worked on xml but I use log4j.properties which works perfectly fine. Just place this in your classpath and add jar for log4j. It should work. You can change log levels as you want. Also there is no need to specify ERROR level as by default ERROR level gets logged. Sample : log4j.debug=TRUE log4j.logger.com.XXX.RemoteCacheManager=FATAL, Logs log4j.logger.com.XXX.RedisCacheImpl=FATAL, Logs log4j.logger.com.XXX.utils=DEBUG, TimeItLogs log4j.logger.com.XXX=DEBUG, Logs log4j.logger.org.hibernate=INFO, Logs log4j.logger.org.springframework=INFO, Logs log4j.logger.org.apache.velocity=ERROR, Logs log4j.logger.org.apache.commons=ERROR, Logs log4j.logger.org.apache.tiles=ERROR, Logs log4j.appender.Logs=org.apache.log4j.RollingFileAppender log4j.appender.Logs.File=${catalina.base}/logs/XXX.log log4j.appender.Logs.MaxFileSize=10MB log4j.appender.Logs.MaxBackupIndex=50 log4j.appender.Logs.layout=org.apache.log4j.PatternLayout log4j.appender.Logs.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p %t %c %m %n
accepted answer of: http://stackoverflow.com/q/25638994

http://stackoverflow.com/q/25683464
upvote count: 1
tagged with: intellij-idea
answer count: 1
accepted answer: http://stackoverflow.com/a/25686864
has comment: http://stackoverflow.com/comment/40141389
tagged with: tomcat
has title: Deployment Spring app with Tomcat, context not matched
has body: I have deployed a Spring MVC app into Tomcat 6, but I have a problem with the application context uri. If I run into tomcat (from Intellij Idea), default settings, it works great, all controllers are matched (from context "/"). Example: http://localhost:8080/simgranjas/getAnimals The problem is if I deploy the war file, then the url becomes localhost:8080/projectName/ (from Idea the same behaviour would be changing default context in Tomcat run configuration ("/") with project name ("/projectName")). The url should be this, because there are other projects running in the same Tomcat server. After that the controllers don't match it. They still start in "/". So a call from code would be " http://localhost:8080/simgranjas/getAnimals instead of http://localhost:8080/projectName/simgranjas/getAnimals (where it really is) and I get a non found error. @Controller public class WebController { @RequestMapping(value = "/simgranjas", method = RequestMethod.GET) public String listUsers(ModelMap model) { return "principal"; } @RequestMapping("/simgranjas/getAnimals") public String getAnimals(ModelMap model) { return "granjaAnimales"; } I've tried changing web.xml mvc-dispatcher but it doesn't work. There it is: <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> Simulador Granjas / mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / default *.css default *.js characterEncodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true characterEncodingFilter /*
favorite count: 0
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25686864
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/40140490
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/a/25685492
type: Answer
score: 0
has body: You need to encode your URL. Special character which have to be escaped. Escaping example: String url = "http://e2e-soaservices:44000/3.1/StandardDocumentService?wsdl"; String yourURLStr = java.net.URLEncoder.encode(url, "UTF-8"); java.net.URL url = new java.net.URL(yourURLStr);
answers question: http://stackoverflow.com/q/25685347

http://stackoverflow.com/comment/40174880
has text: // Do stuff with data - what stuff are you doing there? Make sure the stream is not closed somewhere in that code.
comment on: http://stackoverflow.com/q/25702088
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39947166
type: Comment
comment on: http://stackoverflow.com/a/25577100
score: 0
type: AnswerComment
has text: C++ part too :-) you are actually passing by value, Objects are even copied with a constructor if you pass them directly. Having that in mind, It would only make sense that it's the same in C# - passing by value should be default, especially for primitives, it's the only thing that makes sense.

http://stackoverflow.com/comment/40193683
type: Comment
comment on: http://stackoverflow.com/a/25710780
type: AnswerComment
has text: I just need 4 filters thats all I just tried what you said but when I add the aqua button in the onCReate and create a listener after my cameralistner is not working
score: 0

http://stackoverflow.com/a/25623343
answers question: http://stackoverflow.com/q/25622866
score: 0
has comment: http://stackoverflow.com/comment/40056252
has body: Try this: System.out.println(coll.getCount()); More Detail here: http://docs.mongodb.org/ecosystem/tutorial/getting-started-with-java-driver/
type: Answer

http://stackoverflow.com/a/25633223
downvote count: 0
upvote count: 1
has body: [I] found that [Math.sqrt(x) where x is a perfect square] always returned a floating point value with one decimal. You are mistaking a particular printed representation of a double value with the value itself. A double does not have a decimal point. A double is a bit pattern that represents a particular real number (4 for example). Decimal points only appear in a particuular decimal representation of real numbers. If I write "0.25", that obviously has a decimal point. If I write "1/4", there is no decimal point. But those are just two different representations of the same real number. So is the particular bit pattern that represents the double value returned by the Java expression, 1.0/4.0. I don't know why Double.toString(4) returns the string, "4.0" instead of returning "4", but I'm guessing that somebody wanted to make it consistent with numeric literals in the Java language. When a "4" appears in your program, that's an int literal, and when "4.0" appears in your program, that's a double literal.
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25632733
answers question: http://stackoverflow.com/q/25632733
type: AcceptedAnswer

http://stackoverflow.com/q/25680258
type: Question
has answer: http://stackoverflow.com/a/74256540
has comment: http://stackoverflow.com/comment/87011176
has answer: http://stackoverflow.com/a/77134499
has body: How can I convert snake case to camel case in Java? Input: "input_in_snake_case" Output: "InputInSnakeCase"
has comment: http://stackoverflow.com/comment/87011313
accepted answer: http://stackoverflow.com/a/25680302
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25680302
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/81344052
answer count: 3
upvote count: 48
linked to: http://stackoverflow.com/q/3618733
tagged with: string
linked to: http://stackoverflow.com/q/1143951
favorite count: 0
possible better answer: http://stackoverflow.com/a/74256540
has title: Converting a string from snake case to camel case in Java
score: 46

http://stackoverflow.com/q/25677856
has title: How to filter database records based on more than one condition using JDBC?
tagged with: sql
tagged with: java
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/40130545
downvote count: 0
has comment: http://stackoverflow.com/comment/40185862
has comment: http://stackoverflow.com/comment/40130445
favorite count: 0
has body: I started learning SQL with Java, and I am trying to make Register/Login System using Swing and SQLite. So, I made almost whole basic login system, but I am stuck. I have table called users, and I have 2 text fields with button, and if button is clicked it just says hello + 'username'. So in my table, for example, I have 2 values: For example, I have table 'user': +----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+-------+ | admin | varchar(255) | YES | | NULL | | | password | varchar(255) | YES | | NULL | | +----------+--------------+------+-----+---------+-------+ with data: +----------+-------------+ | admin | password | +----------+-------------+ | myLogin | myPassword | | myLogin1 | myPassword1 | +----------+-------------+ It will just recognise when I enter myUsername1 , myPassword1 etc. It wont recognise if I enter myUsername, myPassword So basically I am trying to figure out how to check if user entered for example just admin password and than say hello admin etc. So here is my Connect.java import java.sql.*; import javax.swing.JOptionPane; public class Connect { static String username; static String password; static String query; public static Connection ConnectDB() { try { Class.forName("org.sqlite.JDBC"); Connection conn = null; conn = DriverManager.getConnection("jdbc:sqlite:C:\\Users\\Alex\\workspace \\RegisterAndLoginSystem\\System.sqlite"); Statement state = null; state = conn.createStatement(); query = "SELECT * FROM `user`"; // This query does not work as well // query = "SELECT admin,password FROM user WHERE admin = '" + GuiLogin.user + "' AND password = '" + GuiLogin.pass + "'"; ResultSet rs = state.executeQuery(query); while(rs.next()) { username = rs.getString("admin"); System.out.println(username); password = rs.getString("password"); System.out.println(password); } rs.close(); state.close(); return conn; } catch(Exception e) { JOptionPane.…
type: Question
has comment: http://stackoverflow.com/comment/40134197
has comment: http://stackoverflow.com/comment/40130800
has comment: http://stackoverflow.com/comment/40130416
upvote count: 2
has comment: http://stackoverflow.com/comment/40130661
has comment: http://stackoverflow.com/comment/40130929
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/40130706
has comment: http://stackoverflow.com/comment/40130047
has answer: http://stackoverflow.com/a/25704601
has comment: http://stackoverflow.com/comment/40182691
has comment: http://stackoverflow.com/comment/40130880
score: 2
has comment: http://stackoverflow.com/comment/40130498

amazon-s3
tags question: http://stackoverflow.com/q/25588246
tag name: amazon-s3
type: Tag
tags question: http://stackoverflow.com/q/25604838

http://stackoverflow.com/q/25561418
has title: How to make different Hibernate configuration for tests?
has body: I have JSF Application with Hibernate. I use Tomcat connection pool in hibernate.cfg.xml <?xml version='1.0' encoding='UTF-8'?> <hibernate-configuration> org.hibernate.dialect.PostgreSQL9Dialect java:/comp/env/jdbc/netstat org.hibernate.cache.NoCacheProvider org.hibernate.transaction.JDBCTransactionFactory thread false update <mapping class="ru.gooamoko.model.Group" /> <mapping class="ru.gooamoko.model.Host" /> <mapping class="ru.gooamoko.model.Traffic" /> <mapping class="ru.gooamoko.model.DailyTraffic" /> </hibernate-configuration> Project can be build with maven with all tests skipped and runs normal. But for tests souch Hibernate configuration is not applicable. Is any way for this case to specify different configuration file for JUnit tests? Best regards.
accepted answer: http://stackoverflow.com/a/25562742
score: 2
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/25562742
downvote count: 0
tagged with: maven
favorite count: 0
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/25709844
type: Answer
answers question: http://stackoverflow.com/q/25709692
downvote count: 0
upvote count: 1
has body: Your actual problem is quite unclear, but just reading the first two methods is enough to find what, I suppose, is a bug: public ActiveList() { for(int i = 0; i &lt; activeList.length; i++) activeList[i] = null; } the above code is completely useless. The default value of an element of an array of objects is null. So the loop assigns null to a variable wich is already null. public void addToList(Rectangle x) { for(int i = 0; i &lt; this.activeList.length; i++) { if(this.activeList[i] == null) { this.activeList[i] = x; i = this.activeList.length+1; } else this.activeList[activeList.length-1] = x; } } If your list only contains null, the rectangle will be stored at index 0, and the loop will stop. For all the susequent calls to this method, the loop will find that the element at index 0 is not null, and will thus store x at the last index of the array, and then at the first non-null index. I don't know exactly what you're trying to achieve, and what the actual problem is, but you should probably forget about implementing your own list based on an array, and use an ArrayList instead.
has comment: http://stackoverflow.com/comment/40188657
score: 1

http://stackoverflow.com/comment/39942202
has text: OK I see. One option, then, is to just keep an internal copy of `A` and pass method calls directly to it; except for when you want to change the behavior. The disadvantage is that there's probably a lot of boilerplate to this approach, if `A` has a lot of public methods.
comment on: http://stackoverflow.com/q/25574354
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25711623
type: Answer
has comment: http://stackoverflow.com/comment/40191882
has body: This is my code, working really fine Make a class - public class AddQuery extends AsyncTask&lt;Void, Void, Void&gt; { private Context context; private ProgressDialog pd; private String url; private String jsonResult; private String qrs; private String cId; public AddQuery(Context context, String qrs, String cid) { // TODO Auto-generated constructor stub this.context = context; this.qrs = qrs; this.cId = cid; url = "http://" + context.getResources().getString(R.string.url) + "/ques.php"; pd = new ProgressDialog(context); pd.setIndeterminate(true); pd.setMessage("Retrieving Data.."); pd.setCancelable(false); } @Override protected Void doInBackground(Void... arg0) { SharedPreferences prefs = context.getSharedPreferences("com.multisoft", Context.MODE_PRIVATE); List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("go", "add")); params.add(new BasicNameValuePair("qrs", qrs)); params.add(new BasicNameValuePair("cid", cId)); params.add(new BasicNameValuePair("uid", prefs.getString("userID", "0"))); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); try { httppost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse response = httpclient.execute(httppost); jsonResult = inputStreamToString(response.getEntity().getContent()) .toString(); } catch (ClientProtocolException e) { Log.e("e", "error1"); e.printStackTrace(); } catch (IOException e) { Log.e("e", "error2"); e.printStackTrace(); } return null; } private StringBuilder inputStreamToString(InputStream is) { String rLine = ""; StringBuilder answer = new StringBuilder(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); try { while ((rLine = rd.readLine()) != null) { answer.append(rLine); } } catch (IOException e) { e.printStackTrace(); Toast.makeText(context, "Error..." + e.toString(), Toast.LENGTH_LONG).show(); } return answer; } @Override protected void onPostExecute(Void result) { pd.dismiss(); JSONObject jsonR…
answers question: http://stackoverflow.com/q/25711351
score: 0

http://stackoverflow.com/comment/40158104
comment on: http://stackoverflow.com/a/25692673
score: 0
type: Comment
has text: It works. thank you so much.. I gonna try if I can post the code for you to take a look at the savaData() part please!
type: AnswerComment

http://stackoverflow.com/q/25710109
tagged with: java
linked to: http://stackoverflow.com/q/17075061
has answer: http://stackoverflow.com/a/25710256
has title: variable might already have been assigned when it cannot be assigned
has answer: http://stackoverflow.com/a/25710114
answer count: 4
has comment: http://stackoverflow.com/comment/40189317
favorite count: 0
linked to: http://stackoverflow.com/q/13604111
upvote count: 14
has answer: http://stackoverflow.com/a/25710246
tagged with: final
type: UnansweredQuestion
downvote count: 0
has body: research this code: public class TestFinalAndCatch { private final int i; TestFinalAndCatch(String[] args) { try { i = method1(); } catch (IOException ex) { i = 0; // error: variable i might already have been assigned } } static int method1() throws IOException { return 1; } } compiler says that java: variable i might already have been assigned But for me it is looks like impossible situation.
type: Question
score: 14
tagged with: try-catch
has comment: http://stackoverflow.com/comment/40189234
has answer: http://stackoverflow.com/a/25710290

http://stackoverflow.com/q/25644023
has answer: http://stackoverflow.com/a/25644440
tagged with: xml-parsing
upvote count: 32
score: 32
has answer: http://stackoverflow.com/a/30649452
has answer: http://stackoverflow.com/a/44261364
downvote count: 0
has title: Error unmarshalling xml in java-8 "secure-processing org.xml.sax.SAXNotRecognizedException causing java.lang.IllegalStateException"
has answer: http://stackoverflow.com/a/32175461
has body: The following code worked fine in Java 7 import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; String xmlString = '<xml ..... '; StringReader reader = new StringReader(xmlString); JAXBContext jc = JAXBContext.newInstance(MyClass.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); MyClass myClass = (MyClass) unmarshaller.unmarshal(reader); .... Now we had to upgrade to Java 8 and now I get this exception when executing the code: Sep 03, 2014 1:42:47 PM com.sun.xml.internal.bind.v2.util.XmlFactory createParserFactory SCHWERWIEGEND: null org.xml.sax.SAXNotRecognizedException: Feature: http://javax.xml.XMLConstants/feature/secure-processing at org.apache.xerces.jaxp.SAXParserFactoryImpl.setFeature(SAXParserFactoryImpl.java:100) at com.sun.xml.internal.bind.v2.util.XmlFactory.createParserFactory(XmlFactory.java:114) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getXMLReader(UnmarshallerImpl.java:139) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:214) I know that there is a question targeting a similar problem, but stepping back to java 7 is not a solution for me. I tried to add the following maven dependency javax.xml jaxp-api 1.4 but that did not change the result, so I removed it (thanks to @BlaiseDoughan for the information, that this is included in Java 6) Any hints are welcome, many thanks.
answer count: 13
tagged with: java-8
has answer: http://stackoverflow.com/a/35894627
has answer: http://stackoverflow.com/a/27949008
possible better answer: http://stackoverflow.com/a/27949008
has answer: http://stackoverflow.com/a/25805680
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25805680
has answer: http://stackoverflow.com/a/69474111
tagged with: java
linked to: http://stackoverflow.com/q/23952888
has answer: http://stackoverflow.com/a/36147398
tagged with: jaxb
has answer: http://stackoverflow.com/a/65631896
has answer: http://stackoverflow.com/a/25796192
favorite count: 0
has answer: http://stackoverflow.com/a/45058564
type: Question
has answer: http://stackoverflow.com/a/35366786

http://stackoverflow.com/a/25606414
upvote count: 2
has comment: http://stackoverflow.com/comment/40000495
downvote count: 0
type: Answer
has body: You are calling a constructor for your own class CSVReader that doesn't exist! Either rename your class and create a new instance of au.com.bytecode.opencsv, or delete the respective line, make sure you import au.com.bytecode.opencsv.CSVReader, and re-create the line. Alternatively - but I'm unsure whether this is what you'd want - you can make your CSVReader (optimally under another name), extend au.com.bytecode.opencsv.CSVReader and override the respective constructor. I guess your problem was caused when you used auto-complete for CSVReader and didn't pick the class from the right package?
score: 2
answers question: http://stackoverflow.com/q/25605981

http://stackoverflow.com/q/25613650
has comment: http://stackoverflow.com/comment/40013611
type: UnansweredQuestion
score: -2
answer count: 4
has answer: http://stackoverflow.com/a/25618366
has body: Good day guys! So I'm self learning java right now. And one of the exercises I'm answering now is creating a program Pyramid.java that takes an input N and prints a pyramid whose each side is of length N, like the one below: My problem is that everytime I put an input on the command line, the 3 asterisk in the middle don't appear. * * * * * * * * * * * * * * * Here's my code public class D2Q6 { public static void main(String[] args) { int N = Integer.parseInt(args[0]); int k = 1; for(int i = 1; i &lt;= N; i++) { for(int j = 0; j &lt; N-i; j++) System.out.print(" "); System.out.print("*"); if(i &gt; 1) { if(i == N) { for(int j = 0; j &lt; i-1; j++) System.out.print(" *"); } else { for(int j = 0; j &lt; k; j++) System.out.print(" "); k = k+2; System.out.print("*"); } } System.out.println(); } }
linked to: http://stackoverflow.com/q/24156468
upvote count: 0
tagged with: java
downvote count: 2
has title: How to make a pyramid using astersik in Java?
has answer: http://stackoverflow.com/a/25613722
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25614094
has answer: http://stackoverflow.com/a/25613871
has comment: http://stackoverflow.com/comment/40014336

http://stackoverflow.com/a/25600781
type: Answer
upvote count: 1
has body: There is a typo in fun2(): it should read GetMethodID(global_env, cls_Env, "test2", "(I)V"); (the [ is wrong). If you want to call callfunction() from C directly, use GetMethodID(global_env, cls_Env, "callfunction", "()V");
has comment: http://stackoverflow.com/comment/40066745
has comment: http://stackoverflow.com/comment/40067068
score: 1
answers question: http://stackoverflow.com/q/25593454
has comment: http://stackoverflow.com/comment/40059586
downvote count: 0

http://stackoverflow.com/comment/40081792
type: Comment
type: QuestionComment
has text: your grant queries are totally invalid, so even if the users did get created, they wouldn't have any privs anyways.
comment on: http://stackoverflow.com/q/25651120
score: 0

http://stackoverflow.com/q/25679841
tagged with: java
has comment: http://stackoverflow.com/comment/40134853
answer count: 1
has comment: http://stackoverflow.com/comment/40143462
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40141914
type: Question
has comment: http://stackoverflow.com/comment/40133559
has body: I'm new to JDBC and stack overflow as well, and what I'm trying to do here is this : I'm trying to insert a string as blob into a database but I'm getting null pointer exception. Here is the code I'm using : public String execute() { String success="Success"; try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://panorama-pc:3306/sample", "sample", "sample123"); String sql = "Insert into users values(?,?,?,?,?)"; PreparedStatement ps = con.prepareStatement(sql); ps.setNull(1, Types.NULL); ps.setString(2,name); ps.setString(3,RollNo); ps.setString(4, date); Blob blob = con.createBlob(); blob.setBytes(1,desc.getBytes()); // getting exception here int i = ps.executeUpdate(); if(i&gt;0){ return SUCCESS; } else{ return ERROR; } } catch(SQLException | ClassNotFoundException e){ e.printStackTrace(); } Here desc is a string and I'm trying to insert it into a blob column. Can someone please help me out ?
upvote count: 2
type: UnansweredQuestion
tagged with: jdbc
has title: Convert String into Blob
has comment: http://stackoverflow.com/comment/40134310
has comment: http://stackoverflow.com/comment/40143076
has comment: http://stackoverflow.com/comment/40139954
score: 2
has comment: http://stackoverflow.com/comment/40134127
has answer: http://stackoverflow.com/a/25679939

http://stackoverflow.com/comment/40166781
has text: @Satya It is showing the same error
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25695621

http://stackoverflow.com/a/25590848
has body: well the error is self-explanatory. Here for(int i=0; i &lt; Res.get(i).getText(); i++) you are checking if an int is less-than a String. I guess you want the text length so you should do: for(int i=0; i &lt; Res.get(i).getText().length(); i++) If not then please specify what you are trying to do with your loop.
downvote count: 0
answers question: http://stackoverflow.com/q/25590540
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39978787
type: Answer

bimap
type: Tag
tag name: bimap
tags question: http://stackoverflow.com/q/25609232

http://stackoverflow.com/comment/40096430
comment on: http://stackoverflow.com/a/25658881
type: Comment
score: 0
type: AnswerComment
has text: @BlueWhale Sure it does. Let me fire up some code and re-tag your question.

http://stackoverflow.com/a/25678245
type: Answer
has comment: http://stackoverflow.com/comment/40131142
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25678222
has body: You aren't adding a copy of the List, just a reference. So when you do, zeroMatrix.add(insertionList); insertionList.clear(); // &lt;-- this You clear the List you added to the zeroMatrix. You can copy the List, zeroMatrix.add(new ArrayList&lt;&gt;(insertionList)); // &lt;-diamond operator, see below. insertionList.clear(); // &lt;-- now you can clear the insertionList. Or you can move the insertionList declaration into your loop body - while(matrixScanner.hasNextLine()){ ArrayList&lt;Integer&gt; insertionList = new ArrayList&lt;Integer&gt;(); In Java 7 or above you can use the diamond operator - ArrayList&lt;Integer&gt; insertionList = new ArrayList&lt;&gt;(); For Java 6 and earlier you had to specify the type on both sides like ArrayList&lt;Integer&gt; insertionList = new ArrayList&lt;Integer&gt;();
answers question: http://stackoverflow.com/q/25678222

http://stackoverflow.com/q/25594792
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41602229
answer count: 3
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/41596799
possible better answer: http://stackoverflow.com/a/26477023
upvote count: 4
score: 4
has answer: http://stackoverflow.com/a/26477023
type: Question
tagged with: http://stackoverflow.com/tag/zip
has title: ZipOutputStream produces corrupted zip file on Android
downvote count: 0
has answer: http://stackoverflow.com/a/26444235
accepted answer: http://stackoverflow.com/a/26444235
has answer: http://stackoverflow.com/a/75081255
favorite count: 0
has comment: http://stackoverflow.com/comment/41596870
has body: I've implemented backup of user data from the app using zip archive, I am copying database and shared preferences files to zip archive and calculating MD5 checksum of input files to prevent user from modifying backup data. To restore from archive I unzip backup file to temporary directory, check checksums and then copy preferences \ database file in the according folders. Some of my users are complaining that the app generates corrupted backup files (zip files are indeed corrupted). Here is code that compresses all files to zip file: public void backup(String filename) { File file = new File(getBackupDirectory(), filename); FileOutputStream fileOutputStream = null; ZipOutputStream stream = null; try { String settingsMD5 = null; String databaseMD5 = null; if (file.exists()) file.delete(); fileOutputStream = new FileOutputStream(file); stream = new ZipOutputStream(new BufferedOutputStream(fileOutputStream)); File database = getDatabasePath(databaseFileName); File dataDirectory = getFilesDir(); if (dataDirectory != null) { File settings = new File(dataDirectory.getParentFile(), "/shared_prefs/" + PREFERENCES_FILENAME); settingsMD5 = zipFile("preferences", stream, settings); } databaseMD5 = zipFile("database.db", stream, database); JSONObject jsonObject = new JSONObject(); try { jsonObject.put(META_DATE, new SimpleDateFormat(DATE_FORMAT, Locale.US).format(new Date())); jsonObject.put(META_DATABASE, databaseMD5); jsonObject.put(META_SHARED_PREFS, settingsMD5); } catch (Exception e) { e.printStackTrace(); } InputStream metadata = new ByteArrayInputStream(jsonObject.toString().getBytes("UTF-8")); zipInputStream(stream, metadata, new ZipEntry("metadata")); stream.finish(); stream.close(); stream = null; return file; } catch (FileNotFoundException e) { //handling errrors } catch (IOException e) { //handling errrors } } private String zipFile(String name, ZipOutputStream zipStream, File file) throws FileNotFoundException, IOException { ZipEntry zipEntry = new ZipEntry(name); …

http://stackoverflow.com/a/25593029
upvote count: 1
has body: When you send only a single request, a new TCP connection has to be setup between the client and server. For subsequent requests, the connection is reused and with it the latency comes down.
answers question: http://stackoverflow.com/q/25592893
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25592893
type: Answer

http://stackoverflow.com/a/25704984
has comment: http://stackoverflow.com/comment/40179919
upvote count: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25704754
has comment: http://stackoverflow.com/comment/40180386
has body: Take a look at Guava's Collections2 permutations method. Example (source) public void permutations () { List&lt;Integer&gt; vals = Ints.asList(new int[] {1, 2, 3}); Collection&lt;List&lt;Integer&gt;&gt; orderPerm = Collections2.permutations(vals); for (List&lt;Integer&gt; val : orderPerm) { logger.info(val); } } /* output: [1, 2, 3] [1, 3, 2] [3, 1, 2] [3, 2, 1] [2, 3, 1] [2, 1, 3] */
score: 5

http://stackoverflow.com/q/25624186
has comment: http://stackoverflow.com/comment/40032742
tagged with: android
tagged with: achartengine
has comment: http://stackoverflow.com/comment/40033350
has comment: http://stackoverflow.com/comment/40032902
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25624312
answer count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40033145
has body: Basically I am having some problem when trying to format the string I retrieved from database. Here is my nested for loop: for (int count = 0; count &lt; monthStr.length; count++) { for (int i = 0; i &lt; trans_list.size(); i++) { if (count == Integer.parseInt(trans_list.get(i).getDate())) { expensesSeries.add(x[count], trans_list.get(i) .getAmount()); } else{ expensesSeries.add(x[count], 0); } } } Basically the getDate() will return string in these format: 01,02,03,04 and so on until 12. What I am trying to do is comparing the count which is 1-12, with the string I retrieved. Is there any way to remove the 0 in front of 01,02 from the string? Thanks in advance. EDIT boolean setZero = true; String[] monthStr = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; // Creating an XYSeries for Expenses XYSeries expensesSeries = new XYSeries("Expenses"); for (int count = 1; count &lt; 13; count++) { for (int i = 0; i &lt; trans_list.size(); i++) { if (count == Integer.parseInt(trans_list.get(i).getDate())) { setZero = false; expensesSeries.add(count, trans_list.get(i) .getAmount()); } if(setZero) { expensesSeries.add(count, 0); setZero = true; } } } for (int j = 0; j &lt; monthStr.length; j++) { multiRenderer.addXTextLabel(j+1, monthStr[j]); } }
type: Question
possible better answer: http://stackoverflow.com/a/25624337
has answer: http://stackoverflow.com/a/25624312
has answer: http://stackoverflow.com/a/25624337
has title: Java Formatting String to Remove "0" in front of the variable

http://stackoverflow.com/a/25709721
type: Answer
answers question: http://stackoverflow.com/q/25709593
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/40189058
has comment: http://stackoverflow.com/comment/40188942
has comment: http://stackoverflow.com/comment/40189657
downvote count: 1
has comment: http://stackoverflow.com/comment/40188440
has body: Class MyClass should implement the Serializable interface. Then, an object of this class can be written to an ObjectOutputStream and read back from ObjectInputStream using writeObject and readObject methods (See below). On Client: Socket socket = new Socket(url, port); OutputStream os = socket.getOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(os); MyClass obj = new Myclass(); oos.writeObject(obj); int count; byte[] buffer = new byte[8192]; while ((count = in.read(buffer)) &gt; 0) { out.write(buffer, 0, count); } On server: ServerSocket sSocket = new ServerSocket(port); Socket socket = sSocket.accept(); InputStream is = socket.getInputStream(); ObjectInputStream ois = new ObjectInputStream(is); MyClass obj = (MyClass)ois.readObject(); byte arr[]; try { while(arr = (byte[])ois.readObject()) { //do something with arr } } catch(java.io.EOFException) { // End of data } If you need to send more data after the file is finished, you need a way to figure out the number of bytes the file consists of. Then, you can send the number of bytes beforehand over the socket to the server. On the server, read only that many bytes of information for the file and then do the same for the rest of the data you are going to send. This strategy of pre-sending the file size is recommended and is mostly used while doing any data transfer. If you can do that, you don't have to rely on catching java.io.EOFException to detect end of data.

http://stackoverflow.com/q/25634453
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25634575
has comment: http://stackoverflow.com/comment/40051959
type: UnansweredQuestion
has body: I am having trouble displaying the maximum number in the array. Here is my code. When I run it, it gives me maximum of 0. The rest of the code works correctly. import java.util.Scanner; public class Assignment2 { // method for the max public static int findMax(int[] numbers, int i) { int max; //max variable if(i &gt; 0) { max = numbers[0]; } else { max = 0; } for(int j = 1; j &lt; i; j++) { if(numbers[i] &gt; max) max = numbers[i]; } return max; } // method to add positive numbers public static int computePositiveSum(int[] numbers, int i) { int total = 0; //check if positive number if ( i &gt; 0) { int num = (numbers[i - 1] &gt; 0) ? numbers[i -1]:0; total = num + computePositiveSum(numbers, i - 1); return total; } else return total; } // method to count negative numbers public static int countNegative(int[] numbers, int i) { // if the first input is the same as //length there are no negative numbers if(i == numbers.length) { return 0; } // initialize the number of negatives int sum = countNegative(numbers, i + 1); if(numbers[i] &lt; 0) { sum++; } // return the number of negatives return sum; } public static void main (String[] args) { Scanner input = new Scanner(System.in); int [] numbers = new int[100]; int count = 0; boolean quit = false; //add numbers to array for( int i= 0; i&lt;numbers.length &amp; quit == false; i++) { numbers[i]=input.nextInt(); if(numbers[i] != 0) { count++; } else { quit = true;// exit by entering 0 } } System.out.println("The maximum number is " + findMax(numbers, count)); System.out.println("The sum of the positive numbers is " + computePositiveSum(numbers, count)); System.out.println("The total number of negative numbers is " + countNegative(numbers, 0)); } }
tagged with: max
tagged with: arrays
score: -3
has comment: http://stackoverflow.com/comment/40051994
answer count: 2
has comment: http://stackoverflow.com/comment/40051937
upvote count: 0
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/25634497
has title: Finding Maximum of array in java
has comment: http://stackoverflow.com/comment/40051964

http://stackoverflow.com/q/25695801
has comment: http://stackoverflow.com/comment/40164286
has body: We have a code base that uses the Hibernate implementation of JPA but that has to date only utilized the basic facilities of JPA. In particular that means we have used EntityManager instead of SessionBuilder. This approach was taken because (until now) we only needed the base JPA facilities and saw no benefit to using Hibernate constructs. However, we now need the facilities that a Hibernate Interceptor can provide and are looking for some way to implement this. We see how to obtain the Session and SessionFactory from an existing EntityManager but cannot see how to "add" an Interceptor to an existing Session(Builder). We can find numerous examples showing how to configure a SessionFactory so that upon construction of the SessionFactory it will start up with an Interceptor but how can an Interceptor be added if (through the creation of an EntiryManager) the SessionFactor already exists? Thank you. 09/09/14 EDIT: Per the link (http://nsinfra.blogspot.com/2013/10/audit-logging-using-hibernate.html) supplied by AVolpe I learned about the persistence.xml ! I added but upon deployment to JBoss 7 I get: [PersistenceUnit: PU] Unable to find interceptor class: com.MyCom.model.HibernateInterceptor. Here's HibernateInterceptor: @Stateless @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public class HibernateInterceptor extends EmptyInterceptor { HibernateInterceptor() {} ... the required overrides ... } Any idea why the class HibernateInterceptor is not being found? 09/11/14 Edit: No, no Spring here. I have altered my approach a bit, think there is some progress but now have an error. Here are the particulars: To "register" an Interceptor after the Session has started I now do this: @PersistenceContext(unitName=UtilitiesModel.JPA_PERSISTENCE_UNIT) private EntityManager em; ... SessionFactory sessionFactory = entityManager.unwrap(org.hibernate.Session.class).getSessionFactory(); Session session = sessionFactory.withOptions().interceptor(new MyInterceptor()).openSes…
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40350149
favorite count: 0
type: Question
answer count: 0
type: UnansweredQuestion
has title: How do I assign an Interceptor AFTER a SessionFactory has been created?
has comment: http://stackoverflow.com/comment/40289488
tagged with: jpa
has comment: http://stackoverflow.com/comment/40269200
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25579307
upvote count: 2
score: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25579293
has body: if (thisLine.trim().isEmpty())

http://stackoverflow.com/comment/39964383
comment on: http://stackoverflow.com/a/25586780
type: AnswerComment
score: 2
has text: The question refers to the InputStream API, but this answer relates to Reader API. The former works with bytes, the latter with characters.
type: Comment

http://stackoverflow.com/q/25644283
tagged with: twitter
has comment: http://stackoverflow.com/comment/40095854
tagged with: struts2
score: 0
has comment: http://stackoverflow.com/comment/40093270
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40071486
has body: i was create twitter API key, secret key, access token, access token secret key... then i was tried to post simple text on twitter wall by using java... i was used twitter4j API for this... But its not working properly.. i got this error when i run my program.. "** 401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync.**"....and my code is.. static String consumerKeyStr = ""; static String consumerSecretStr = ""; static String accessTokenStr = ""; static String accessTokenSecretStr = ""; public String postSomething() throws Exception { Twitter twitter = new TwitterFactory().getInstance(); twitter.setOAuthConsumer(consumerKeyStr, consumerSecretStr); AccessToken accessToken = new AccessToken(accessTokenStr, accessTokenSecretStr); twitter.setOAuthAccessToken(accessToken); twitter.updateStatus("Post using Twitter4J Again"); System.out.println("Successfully updated the status in Twitter."); return "success"; }
has title: post message on twitter wall using java
type: Question
tagged with: java

http://stackoverflow.com/a/25570114
type: Answer
answers question: http://stackoverflow.com/q/25569748
score: 0
has body: create res/layout/preference.xml <?xml version="1.0" encoding="utf-8"?> change in your activity package zabolotnii.pavel.timer; import android.os.Bundle; import android.preference.PreferenceActivity; public class SoundSelect extends PreferenceActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.preference); addPreferencesFromResource(R.layout.sound_select); } }

http://stackoverflow.com/q/25633646
downvote count: 3
answer count: 1
accepted answer: http://stackoverflow.com/a/25633770
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25633770
has comment: http://stackoverflow.com/comment/40050652
has body: I want to start learning Android app development and was wondering whether I should start with an online school like treehouse or code academy (if so, which one would be the best) or just by using Google's tutorials. I have pretty decent knowledge with Java. I've never used an online school before, so I don't know how and what they teach. Which is why I'm asking here.
tagged with: android
has title: Best way to start learning Android development?
type: AnsweredQuestion
upvote count: 3
score: 0
tagged with: java

http://stackoverflow.com/comment/40225094
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25704527
has text: ok got it working finally. It seems, my log4j was corrupted it seems. Got an error while running from cmd line `log4j-1.2.17.jar; invalid LOC header (bad signature)` downloaded again and it worked! :facepalm:

http://stackoverflow.com/a/25708453
downvote count: 0
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25705860
answers question: http://stackoverflow.com/q/25705860
has body: The struts.xml configuration file should be in the source folder, such as src or resources. When you build the application the compiled output directed to WEB-INF/classes. You can check this file exists before you deploy or start a server with already deployed web application. FYI, the convention plugin doesn't replace the XWork configuration, but extend it with possibility to override. The struts.xml is used by the same purpose, but using different configuration provider. So, configuring interceptors using convention plugin make sure you use the right parent package that contains your custom interceptor.
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/40108869
comment on: http://stackoverflow.com/q/25666293
score: 1
type: Comment
type: QuestionComment
has text: `Integer.toBinaryString()`?

http://stackoverflow.com/a/25551952
has comment: http://stackoverflow.com/comment/40038296
type: Answer
accepted answer of: http://stackoverflow.com/q/25551374
has comment: http://stackoverflow.com/comment/39901831
has comment: http://stackoverflow.com/comment/40037632
has comment: http://stackoverflow.com/comment/39902127
has comment: http://stackoverflow.com/comment/39931658
has comment: http://stackoverflow.com/comment/39928463
upvote count: 1
score: 1
type: AcceptedAnswer
has body: The HTTP/406 error is due to the fact that the document object can't be mapped to the response body. You will need to make sure you are using &lt;mvc:annotation-driven /&gt; in your XML configuration or the similar construct under JavaConfig style. EDIT I have implemented a quick and VERY dirty application to demonstrate what I am talking about: https://github.com/djgraff209/domconversion See if that meets your needs - be advised it is VERY rough and is only to demonstrate the technology.
downvote count: 0
has comment: http://stackoverflow.com/comment/39900496
has comment: http://stackoverflow.com/comment/40218711
has comment: http://stackoverflow.com/comment/39901350
has comment: http://stackoverflow.com/comment/39905037
has comment: http://stackoverflow.com/comment/39901456
answers question: http://stackoverflow.com/q/25551374
has comment: http://stackoverflow.com/comment/39900220
has comment: http://stackoverflow.com/comment/40064840

http://stackoverflow.com/comment/40179287
type: AnswerComment
has text: @JBNizet That's not true. I had the same JAR File with an `Object[Input|Output]Stream` in it running on Linux and Windows, and the files created on one OS didn't run on the other one with the Exception that those `serialVersionUID` didn't matched
type: Comment
comment on: http://stackoverflow.com/a/25704669
score: 0

http://stackoverflow.com/comment/40061669
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25639881
type: Comment
has text: @WilQu The cast is neccessary, try it yourself. @sp00m I would improve your answer by moving the `@SuppressWarnings` to the `if` branch to make it clear we only want to suppress warnings in that branch and not in the whole method because the rest of the method is ok.

http://stackoverflow.com/comment/40117534
score: 0
has text: @Crawler I do not think adding an `UncaughtExceptionHandler` improves anything: the `ShutdownHook` registered by JUnique already ensures a lock is removed before the application/JVM stops (without crashing).
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25569034

http://stackoverflow.com/a/25624576
score: 4
has comment: http://stackoverflow.com/comment/40057142
has body: The Apache Felix framework implements the OSGi core specification and not more. Equinox also implements the OSGi core specification. You are asking if the sub-projects of Apache Felix (EventAdmin, SCR, ...) could be used inside Equinox. The answer is YES. You can use many of the sub-projects (if not all) inside Equinox as they rely only on the core specification. It might be confusing that they are called "Felix ...". They could be called anything else as they have nothing to do with the container implementation, only with the specification that both Felix and Equinox implement. Btw.: Some of the sub-projects implement chapters from OSGi Compendium Specification. If others implement the same chapters exactly, they should be switchable without a problem.
has comment: http://stackoverflow.com/comment/40033691
has comment: http://stackoverflow.com/comment/40034065
type: Answer
accepted answer of: http://stackoverflow.com/q/25623285
upvote count: 4
answers question: http://stackoverflow.com/q/25623285
has comment: http://stackoverflow.com/comment/40034105
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39998181
score: 0
type: QuestionComment
has text: post your url string
comment on: http://stackoverflow.com/q/25605206
type: Comment

http://stackoverflow.com/q/25625508
tagged with: java
upvote count: 1
downvote count: 1
favorite count: 0
has body: I have implemented a small java application using Weka lib with Random Forest. I have trained some classifiers with a sample data and getting a good accuracy of around 85%. However, when i used theFast Random Forest (https://code.google.com/p/fast-random-forest/) it starts throwing error(s). I have implemented the Fast Random Forest and build it with current jar files. However, it keeps giving the following error when we evaluate the classifier on Training Data: "The method evaluateModel(Classifier, Instances, Object...) in the type Evaluation is not applicable for the arguments (FastRandomForest, Instances) " For this current code: FastRandomForest rTree = new FastRandomForest(); rTree.buildClassifier(trainingData); showTree(rTree); System.out.println("records: " + trainingData.attribute(classIndex)); System.out.println("number of instances: " + trainingData.numInstances()); System.out.println(trainingData.instance(1)); System.out.println("target: " + trainingData.classAttribute()); //System.out.println(rTree.classifyInstance(trainingData.instance(1))); /* Evaluate the classifier on Training data */ Evaluation eTest = new Evaluation(trainingData); eTest.evaluateModel(rTree, trainingData); String strSummary = eTest.toSummaryString(); System.out.println(strSummary); Help appreciated!!
has comment: http://stackoverflow.com/comment/40035618
has comment: http://stackoverflow.com/comment/40035405
has answer: http://stackoverflow.com/a/25625998
type: Question
tagged with: algorithm
tagged with: random-forest
type: UnansweredQuestion
answer count: 1
has title: Fast Random Forest Algorithm Implementation
tagged with: weka
score: 0

http://stackoverflow.com/a/30075853
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25667380
has body: Solution to above query: A full fledged MDM profile is first installed on the device with Identifier as: PayloadIdentifier com.myprofile.mdm.version1.mdm3 PayloadType com.apple.mdm this payload contains other details which are not specified here. To apply policies and wifi configurations on the device a different profile is installed with identifier as below: PayloadRemovalDisallowed <true/> PayloadIdentifier com.myprofile.mdm.version1.mdm3.configuration PayloadType Configuration keeping the PayloadRemovalDisallowed true as user should not be able to remove this configuration profile. whenever the mdm profile is removed this profile is automatically removed and all the policies are removed. When there is a change in the policy or wifi the latest policies and wifi are pushed on the device and installed.

http://stackoverflow.com/comment/40036695
comment on: http://stackoverflow.com/a/25625690
type: Comment
type: AnswerComment
has text: The iterator may even not cost anything; depending on the collection implementation iterated it may return you a shared instance (Collections.emptyIterator()).
score: 1

http://stackoverflow.com/comment/39925451
type: Comment
has text: The problem with that: I don't have a control over the object. It is sent to me from a colleague and I can't change it because there will be other files like this. Also, the file contains 150k of these.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25565406

http://stackoverflow.com/q/25641985
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am creating on Json from one java object and convert it to string format this code new JSONObject(responseDTO.getDTOHeader()).toString(); But results with string with unexpected characters.For example "{\"languageID\":0,\"test1\":14,\"loginID\":\"LKS280\",\"errorCategory\":0,\"replyTopic\":null,\"errorCode\":0,\"sessionType\":null,\"sessionKey\":\"LKS2801409739957847\",\"creationTime\":\"Wed Sep 03 15:55:57 IST 2014\",\"messageType\":3,\"version\":\"1.0.0\"} How can I exclude \"
answer count: 1
has comment: http://stackoverflow.com/comment/40065055
accepted answer: http://stackoverflow.com/a/25642511
type: Question
has comment: http://stackoverflow.com/comment/40064897
has answer: http://stackoverflow.com/a/25642511
has comment: http://stackoverflow.com/comment/40065142
has comment: http://stackoverflow.com/comment/40064798
has comment: http://stackoverflow.com/comment/40069132
has comment: http://stackoverflow.com/comment/40065108
has title: converting object to string in java and excluding unnecessary characters
has comment: http://stackoverflow.com/comment/40064817
type: AnsweredQuestion

http://stackoverflow.com/a/25554655
answers question: http://stackoverflow.com/q/25554373
upvote count: 1
type: Answer
has body: Yes, absolutely. Jackson will automatically do a two-way mapping of entities, so if you want to POST something to the server just use the same JSON format that you see when you do GET.
score: 1
downvote count: 0

http://stackoverflow.com/comment/39992834
type: AnswerComment
comment on: http://stackoverflow.com/a/25601913
score: 0
type: Comment
has text: Yes, that's true, but it might well be the EDT violation.

http://stackoverflow.com/q/25627050
tagged with: linphone
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25679357
tagged with: java
has comment: http://stackoverflow.com/comment/40038442
has comment: http://stackoverflow.com/comment/40061392
answer count: 1
has comment: http://stackoverflow.com/comment/40039592
has title: Application stops responding when using Process.waitFor()
type: Question
has comment: http://stackoverflow.com/comment/40041412
accepted answer: http://stackoverflow.com/a/25679357
tagged with: processbuilder
has comment: http://stackoverflow.com/comment/40038372
has comment: http://stackoverflow.com/comment/40038202
has body: I'm launching an external application from within my Java application (8u11). However the application becomes non-responsive to UI input up under Windows XP and Windows 7 with the standard hour glass/spinner. I've narrowed this problem down to whether or not I use Process.waitFor(). If I call it I see the problems, if I don't it works fine. Also the application un-freezes if I then quit the Java application. My question is why is this the case - how can calling waitFor() possibly effect the internal runnings of a child process? And how can I avoid this problem? The application in question is LinPhone.exe but I don't believe the issue is specific to the application - there must be some general way in which it handles standard IO etc which the way I'm interfering with by calling waitFor(). I need to use Process.waitFor() so I can track when the application has exited. I've simplified the issue to this SCCEE. import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; public class LinphoneTest { public static void main(String[] args) throws IOException, InterruptedException { String phoneAppPath = "C:\\Program Files\\Linphone\\bin\\linphone.exe"; ProcessBuilder processBuilder = new ProcessBuilder(phoneAppPath); // move up from bin/linephone.exe File workingDir = new File(phoneAppPath).getParentFile() .getParentFile(); processBuilder.directory(workingDir); processBuilder.redirectErrorStream(); Process process = processBuilder.start(); final BufferedReader stdout = new BufferedReader( new InputStreamReader(process.getInputStream())); String line = null; try { while (((line = stdout.readLine()) != null)) { System.out.println(line); } } catch (IOException e) { e.printStackTrace(); } new Thread(() -&gt; { try { process.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } }, "process wait").start(); Thread.sleep(Long.MAX_VALUE); } }

http://stackoverflow.com/comment/39903762
comment on: http://stackoverflow.com/q/25554239
type: Comment
type: QuestionComment
has text: my code isn't working. It has nullpointer on the onCreateView part.
score: 0

http://stackoverflow.com/comment/39953488
type: AnswerComment
has text: Your second point is completely incorrect. Desktop code will usually run in a standard JRE (Java Runtime) while Android runs a custom runtime called Dalvik (and in the future ART - Android Runtime). This can also have a dramatic impact on execution speed as they are tailored to different design goals.
type: Comment
comment on: http://stackoverflow.com/a/25575455
score: 0

http://stackoverflow.com/comment/40175535
type: AnswerComment
comment on: http://stackoverflow.com/a/25675834
type: Comment
has text: Hello, my internet connection was down... You were right, the spinner was null because I'm trying to using it before creating it. I'll post where I placed that code.
score: 0

http://stackoverflow.com/q/25650287
upvote count: 2
answer count: 2
downvote count: 0
type: UnansweredQuestion
tagged with: apache-kafka
type: Question
tagged with: java
has title: Apache camel and kafka integration
has body: I was trying to test camel integration with kafka as explained here Following is my code public class KafkaTest { public static void main(String args[]) throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(new RouteBuilder() { public void configure() { from("kafka:test?zkConnect=localhost:2181&amp;metadataBrokerList=localhost:9092") .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { System.out.println(exchange.getIn().getBody()); } }) .end(); } }); context.start(); while (true) { } } } However, I am getting the following error Exception in thread "main" org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[[From[kafka:test?zkConnect=localhost:2181&amp;amp;... because of Failed to resolve endpoint: kafka://test?amp%3BmetadataBrokerList=localhost%3A9092&amp;zkConnect=localhost%3A2181 due to: Failed to resolve endpoint: kafka://test?amp%3BmetadataBrokerList=localhost%3A9092&amp;zkConnect=localhost%3A2181 due to: There are 2 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{metadataBrokerList=localhost:9092, zkConnect=localhost:2181}] Please suggest what could be missing.
tagged with: apache-camel
has answer: http://stackoverflow.com/a/25652831
has answer: http://stackoverflow.com/a/42298085
favorite count: 0
score: 2

grails
tags question: http://stackoverflow.com/q/25688037
tags question: http://stackoverflow.com/q/25615662
tags question: http://stackoverflow.com/q/25563201
tags question: http://stackoverflow.com/q/25632061
tags question: http://stackoverflow.com/q/25565448
tags question: http://stackoverflow.com/q/25623286
tags question: http://stackoverflow.com/q/25581653
tags question: http://stackoverflow.com/q/25641210
tags question: http://stackoverflow.com/q/25566851
type: Tag
tags question: http://stackoverflow.com/q/25652298
tag name: grails
tags question: http://stackoverflow.com/q/25664331
tags question: http://stackoverflow.com/q/25555831
tags question: http://stackoverflow.com/q/25566114
tags question: http://stackoverflow.com/q/25703551

nested
tags question: http://stackoverflow.com/q/25610290
tag name: nested
type: Tag
tags question: http://stackoverflow.com/q/25645760
tags question: http://stackoverflow.com/q/25712029
tags question: http://stackoverflow.com/q/25625926
tags question: http://stackoverflow.com/q/25609978
tags question: http://stackoverflow.com/q/25709103

http://stackoverflow.com/a/25566890
score: 1
has body: I found where I have made my mistake, to call a closure instead of: def res = fun(list1, 10) It should be: def res = fun.call(list1, 10) And everything works fine for me :)
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25566114
type: Answer
has comment: http://stackoverflow.com/comment/39933596
accepted answer of: http://stackoverflow.com/q/25566114

http://stackoverflow.com/comment/43458321
has text: The OP is not interested in using SLF4J, they just want to change the logging level.
score: 0
comment on: http://stackoverflow.com/q/25650027
type: Comment
type: QuestionComment

web-inf
type: Tag
tag name: web-inf
tags question: http://stackoverflow.com/q/25686704
tags question: http://stackoverflow.com/q/25627990

http://stackoverflow.com/a/25684717
downvote count: 0
has body: Will this closes bin also ? The enclosed stream can't close the enclosing stream because it doesn't know about it. If not, is there any need to do so? ie : will it cause a memory leak ? It will not cause a memory leak because the resources are allocated / held by the enclosed stream and are freed properly when it is closed, but the enclosing stream may implement buffering and other translation logic which if not flushed or closed, the data actually written to the enclosed stream might be incomplete/corrupt. So it is always recommended to flush the enclosing stream (preferred would be to close that, but if you can't, the minimum you should do is flush it). Flushing the enclosing stream is not always enough because for the underlying stream to contain valid data, the enclosing stream might add additional padding or formatting. An example for this is ZipOutputStream which in order to provide a valid zip file (zip format), it provides the ZipOutputStream.finish() method which besides flushing also writes additional zip-file related data (and does not close the underlying stream). You might find this useful: Close Encapsulating Writers/Streams for ServletOutputStream
accepted answer of: http://stackoverflow.com/q/25684558
upvote count: 2
answers question: http://stackoverflow.com/q/25684558
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/comment/40005274
type: Comment
has text: Have a look at this: http://stackoverflow.com/questions/5113437/get-back-key-event-on-edittext
type: QuestionComment
comment on: http://stackoverflow.com/q/25608905
score: 0

http://stackoverflow.com/comment/40134033
comment on: http://stackoverflow.com/a/25678201
score: 0
type: Comment
has text: What do you mean by `action`?
type: AnswerComment

http://stackoverflow.com/comment/40146882
has text: why not java -jar C:\tmp\lib\indices-0.0.2-SNAPSHOT.jar ?
score: 0
comment on: http://stackoverflow.com/q/25687229
type: Comment
type: QuestionComment

webview
tags question: http://stackoverflow.com/q/25699206
tags question: http://stackoverflow.com/q/25599275
tags question: http://stackoverflow.com/q/25574740
type: Tag
tags question: http://stackoverflow.com/q/25708825
tag name: webview
tags question: http://stackoverflow.com/q/25566553
tags question: http://stackoverflow.com/q/25658700
tags question: http://stackoverflow.com/q/25661381
tags question: http://stackoverflow.com/q/25645891
tags question: http://stackoverflow.com/q/25567398
tags question: http://stackoverflow.com/q/25604756
tags question: http://stackoverflow.com/q/25663801
tags question: http://stackoverflow.com/q/25639670
tags question: http://stackoverflow.com/q/25605835
tags question: http://stackoverflow.com/q/25602117
tags question: http://stackoverflow.com/q/25591247

http://stackoverflow.com/q/25568536
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39947905
linked to: http://stackoverflow.com/q/8237193
has comment: http://stackoverflow.com/comment/39930215
type: Question
accepted answer: http://stackoverflow.com/a/25568580
score: 0
has title: ParseException parsing string to date
has body: Hi I am trying to parse a string to a date but it is throwing the exception java.text.ParseException: Unparseable date: "1409239380000" (at offset 13). Here is my code: String text="1409239380000"; try{ SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date1=dateFormat.parse(text); }catch(Exception e){ Log.e("Error final:", e.toString()); }
has answer: http://stackoverflow.com/a/25568580
has comment: http://stackoverflow.com/comment/39930175
answer count: 1
has comment: http://stackoverflow.com/comment/39930227

http://stackoverflow.com/comment/40116009
has text: There is just one `Log` file and your application is writing to it. There is no such solution to have a separate log file for each client (although you can implement it but that is not the purpose of log files)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25669574
type: Comment

http://stackoverflow.com/comment/40251746
type: QuestionComment
has text: There is an ArrayList variable in ScheduleListAdapter `private ArrayList<Schedule> mItems = new ArrayList<Schedule>(); ` but I suck at Java and do not know how to use it.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25700806

http://stackoverflow.com/comment/40177886
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25703814
has text: But '*' will match everything that was matched with '?', so I don't see any reason to use '?' in this case

http://stackoverflow.com/comment/63028240
has text: P.P.S. Excluding embedded tomcat (spring-boot-starter-tomcat) fixed the issue it seems.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/28419217
type: AnswerComment

http://stackoverflow.com/comment/40108845
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25643456
has text: Are you saying that you have not mapped any of the associations between your domain objects? Or have you merely omitted them from your question?
type: Comment

http://stackoverflow.com/a/25675194
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25674733
has body: You got a NPE in your test and being a RuntimeException the TransactionalTestExecutionListener has caught it and rollback your current executing transaction. Since I don't see any DBUnit or any other code to insert a User with id=1, I can only assume you don't have an User in your database and that's why the: session.get(UserAccount.class, id); returns null. Try changing this: System.out.println("Hello User: " + other.getUsername()); to if(other != null) { System.out.println("Hello User: " + other.getUsername()); } else { System.out.println("No User found for id : 1 "); }
has comment: http://stackoverflow.com/comment/40126207
type: Answer
accepted answer of: http://stackoverflow.com/q/25674733
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/39930271
score: 0
type: Comment
type: AnswerComment
has text: have you put the final syso outside of the bracket as seen in brunos code? @user2941841
comment on: http://stackoverflow.com/a/25568358

http://stackoverflow.com/a/76056765
type: Answer
has body: You can use a *.symlink file. It works too, and it is simple to create. Here is a short Java snippet to create a *.symlink file: // Link target Path targetPath = Path.of("C:/Windows/System32/calc.exe"); // Link destination // You can replace Calculator with your own file name (without extension). Path linkPath = Path.of(System.getProperty("user.home") + "/Desktop/Calculator"); Files.createSymbolicLink(linkPath, targetPath);
answers question: http://stackoverflow.com/q/25652249
score: 2
downvote count: 0
upvote count: 2

apache-pig
tags question: http://stackoverflow.com/q/25550939
tags question: http://stackoverflow.com/q/25601779
tag name: apache-pig
type: Tag

http://stackoverflow.com/a/25605818
has body: Try this View mView = findViewById(R.id.my_view) layout.setLayoutParams(new LinearLayout.LayoutParams(100,100));
answers question: http://stackoverflow.com/q/25603267
type: Answer
score: 0

http://stackoverflow.com/a/25631933
has comment: http://stackoverflow.com/comment/40073865
has body: Here would be a generic way to read columns from a ResultSet. while (resultSet.next()) { //Read every row int columnCount = resultSet.getMetaData().getColumnCount(); for (int column = 1; column &lt;= columnCount; column++) { //Read every column String columnName = resultSet.getMetaData().getColumnName(column); Object value = resultSet.getObject(columnName); if (value != null) { doSomething(columnName, value); } } }
accepted answer of: http://stackoverflow.com/q/25631839
has comment: http://stackoverflow.com/comment/40079627
type: Answer
answers question: http://stackoverflow.com/q/25631839
upvote count: 2
score: 2
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39915745
comment on: http://stackoverflow.com/q/25560659
score: 0
has text: Because it happens at runtime??
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40078967
has text: Read this tutorial if you want to appreciate the power of higher levels of abstraction: http://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html
comment on: http://stackoverflow.com/q/25648852
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40006998
has text: the error is occurring at z[c]=x[i]; and arrayTest(x,y);
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25609978
type: Comment

http://stackoverflow.com/comment/39938548
comment on: http://stackoverflow.com/q/25572376
type: QuestionComment
score: 0
has text: what are your java heap settings? can your machine allocate more memory for your java application?
type: Comment

http://stackoverflow.com/comment/40121558
type: Comment
type: AnswerComment
has text: You said "native implementation of start must do, ie. invoke this.notifyAll()".i think notifyall should we called after joined thread's run() has completed and run will execute only when start has completed.so where will notifyall() get called from?
comment on: http://stackoverflow.com/a/25672797
score: 0

http://stackoverflow.com/q/25654556
favorite count: 0
has comment: http://stackoverflow.com/comment/40088454
has body: For some reason, whenever I compile and run this code I get correct answers on what the lowest number in the array is. UNLESS I type in 10, -2, and -1. At this point, it gives me -1 as the smallest number when instead it should be -2. It seems the first number doesn't seem to matter much so long as it is positive. It seems like the program is reading the array wrong, but I'm not sure how to change it. import java.util.Scanner; public class Problem { public static void main(String[] arg) { Scanner scan = new Scanner(System.in); System.out.println("Insert three integers, USER."); int x = scan.nextInt(); int y = scan.nextInt(); int z = scan.nextInt(); //returns smallest, tried to keep code short with arrays int array[] = new int[]{x,y,z}; int small = array[0]; int box=2; if (array[box]&lt;small) { small = array[box]; } I think it has something to do with int small = array[0]; because whenever I change it it sort of skews the problem to other numbers. Like the program is reading only a certain group of integers and ignoring the rest.
type: Question
type: UnansweredQuestion
tagged with: arrays
score: -3
has comment: http://stackoverflow.com/comment/40088460
has comment: http://stackoverflow.com/comment/40088515
has answer: http://stackoverflow.com/a/25654669
downvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/25654660
has answer: http://stackoverflow.com/a/25654655
tagged with: java
has comment: http://stackoverflow.com/comment/40088499
has title: Program not counting -2 at the smallest integer when in the array 10,-2,-1
upvote count: 1

http://stackoverflow.com/comment/40193624
type: AnswerComment
has text: Well that´s a lot of work. You better start small. I don´t know too much about cameras, sorry. Experiment with 1 single filter before you go that big.
comment on: http://stackoverflow.com/a/25710780
type: Comment
score: 0

http://stackoverflow.com/a/25620746
upvote count: 2
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25615330
has body: You should update the scope section for the dependencies ,which you want to exclude in the war file. provided provided scope indicates the dependency will be present during compilation,but will not be included in war file. For more information you can refer :- http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html And for the maven related jar you can exclude them using below. WEB-INF/lib/*.jar

http://stackoverflow.com/a/33882732
downvote count: 1
answers question: http://stackoverflow.com/q/25598497
score: 0
type: Answer
upvote count: 1
has body: Your program is correct, I just tested it in Python. from math import * def testPrime(num): #Takes a number as an argument if num &lt; 2: return False if (num == 2): return True else: for aNum in range(2, num): if (int)(num % aNum == 0): return False return True # Allow user to enter input c = 1 sum = 0 sumPrimes = 0 while (c &lt; 100): if (testPrime(c)): print(c) sum = sum + log(c) sumPrimes = sumPrimes + c c = c + 1 print("Sum of log quotient:", sum/c) print(sumPrimes) A good way to test your program is to manually add up a set of the first few primes (2, 3, 5). The answer to this is easy, input it into your program and examine the output. Here is my output: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 Sum of log quotient: 0.8372839039906392 1060 The ratio of the prime numbers to their log quotient should approach 1, but should never exceed it (An interesting tidbit).

http://stackoverflow.com/comment/39966710
type: Comment
has text: You must use an additional data structure to parse and evaluate your `String` like a stack.
type: QuestionComment
comment on: http://stackoverflow.com/q/25588041
score: 0

http://stackoverflow.com/comment/39952768
type: QuestionComment
comment on: http://stackoverflow.com/q/25580302
score: 0
has text: conents? what does that means?
type: Comment

http://stackoverflow.com/comment/40186332
comment on: http://stackoverflow.com/q/25707636
score: 0
type: Comment
type: QuestionComment
has text: If you want to validate your keys, add a hash of the unencrypted string to it and validate the output of your decrypt method with it

lucene
tags question: http://stackoverflow.com/q/25558195
tags question: http://stackoverflow.com/q/25628317
tags question: http://stackoverflow.com/q/25619702
type: Tag
tags question: http://stackoverflow.com/q/25604218
tag name: lucene
tags question: http://stackoverflow.com/q/25642287
tags question: http://stackoverflow.com/q/25684127
tags question: http://stackoverflow.com/q/25646630
tags question: http://stackoverflow.com/q/25667175
tags question: http://stackoverflow.com/q/25643617
tags question: http://stackoverflow.com/q/25586021
tags question: http://stackoverflow.com/q/25623265
tags question: http://stackoverflow.com/q/25659008

http://stackoverflow.com/a/25711915
downvote count: 1
answers question: http://stackoverflow.com/q/25711828
score: 1
type: Answer
has body: You cannot override a private method. You must declare it default, protected or public for the behaviour that you want. I suggest reading the Java documentation on access modifiers
upvote count: 2

http://stackoverflow.com/a/25675180
upvote count: 1
answers question: http://stackoverflow.com/q/25675173
type: Answer
has body: this.numbers [] = {6, 3, 8, 9, 1, 4, 7}; is invalid, numbers is of type int, not an array even if it was an array you just do it this.numbers = new int[] {6, 3, 8, 9, 1, 4, 7};
score: 1
downvote count: 0

http://stackoverflow.com/comment/40113723
has text: I'm not removing that element I'm just changing it value to something the user won't guess (which in this case is -1). Its the same thing right?
type: QuestionComment
comment on: http://stackoverflow.com/q/25668707
score: 0
type: Comment

http://stackoverflow.com/comment/40069601
type: QuestionComment
comment on: http://stackoverflow.com/q/25644620
has text: are you sure that file contains this string?
score: 0
type: Comment

http://stackoverflow.com/comment/135016390
type: AnswerComment
has text: Well yes but the same applies to `Parent`.
score: 0
comment on: http://stackoverflow.com/a/25667062
type: Comment

hapi
tags question: http://stackoverflow.com/q/25709788
type: Tag
tag name: hapi

http://stackoverflow.com/q/25553470
tagged with: java
has title: What's a regex that matches all numbers except 1, 2 and 25?
tagged with: regex-negation
has comment: http://stackoverflow.com/comment/39903066
has comment: http://stackoverflow.com/comment/39902018
has answer: http://stackoverflow.com/a/25553838
has body: There's an input of strings that are composed of only digits, i.e., integer numbers. How can I write a regular expression that will accept all the numbers except numbers 1, 2 and 25? I want to use this inside the record identification of BeanIO (which supports regular expressions) to skip some records that have specific values. I reach this point ^(1|2|25)$, but I wanted the opposite of what this matches.
accepted answer: http://stackoverflow.com/a/25553510
possible better answer: http://stackoverflow.com/a/25553522
has answer: http://stackoverflow.com/a/25553530
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25553510
tagged with: bean-io
has comment: http://stackoverflow.com/comment/39902030
score: 14
has comment: http://stackoverflow.com/comment/39902936
has answer: http://stackoverflow.com/a/25553522
linked to: http://stackoverflow.com/q/3977455
tagged with: regex
upvote count: 18
answer count: 4
type: AnsweredQuestion
downvote count: 4

http://stackoverflow.com/a/25695169
type: Answer
has comment: http://stackoverflow.com/comment/40238002
has comment: http://stackoverflow.com/comment/40162190
has comment: http://stackoverflow.com/comment/40162204
has comment: http://stackoverflow.com/comment/40165326
has comment: http://stackoverflow.com/comment/40162246
has comment: http://stackoverflow.com/comment/40213423
answers question: http://stackoverflow.com/q/25695011
has body: Update: this answer got way more attention and upvotes than I think it deserved for basically copy-pasting JDK source code, so I'm going to try to turn it into something worthy. Java generics are designed to look and feel like true, reified, multi-instantiated, C++- or C#-style generics. That means that for a type like ArrayList&lt;E&gt;, we expect ArrayList&lt;String&gt; to behave like every occurrence of E has been replaced with String. In other words, this: private Object[] elementData = new Object[size]; public E get(int i) { return (E) elementData[i]; } String str = list.get(0); ought to become this: private Object[] elementData = new Object[size]; public String get(int i) { return (String) elementData[i]; } String str = list.get(0); Now, as you probably know, that's not actually how they work. For backwards-compatibilty reasons that are now (mostly) long behind us, Java generics are implemented via type erasure, where E is actually replaced with Object everywhere, and casts to String are inserted into the calling code where necessary. That means the code actually becomes something like this: private Object[] elementData = new Object[size]; public Object get(int i) { return elementData[i]; } String str = (String) list.get(0); The cast to (E) has disappeared, and reappeared at the call site. If the call site had ignored the result, the cast would have vanished completely! This is why it gave an "unchecked" warning. Now imagine if elementData had type E[] instead, as you suggest. That is, the code looked like this: private E[] elementData = (E[]) new Object[size]; public E get(int i) { return elementData[i]; } String str = list.get(0); We know it gets transformed into the same thing as above, due to erasure. But if we had reified generics like we wish we did, it would look like this: private String[] elementData = (String[]) new Object[size]; // ClassCastException: Object[] is not a String[] Essentially we've written some code that should crash at runtime, and th…
has comment: http://stackoverflow.com/comment/40228581
upvote count: 17
score: 17
accepted answer of: http://stackoverflow.com/q/25695011
has comment: http://stackoverflow.com/comment/40236569
has comment: http://stackoverflow.com/comment/40228523
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40162587
has comment: http://stackoverflow.com/comment/40162245
downvote count: 0

http://stackoverflow.com/q/25683038
tagged with: android
tagged with: android-notifications
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25701009
tagged with: notifications
has body: I was wondering the other day if it was possible to use the service to keep active sockets, until the destruction of the service? It 'a very interesting thing that I have not learned well, plus you could add a notification that indicates the status of connection to the socket. Does anyone have examples to show you if only to understand how a service should be built with the socket? I thank you in advance ps: I looked on StackOverflow but I have not found much explanatory examples
has answer: http://stackoverflow.com/a/25701009
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
tagged with: sockets
has title: Socket in Service + Notification

http://stackoverflow.com/q/25605626
has comment: http://stackoverflow.com/comment/40124939
score: 3
tagged with: spring-boot
answer count: 3
tagged with: java
has body: I trying my hand out in Spring boot exception handling . I have created a REST application and the application works for all valid url. I am trying to handle the exceptions for invalid url. But if i try hitting the application with an invalid url , i am getting the below exception:- 13:04:02.940 [http-bio-8081-exec-3] INFO o.s.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcherServlet': initialization completed in 44 ms 13:04:03.177 [http-bio-8081-exec-3] ERROR o.s.boot.context.web.ErrorPageFilter - Cannot forward to error page for/sample/processgetMessage5 (response is committed), so this response may have the wrong status code java.lang.IllegalStateException: Cannot forward after response has been committed at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:348) ~[catalina.jar:7.0.55] at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338) ~[catalina.jar:7.0.55] at org.springframework.boot.context.web.ErrorPageFilter.handleErrorStatus(ErrorPageFilter.java:123) [spring-boot-1.1.4.RELEASE.jar:1.1.4.RELEASE] at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:104) [spring-boot-1.1.4.RELEASE.jar:1.1.4.RELEASE] at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:89) [spring-boot-1.1.4.RELEASE.jar:1.1.4.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.55] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.55] Being new to spring boot I am not able to figure out the reason. Any pointers or suggestion will be helpful. Wanted to try out the options mentioned in this siteenter link description here, once i am able to remove the exception. Any pointers on how to handle 404 with annotations in spring 4 will be very helpful. Trying out the below code :- @Configuration @EnableWebMvc @EnableSwagger…
has comment: http://stackoverflow.com/comment/40034718
has title: Error while Handling 404 error for Spring Boot REST application
tagged with: spring-mvc
type: Question
has answer: http://stackoverflow.com/a/25605810
has answer: http://stackoverflow.com/a/25610286
tagged with: spring-4
upvote count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/25605810
accepted answer: http://stackoverflow.com/a/25805387
favorite count: 0
has comment: http://stackoverflow.com/comment/40105773
has answer: http://stackoverflow.com/a/25805387
type: AnsweredQuestion

http://stackoverflow.com/comment/40031820
has text: In that case, try to run the application from the command line and pass the file to open as argument. If you see an error, let us know the exact error message.
comment on: http://stackoverflow.com/a/25618097
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40192521
has text: Write your abstraction layer according to what your DOMAIN wants, not the implementation. Switching HTTP adapters then comes as easy as swapping out any class
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25709538

http://stackoverflow.com/q/25626031
accepted answer: http://stackoverflow.com/a/25626327
has title: Open a PowerPoint file contained in a JAR file
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40036463
score: 0
has comment: http://stackoverflow.com/comment/40036620
has answer: http://stackoverflow.com/a/25626327
has body: One of my resource files is a PowerPoint presentation and I want to open the presentation with PowerPoint. If I run the code in Eclipse everything works fine but if I run the executable .jar with java -jar jarname.jar, PowerPoint says it can not read the file. Is it possible to read packed resource files? Or is only the executing jar able to read these files? If so what would you do? Write the file in a temp folder? Absolute path to presentation if I run in eclipse: C:\Users\RPR\workspace\CommandLineExecuter\bin\blaa.pptx Absolute path to presentation if I run the executable jar: C:\Users\RPR\workspace\CommandLineExecuter\file:\C:\Users\RPR\workspace\CommandLineExecuter\CommandLineExecuter.jar!\blaa.pptx PowerPoint is not able to read the file even if I hardcode the path to C:\Users\RPR\workspace\CommandLineExecuter\CommandLineExecuter.jar!\blaa.pptx Code where I load the resource: File presentation = new File(CommandLineExecuter.class.getResource( "/blaa.pptx").getFile()); ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c", "cd &amp; \"C:\\Program Files\\Microsoft Office\\Office15\\POWERPNT.exe\ " + presentation.getAbsolutePath());
tagged with: java
answer count: 1
type: Question
tagged with: resources
has comment: http://stackoverflow.com/comment/40036283
has comment: http://stackoverflow.com/comment/40036829

http://stackoverflow.com/q/25691455
downvote count: 0
has answer: http://stackoverflow.com/a/25694537
favorite count: 0
type: Question
score: 3
has body: I have a log4j2.xml file which is not being picked by Ant's build.xml. So, I keep getting the following error message in Eclipse console - ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. My build.xml file is very simple. (pasted below) I copied it from one of the examples online. I have gone through ant documentation and am aware of the and I have used these to set the log4j2.xml in classpath and have failed. &lt;project name="Learning" default="hello" basedir="."&gt; &lt;property name="src.dir" value="src"/&gt; &lt;property name="lib.dir" value="${src.dir}/lib"/&gt; &lt;property name="build.dir" value="build"/&gt; &lt;target name="hello"&gt; &lt;!-- compile just the basic hello files --&gt; &lt;echo&gt; This will have all the basic builds &lt;/echo&gt; &lt;javac srcdir="{src.dir}" destdir="{build.dir}" includeantruntime="false"/&gt; &lt;/target&gt; Can you please give me a code snippet to add my Log4j2.xml file sitting in the basedir or the project to the classpath?
tagged with: ant
tagged with: java
tagged with: eclipse
tagged with: log4j
tagged with: http://stackoverflow.com/tag/xml
has title: How to add log4j.xml path in Ant build.xml
upvote count: 3
type: UnansweredQuestion
answer count: 1

http://stackoverflow.com/q/25660409
has answer: http://stackoverflow.com/a/25660462
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25660567
upvote count: 5
tagged with: java
score: 5
has title: Java multiple functions starting with dots
has answer: http://stackoverflow.com/a/25660567
has answer: http://stackoverflow.com/a/25660598
has comment: http://stackoverflow.com/comment/40098701
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25660462
linked to: http://stackoverflow.com/q/11561817
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40098708
has body: There is a type of statement in java that I could not understand or even find anything about through googling. I would like to share an example which I wrote but without understanding the language structure : MvcResult result = this.mockMvc.perform(MockMvcRequestBuilders.post("/user_sessions/first") .contentType(MediaType.APPLICATION_JSON) .content("{\"username\":\""+username+"\",\"password\":\""+password+"\"}")) .andExpect(MockMvcResultMatchers.status().isOk()) .andReturn(); I don't understand what contentType , content, andExpect and andReturn are. They are obviously functions, but how can I call them like this. What class do they belong to? Overally I am very confused with the structure here.

http://stackoverflow.com/a/25575807
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25575559
has comment: http://stackoverflow.com/comment/39954262
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25575559
has comment: http://stackoverflow.com/comment/39953315
has body: CopyOnWriteArrayList may actually be what you want. It allows you to iterate over a snapshot of the list as it existed at some point in time. It may not be identical to the list as it is now, but do you really need it to be? Think about it this way. A thread iterating over the list and the thread modifying the list could interleave their operations in a variety of ways, none of which is wrong. One possibility is that the iterating thread could iterate over the entire list before the modifying thread is ever scheduled to run. Another possibility is that the iterating thread will get halfway through the list before it is modified. Propagating the changes to all existing iterators would be a complex and expensive operation, and you'd have to carefully define what an iterator does, for example, when something is inserted below its current position. And all this complexity would not make the program any more correct, because the behavior would be identical to CopyOnWriteArrayList if the threads just happened to be scheduled in a slightly different way. This is a pattern you will encounter often in efficient, highly concurrent programs. The important thing is that a thread is operating on a valid snapshot of an object, not necessarily the current version of the object as it is known to some other thread.
has comment: http://stackoverflow.com/comment/39944796

http://stackoverflow.com/q/25639875
tagged with: spring
favorite count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/40061474
score: 1
tagged with: ibm-was
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25640197
has title: Error occurred in HibernatePersistence provider
tagged with: oracle11g
has comment: http://stackoverflow.com/comment/40061745
type: Question
has body: The application i am currently working on uses Spring JPA and it works fine. But when i deploy it in Websphere application server V8.5 i get below exception on application startup. Data Base used is Oracle Oracle Database 11g Express Edition Release 11.2.0.2.0. An error occurred in the org.hibernate.ejb.HibernatePersistence persistence provider when it attempted to create the container entity manager factory for the domain persistence unit. The following error occurred: java.lang.NullPointerException at org.hibernate.engine.jdbc.internal.TypeInfoExtracter.extractTypeInfo(TypeInfoExtracter.java:85) at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:144) at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1797) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1755) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76) at com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory(JPAPUnitInfo.java:1584) at com.ibm.ws.jpa.management.JPAPUnitInfo.createEntityManagerFactory(JPAPUnitInfo.java:1406) at com.ibm.ws.jpa.management.JPAPxmlInfo.extractPersistenceUnits(JPAPxmlInfo.java:246) at com.ibm.ws.jpa.management.JPAScopeInfo.processPersistenceUnit(JPAScopeInfo.java:119) at com.ibm.ws.jpa.management.JPAApplInfo.processModulePUs(JPAApp…
upvote count: 1
type: UnansweredQuestion
tagged with: jpa
has comment: http://stackoverflow.com/comment/40061775
has comment: http://stackoverflow.com/comment/40061517

http://stackoverflow.com/a/25698521
type: Answer
has comment: http://stackoverflow.com/comment/40204454
has body: The error you are reporting indicates that, somehow, ant has been instructed to read the same XML Schema definitions twice. Indeed, the error message says that one definition is in C:\Temp\jaxb\apps\create-marshal\POCD_MT000040_SDTC.xsd and the other one was found in ...\create-marshal\infrastructure\cda\POCD_MT000040_SDTC.xsd You should clean up the file tree below create-marshal. You need one of these two, and, relatived to this file, the ones included by it, e.g.: ..\coreschemas\datatypes.xsd ..\coreschemas\voc.xsd ..\coreschemas\NarrativeBlock.xsd Finally, datatypes-base.xsd must be in the same folder as these three, as it is included by datatypes.xsd. But when you have tidied this up, you'll run into another problem, at least with the JAXB that comes with JDK 1.8. This is a bug in xjc, triggered by the (unintentional) duplication of a field "id" in a number of complex types, e.g., here: <xs:complexType name="POCD_MT000040.ObservationMedia"> ... <xs:element name="id" type="II" minOccurs="0" maxOccurs="unbounded"/> ... <xs:attribute name="ID" type="xs:ID"/> The mapping of XML Schema names to Java names is defined in the JAXB spec, and, no matter how a clash is produced, this should result in an error message (not a stack dump, as it happens). You have to handle this problem (bug or no bug) using customization with a JAXB binding file. Here's one (let'S call it rename.xjb), renaming the field matching @ID in POCD_MT000040.ObservationMedia to `xsid FIXES ALL NAME CLASHES id vs. ID <property name="xsid"/> <property name="xsid"/> <property name="xsid"/> You have to add the bindings file to the xjc invocation. In ant, this would be the @binding of <xjc>: <xjc schema="POCD_MT000040_SDTC.xsd" binding="rename.xjb" ...
has comment: http://stackoverflow.com/comment/40171900
upvote count: 3
has comment: http://stackoverflow.com/comment/40224951
has comment: http://stackoverflow.com/comment/40175075
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25696069
score: 3
answers question: http://stackoverflow.com/q/25696069

http://stackoverflow.com/q/25607154
has comment: http://stackoverflow.com/comment/40545923
has answer: http://stackoverflow.com/a/25915154
accepted answer: http://stackoverflow.com/a/25915154
tagged with: authentication
has answer: http://stackoverflow.com/a/25832834
has answer: http://stackoverflow.com/a/25622996
has body: Someone knows how to open a popup login to authenticate (using spring security) when the user does something that needs to be authenticated and he is not. For example: Lets imagine the page has one button "buy now" that add the product to the cart and perform the checkout (buy now page), if the user is already authenticated, or, opens a popup for the user perform the authentication. If the authentication is successful than the spring redirects to the "buy now" page or stays in that page with the popup opened (with an error message "wrong login"). I already searched in google for a kind of solution but without luck. Someone can point me in the right direction? Thanks
has answer: http://stackoverflow.com/a/25856642
tagged with: spring-security
linked to: http://stackoverflow.com/q/4297877
favorite count: 0
type: Question
tagged with: spring-mvc
answer count: 8
possible better answer: http://stackoverflow.com/a/25615146
linked to: http://stackoverflow.com/q/3444864
upvote count: 5
has answer: http://stackoverflow.com/a/25875296
has comment: http://stackoverflow.com/comment/40415478
has answer: http://stackoverflow.com/a/25615146
tagged with: java
has answer: http://stackoverflow.com/a/25802836
has answer: http://stackoverflow.com/a/25876396
tagged with: spring
has title: Spring security opening a popup login
type: AnsweredQuestion
score: 5
downvote count: 0

message-queue
type: Tag
tags question: http://stackoverflow.com/q/25681520
tags question: http://stackoverflow.com/q/25609645
tags question: http://stackoverflow.com/q/25666717
tags question: http://stackoverflow.com/q/25688557
tag name: message-queue

http://stackoverflow.com/comment/51906302
type: QuestionComment
has text: Not sure if this works, but it worked for me when I copied the specific dependency from my maven repo .m2 to .ivy2
type: Comment
comment on: http://stackoverflow.com/q/25680287
score: 0

http://stackoverflow.com/comment/40143864
has text: Like I said; it's impossible to get 2 instances with the same bean name. So something is amiss in your analysis.
score: 0
comment on: http://stackoverflow.com/q/25666717
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25591577
score: 1
accepted answer of: http://stackoverflow.com/q/25591171
has body: Albeit a good question,I don't know why your question was downvoted,it might be so because your comment was not seen by most of them! The first part is indeed correct as answered by Jeroen Vannevel,there is no such overloaded version of Integer.valueOf() available in java-library! The java.lang.Integer.valueOf(String s, int radix) method returns an Integer object holding the value extracted from the specified String s when parsed with the radix given by the second argument radix. So,here String is parsed into Integer object!!! On the other hand,you are talking about Integer.valueOf(1010, 2). The number 1010 is already an Integer and so it can't be parsed again back to Integer! Also,if you want BinaryString---simply use java.lang.Integer.toBinaryString(). For your satisfaction,if you are still thinking of parsing,then proceed below :- The solution to end your doubt is how will you convert Integer.valueOf(1010,16) again into Integer object???? It'll be containing String(hexadecimal representation of 3F2---see F here)!!! I hope you have got the reason!!! Hence,this was not provided in the java-library.
answers question: http://stackoverflow.com/q/25591171
type: Answer
type: AcceptedAnswer
downvote count: 0
upvote count: 1

glsl
tags question: http://stackoverflow.com/q/25648150
tags question: http://stackoverflow.com/q/25580397
tags question: http://stackoverflow.com/q/25709477
type: Tag
tag name: glsl

http://stackoverflow.com/q/25677810
tagged with: program-entry-point
has body: I'm a beginner programmer and am tasked to write an inventory program. I have only programmed using BlueJay so far, but am about to learn how to use the vim editor. When programming with BlueJay, you didn't need to write a main method. I'm so lost about how to write the main method and everything I researched over the internet didn't seem to explain or help much. I have already started the design of the program where I have an Inventory class and an Item class. How would I go about starting this project? Like what do I need to do with the main method and how would that work? Thanks Here is the code I have so far. import java.util.*; public class Inventory { private ArrayList&lt;Item&gt;inventory; /** * Constructor for objects of class Inventory */ public Inventory() { inventory = new ArrayList&lt;Item&gt;(); } /** * Adds an Item to the Inventory. */ public void addItem(String name, int amount, double price, int location) { boolean done = false; if(inventory.size() == 0) { inventory.add(new Item(name, amount, price, location)); } else { for(int i = 0; (!done)&amp;&amp;(i &lt; inventory.size()); i++) { if(inventory.get(i).getName().equals(name)) { System.out.println("Item name in use. Please use another name."); done = true; } else { inventory.add(new Item(name, amount, price, location)); done = true; } } } } /** * Deletes an Item from the Inventory. */ public void deleteItem(String name) { ........... } /** * Search for an Item. */ public void searchItem(String name) { ........... } }
answer count: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40130350
has comment: http://stackoverflow.com/comment/40129905
downvote count: 1
has answer: http://stackoverflow.com/a/25677819
favorite count: 0
has comment: http://stackoverflow.com/comment/40130324
type: Question
tagged with: main-method
accepted answer: http://stackoverflow.com/a/25677819
has comment: http://stackoverflow.com/comment/40129897
has title: How do you write a main method to start a java program?
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/a/25631154
type: Answer
has comment: http://stackoverflow.com/comment/40121861
score: 0
has comment: http://stackoverflow.com/comment/40159447
has comment: http://stackoverflow.com/comment/40120698
has comment: http://stackoverflow.com/comment/40120632
has comment: http://stackoverflow.com/comment/40124605
type: AcceptedAnswer
has body: This is a bad designed for API, I wonder who wrote this tutorial, Everytime I see someone use it it's the same issue occuring. You are writing an android app, there should be no HTML involved, when the field are missing you should still return json data and not HTML form. Read the error carefully: "Error parsing data org.json.JSONException: Value &lt; form of type java.lang.String cannot be converted to JSONObject" Yes form is the html tag, and that means the condition was not met. Then if you look at the condition if($_POST['submit']) That will never be true because you dont have an html submit button in your app. You should be checking if the value you sent by the app are set, if not send back a json response error stating that. &lt;?php $response = array(); if(isset($_POST['stars'], $_POST['username'])){ $stars= $_POST['stars']; $username = $_POST['username']; $connect = mysql_connect("*****", "****", "*****") or die("Can't connect to database!"); mysql_select_db("a9698368_webserv") or die("Can't select database!"); try{ $query = sprintf("UPDATE users SET easy_level1 ='%s' WHERE username ='%s'", mysql_real_escape_string($stars), mysql_real_escape_string($username)); mysql_query($query); } catch (Exception $ex) { $response["success"] = 0; $response["message"] = "Database Error. Please Try Again!"; } if ( mysql_affected_rows() &gt; 0) { $response["success"] = 1; $response["message"] = "Updated successful!"; } else { $response["success"] = 0; $response["message"] = "Can't update the stars!"; } mysql_close(); } else{ $response["success"] = 0; $response["message"] = "Missing post data!"; } echo json_encode($response); ?&gt;
has comment: http://stackoverflow.com/comment/40159426
has comment: http://stackoverflow.com/comment/40121519
has comment: http://stackoverflow.com/comment/40121833
has comment: http://stackoverflow.com/comment/40178404
has comment: http://stackoverflow.com/comment/40122217
has comment: http://stackoverflow.com/comment/40121219
has comment: http://stackoverflow.com/comment/40121934
answers question: http://stackoverflow.com/q/25629706
has comment: http://stackoverflow.com/comment/40124637
has comment: http://stackoverflow.com/comment/40120669
accepted answer of: http://stackoverflow.com/q/25629706

parsing
tags question: http://stackoverflow.com/q/25670757
tags question: http://stackoverflow.com/q/25669037
tags question: http://stackoverflow.com/q/25643097
tags question: http://stackoverflow.com/q/25706616
tag name: parsing
tags question: http://stackoverflow.com/q/25558187
tags question: http://stackoverflow.com/q/25625962
tags question: http://stackoverflow.com/q/25681072
tags question: http://stackoverflow.com/q/25619234
tags question: http://stackoverflow.com/q/25570093
tags question: http://stackoverflow.com/q/25587048
tags question: http://stackoverflow.com/q/25678403
tags question: http://stackoverflow.com/q/25680123
tags question: http://stackoverflow.com/q/25655046
tags question: http://stackoverflow.com/q/25645760
tags question: http://stackoverflow.com/q/25622991
tags question: http://stackoverflow.com/q/25591205
tags question: http://stackoverflow.com/q/25687463
tags question: http://stackoverflow.com/q/25579172
tags question: http://stackoverflow.com/q/25665998
type: Tag

http://stackoverflow.com/a/25694178
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/40160627
has comment: http://stackoverflow.com/comment/40160312
has comment: http://stackoverflow.com/comment/40160433
downvote count: 0
upvote count: 1
has body: From your comment, I understand the question like this: How can I enforce a space before the opening curly brace in this code: public void foo(int x, int y) { ... } // ^--- here This is in fact possible via the WhitespaceAround check. Just make sure the LCURLY token is set. That's the default if you don't set any tokens. A possible catch is that WhitespaceAround enforces whitespace after the curly brace, too. But in the case of a left curly brace, that's almost always there anyway, at least in the form of a line break.
answers question: http://stackoverflow.com/q/25675016

http://stackoverflow.com/a/26923574
has comment: http://stackoverflow.com/comment/62113209
answers question: http://stackoverflow.com/q/25634187
type: Answer
downvote count: 0
has body: JavascriptExecutor js = (JavascriptExecutor) driver; HashMap&lt;String, String&gt; longTapObject = new HashMap&lt;String, String&gt;(); longTapObject.put("element",((RemoteWebElement)w1).getId()); js.executeScript("mobile: longClick", longTapObject); The above code is working for me in java Appium version 1.2.4.1
score: 1
upvote count: 1

http://stackoverflow.com/comment/39998298
type: QuestionComment
comment on: http://stackoverflow.com/q/25604978
score: 0
type: Comment
has text: Like ReceivedSMS receivedSMS = new ReceivedSMS(context, username, password);

http://stackoverflow.com/a/25576898
has comment: http://stackoverflow.com/comment/39963696
type: Answer
has body: If you are debugging netbeans application using the debug menuitem in the context menu, the exceptions are reported in the output window of the IDE. Usually a notification is also shown in a Notification Bubble. Not sure what you are trying to do. Please provide more details if that doesn't answer your question. Are you developing a plugin or a Platform application ? How are you running the module ? i.e. mvn nbm:run-ide or debug menu item in the project context menu ? Update You should not use Install / Reload in Development IDE in general. If you run your plugin in development IDE, you might end up breaking your development environment. Then you'll have to reinstall your Netbeans. I usually have multiple versions of Netbeans installed, that helps when developing Netbeans plugins. For example, I am currently developing plugins in Netbeans 8.0, but I have Netbeans 8.0-Beta installed. So I point the plugin to run on netbeans 8.0-beta. so when I click debug it starts running on netbeans 8.0-beta as opposed to Netbeans 8.0. Example Configuration <nb.installation>/home/venkat/Programs/netbeans-8.0rc1</nb.installation> org.codehaus.mojo nbm-maven-plugin true <netbeansInstallDirectory>${nb.installation}</netbeansInstallDirectory> ${nb.installation} ${nbm.run.arguments} Once you do this, you can now right click on the plugin and click debug. When you do that another instance of Netbeans starts with your plugin installed. In your main Netbeans IDE, you'll see exceptions reported in the output window and in the second netbeans you'll see a notification bubble with the exception.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25569604
answers question: http://stackoverflow.com/q/25569604

http://stackoverflow.com/a/25698949
type: Answer
has body: My main question: So an object gets created in static method : it isn't needed after the result has been returned, ever. What happens? Is it something I need to worry about efficiency wise? If there are no references held to the object, then it will be released by the GC at some point in the future. The overhead of this on modern platforms is very low, the cost of an allocation is usually just a bump of a pointer local to a thread and the cost of the objects initialisation/constructor. The cost of GC would be free, as the cost of GC is related to how many reachable objects are on the heap. This object would be unreachable, and thus would not have a GC cost. I should note that I am assuming that the object has no destructor method; if it did then there would be a cost; but who uses those these days? If a reference to the object did survive long enough for a GC to occur, then the cost would be the time it takes to detect that the object is reachable and to copy the object between survivor spaces. Which would be measured in microseconds for any normal sized object; BIG objects, eg large arrays can take longer to copy. In normal applications this minor cost is nothing to worry about. If however it appeared in a loop with millions of iterations, which is not uncommon in a financial or scientific calculation then the cost would be magnified and one would risk a high GC burden. In very low latency applications, GC pauses have to be avoided and thus anything that allocates an object will risk moving the time to next GC pause closer and so is to be avoided. However for all other applications, and unit tests then do not worry about a low microsecond costs. Just printing to stdout costs us more.
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25698880
answers question: http://stackoverflow.com/q/25698880

http://stackoverflow.com/comment/40075463
type: QuestionComment
comment on: http://stackoverflow.com/q/25647720
has text: Hi, my apologies. readFile and Writefile methods
score: 0
type: Comment

http://stackoverflow.com/comment/40134435
has text: I think you don't even need the "else" block.. just catch the exception, don't even print it... return false
comment on: http://stackoverflow.com/q/25680295
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40038969
has text: Note that a declared `PropertyPlaceholderConfigurer` bean and `@PropertySources` are not equivalent.
score: 0
comment on: http://stackoverflow.com/q/25627249
type: Comment
type: QuestionComment

http://stackoverflow.com/a/28691437
answers question: http://stackoverflow.com/q/25674798
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/55100358
has body: Yeah, definitely you can tell your topology about your nimbus IP. Following is the example code to submit topology on remote cluster. Map storm_conf = Utils.readStormConfig(); storm_conf.put("nimbus.host", "&lt;Nimbus Machine IP&gt;"); Client client = NimbusClient.getConfiguredClient(storm_conf) .getClient(); String inputJar = "C:\\workspace\\TestStormRunner\\target\\TestStormRunner-0.0.1-SNAPSHOT-jar-with-dependencies.jar"; NimbusClient nimbus = new NimbusClient(storm_conf, "&lt;Nimbus Machine IP&gt;", &lt;Nimbus Machine Port&gt;); // upload topology jar to Cluster using StormSubmitter String uploadedJarLocation = StormSubmitter.submitJar(storm_conf, inputJar); String jsonConf = JSONValue.toJSONString(storm_conf); nimbus.getClient().submitTopology("testtopology", &lt;uploadedJarLocation&gt;, jsonConf, builder.createTopology()); Here is the working example : Submitting a topology to Remote Storm Cluster
has comment: http://stackoverflow.com/comment/55113417
has comment: http://stackoverflow.com/comment/63534673
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/67238201
has comment: http://stackoverflow.com/comment/55101582

http://stackoverflow.com/a/25676884
has comment: http://stackoverflow.com/comment/40128537
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/40135876
has body: You're replacing the vowels String each time instead of updating it (appending). Try this: vowels += String.valueOf(c); The whole code would look like this: public String getVowels() { String myString = "testString"; String vowels = ""; for (int i=0; i &lt; myString.length();i++) { if((myString.charAt(i) == 'a') || (myString.charAt(i) == 'e') || (myString.charAt(i) == 'i') || (myString.charAt(i) == 'o') || (myString.charAt(i) == 'u')) { vowels += String.valueOf(myString.charAt(i)); } } return vowels; } Output: ei Note that you're only checking for letters in lower case and you forgot about y. SPOILER This can be done in a bit more elegant way: public void vowelsTest() { System.out.println(getVowels("MY FIRST test STRING on STACK overFLOW")); } public Collection&lt;Character&gt; getVowels(final String testString) { String allVowels = "aAeEiIoOuUyY"; Collection&lt;Character&gt; vowelsInString = new ArrayList&lt;Character&gt;(); for (char letter : testString.toCharArray()) { if (allVowels.indexOf(letter) &gt;= 0) { vowelsInString.add(letter); } } return vowelsInString; } This will result in: [Y, I, e, I, o, A, o, e, O] If you would like only one instance of every vowel then you simply change ArrayList to HashSet, and that's all. Output for HashSet: [e, A, o, O, Y, I] And if you need only one instance of every vowel no matter if upper/lower case you can substitute the line with add to: vowelsInString.add(String.valueOf(letter).toLowerCase().charAt(0)); Which will result in: [e, a, o, y, i]
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40135152
answers question: http://stackoverflow.com/q/25676854

http://stackoverflow.com/comment/40160068
comment on: http://stackoverflow.com/a/25682779
type: AnswerComment
has text: P.S. Writing with correct spelling and grammar is a basic courtesy and shows evidence of professionalism.
score: 0
type: Comment

http://stackoverflow.com/a/25699188
downvote count: 0
has comment: http://stackoverflow.com/comment/40183755
has comment: http://stackoverflow.com/comment/40169228
has body: A shorter, and slightelly more efficient version: static int processData(ArrayList&lt;String&gt; array) { String str[][] = new String[array.size()][3]; for(int i = 0; i &lt; str.length; ++i) { str[i] = array.get(i).split("\\s+"); } return 0; } There is no reasion for the first array called str in your code, since you cann access the Strings directly from the ArrayList. Also you can don't have to copy the Strings, you can just put the arrays of Strings into the array of arrays, like in my code Plus, if you have a fixed size of 3, and don't need to add any more to the arrays, why do you allocate space for 5 strings?
has comment: http://stackoverflow.com/comment/40169364
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/25699073
has comment: http://stackoverflow.com/comment/40169282

http://stackoverflow.com/comment/68751241
type: Comment
score: 11
has text: Using a closure isn't always the best solution. the .each() approach doesn't allow for break;
type: AnswerComment
comment on: http://stackoverflow.com/a/25570244

http://stackoverflow.com/a/25599444
has comment: http://stackoverflow.com/comment/39987691
accepted answer of: http://stackoverflow.com/q/25598828
type: Answer
score: 0
has body: I think the problem is that your makeMove method keeps scanning even after it finds the number. So it finds 12, moves it right and then immediately finds it again and tries to move it again. Add return num; right after System.out.println("please continue"); and see if that fixes your problem. Edit: You also have a problem with not checking for boundaries. Try this: if (row &lt; 4 &amp;&amp; num &gt;= 100 * (the_frame[row + 1][column])) { ... } else if (column &lt; 4 &amp;&amp; num &gt;= 100 * (the_frame[row][column + 1])) { ... } else if (row &gt; 0 &amp;&amp; num &gt;= 100 * (the_frame[row - 1][column])) { ... } else if (column &gt; 0 &amp;&amp; num &gt;= 100 * (the_frame[row][column - 1])) { ...
answers question: http://stackoverflow.com/q/25598828
type: AcceptedAnswer

http://stackoverflow.com/q/25656214
tagged with: android
tagged with: java
tagged with: background
tagged with: service
type: Question
has answer: http://stackoverflow.com/a/25656853
has comment: http://stackoverflow.com/comment/40091540
type: UnansweredQuestion
has title: Starting a Service to play background music is getting errors
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25657504
has comment: http://stackoverflow.com/comment/40091445
has body: I am trying to run a background music in my android application but I am getting errors IF MY QUESTION FORMAT IS WRONG, PLEASE CORRECT ME how to solve this problem ? I have a main activity MainActivity: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent svc=new Intent(this, BackgroundMusic.class); startService(svc); } in the service activity BackgroundMusic: package com.example.tttgame; import android.app.Service; import android.content.Intent; import android.media.MediaPlayer; import android.os.IBinder; import android.util.Log; import android.widget.Toast; public class BackgroundMusic extends Service { private static final String TAG = null; MediaPlayer player; public IBinder onBind(Intent arg0) { return null; } @Override public void onCreate() { super.onCreate(); player = MediaPlayer.create(this, R.raw.music); player.setLooping(true); // Set looping player.setVolume(100,100); } public int onStartCommand(Intent intent, int flags, int startId) { player.start(); return 1; } public void onStart(Intent intent, int startId) { // TO DO } public IBinder onUnBind(Intent arg0) { // TO DO Auto-generated method return null; } public void onStop() { } public void onPause() { } @Override public void onDestroy() { player.stop(); player.release(); } @Override public void onLowMemory() { } } in the AndroidManifiest : &lt;activity android:name="com.example.tttgame.BoardActivity" android:label="@string/app_name" &gt; &lt;/activity&gt; &lt;service android:enabled="true" android:name="com.example.tttgame.BackgroundMusic" /&gt; &lt;/application&gt; my error message : 09-03 21:45:20.387: E/MainActivity(1392): starting Main Activity .. 09-03 21:45:22.077: E/MainActivity(1392): checking if key 'flag' exists in preferences.. 09-03 21:45:22.377: E/MediaPlayer(1392): Should have subtitle controller already set 09-03 21:45:22.797: E/MediaPlayer(1392): error (1, -2147483648) 09-03 21:45:22.837: E/AndroidRuntim…

http://stackoverflow.com/q/25603463
has comment: http://stackoverflow.com/comment/39995107
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39995041
has comment: http://stackoverflow.com/comment/39995311
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25603714
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39995249
has comment: http://stackoverflow.com/comment/39995228
has comment: http://stackoverflow.com/comment/39995111
has answer: http://stackoverflow.com/a/25603553
has body: I have a string like that: String s = "{"Player":{"id":"1","name":"PM001"}},{"Player":{"id":"2","name":"PM002"}}" I want to omit the "," so the result should be : {"Player":{"id":"1","name":"PM001"}} {"Player":{"id":"2","name":"PM002"}}
type: Question
has comment: http://stackoverflow.com/comment/39995242
has title: How to split a string when elements in the string can contain the delimiter

http://stackoverflow.com/comment/39919953
score: 0
type: Comment
has text: I'm using Eclipse's compiler ECJ and it compiles to a .class file which you can view at https://drive.google.com/file/d/0B53jM4a9X2fqZHBOcldxV1Vnb2s/edit?usp=sharing . The .java source is already in the question.
comment on: http://stackoverflow.com/a/25562470
type: AnswerComment

http://stackoverflow.com/a/25570133
has comment: http://stackoverflow.com/comment/40162437
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/109461880
score: 1
has body: You can't share a label for two components so it doesn't make sense to try to use the setLabelFor(...) method twice on a single label. Why do you even have two radio buttons? The purpose of a radio button is to have two states on/off, selected/unselected. So having two radio buttons with "Yes/No" doesn't make sense. You should only have a single label describing what the button is used for.
type: Answer
answers question: http://stackoverflow.com/q/25565441
has comment: http://stackoverflow.com/comment/39988138

http://stackoverflow.com/comment/64568989
type: Comment
has text: Thanks for your answer! Based on it I've found myself a solution for the RestAssuredMockMvc approach: http://stackoverflow.com/a/38435008/2239713
type: AnswerComment
comment on: http://stackoverflow.com/a/25787476
score: 1

http://stackoverflow.com/comment/40065819
score: 0
has text: have a look at my answer
type: Comment
comment on: http://stackoverflow.com/q/25641727
type: QuestionComment

http://stackoverflow.com/comment/61728780
type: AnswerComment
has text: Glad you found it helpful. Have fun
comment on: http://stackoverflow.com/a/25709312
type: Comment
score: 0

http://stackoverflow.com/a/25572556
accepted answer of: http://stackoverflow.com/q/25559339
has body: Apparently, as @Justin commented, the output is sorted, but in ascendant order: 0, 1, 2, 3 If you want that in descendant order, just change the returned integer sign from the compareTo method: return Integer.valueOf(this.won).compareTo(Integer.valueOf(other.won)) * -1;
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25559339
type: Answer

http://stackoverflow.com/a/25563800
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/39921859
has comment: http://stackoverflow.com/comment/39921799
has body: I think this will tell you why it does not work public List&lt;String&gt; addItem(String temp) { ArrayList&lt;String&gt; listS = new ArrayList&lt;&gt;(); listS.add(temp); return listS; } and how it will work ArrayList&lt;String&gt; listS = new ArrayList&lt;&gt;(); public List&lt;String&gt; addItem(String temp) { listS.add(temp); return listS; } Sorry for the quick coding, but the answer to your question is just that :)
answers question: http://stackoverflow.com/q/25563604
upvote count: 1
has comment: http://stackoverflow.com/comment/39921915
downvote count: 1

http://stackoverflow.com/comment/40660236
type: Comment
has text: @myna - I am using eclipse for compilation, I verified my code compiles and runs on both Windows 7 and Ubuntu platform, please provide additional details on what all you have tried.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25682625

http://stackoverflow.com/comment/39938892
score: 0
has text: Is the VB Script being executed via something `Runtime.exec()`?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25572808

http://stackoverflow.com/q/25693744
tagged with: java
tagged with: facebook-android-sdk
tagged with: facebook-graph-api
has comment: http://stackoverflow.com/comment/40264946
has comment: http://stackoverflow.com/comment/40258105
type: Question
has comment: http://stackoverflow.com/comment/40263588
has comment: http://stackoverflow.com/comment/40263101
has comment: http://stackoverflow.com/comment/40162581
has body: This is my code... public class FacebookShare extends FragmentActivity { private static final String TAG = "FacebookShare"; private static final String PERMISSION = "publish_actions"; public static final String PACKAGE = "com.facebook.katana"; private final String PENDING_ACTION_BUNDLE_KEY = "com.myapp.mypackage.facebook.facebookshare:PendingAction"; private FragmentActivity mActivity; private PendingAction pendingAction = PendingAction.NONE; private GraphUser user; private GraphPlace place; private List&lt;GraphUser&gt; tags; private boolean canPresentShareDialog; private boolean canPresentShareDialogWithPhotos; private String mTitle, mDescription, mUrlShare, mUrlImg; private enum PendingAction { NONE, POST_PHOTO, POST_STATUS_UPDATE } private UiLifecycleHelper uiHelper; private Session.StatusCallback callback = new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { onSessionStateChange(session, state, exception); } }; private FacebookDialog.Callback dialogCallback = new FacebookDialog.Callback() { @Override public void onError(FacebookDialog.PendingCall pendingCall, Exception error, Bundle data) { Log.d("HelloFacebook", String.format("Error: %s", error.toString())); } @Override public void onComplete(FacebookDialog.PendingCall pendingCall, Bundle data) { Log.d("HelloFacebook", "Success!"); } }; public FacebookShare(FragmentActivity act, String applicationId, String title, String description, String urlShare, String urlImg) { mActivity = act; mTitle = title; mDescription = description; mUrlShare = urlShare; mUrlImg = urlImg; uiHelper = new UiLifecycleHelper(mActivity, callback, applicationId); uiHelper.onCreate(new Bundle()); canPresentShareDialog = FacebookDialog.canPresentShareDialog(mActivity, FacebookDialog.ShareDialogFeature.SHARE_DIALOG); canPresentShareDialogWithPhotos = FacebookDialog.canPresentShareDialog(mActivity, FacebookDialog.ShareDialogFeature.PHOTOS); } public static void showDialog(Fragm…
has title: how to do for make public an app using facebook sdk for android?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40257732
tagged with: android
tagged with: facebook
has comment: http://stackoverflow.com/comment/40240265
has comment: http://stackoverflow.com/comment/40219153
has comment: http://stackoverflow.com/comment/40168408
score: 0
answer count: 0

http://stackoverflow.com/comment/39938659
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25572158
has text: I don't understand you, don't use method print. Use my answer.
type: Comment

http://stackoverflow.com/q/25684193
downvote count: 0
answer count: 1
tagged with: image-processing
upvote count: 1
has body: I'm loading a BufferedImage and getting RGB values for the pixels based on their xy location. After I would like to create an ArrayList containing only the black pixels. I'm trying to create the list doing this: List&lt;Integer&gt; blackpixels = new ArrayList&lt;Integer&gt;(); but I get this error at the line where I declare the list: The type List is not generic; it cannot be parameterized with arguments Here's my full code: import java.awt.Color; import java.awt.List; import java.awt.image.BufferedImage; import java.util.*; public class ImageTest { public static BufferedImage Threshold(BufferedImage img) { int height = img.getHeight(); int width = img.getWidth(); BufferedImage finalImage = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB); int r = 0; int g = 0; int b = 0; List&lt;Integer&gt; blackpixels = new ArrayList&lt;Integer&gt;(); for (int x = 0; x &lt; width; x++) { // System.out.println("Row: " + x); try { for (int y = 0; y &lt; height; y++) { //Get RGB values of pixels int rgb = img.getRGB(x, y); r = ImageTest.getRed(rgb); g = ImageTest.getGreen(rgb); b = ImageTest.getBlue(rgb); finalImage.setRGB(x,y,ImageTest.mixColor(r, g,b)); System.out.println(r); } } catch (Exception e) { e.getMessage(); } } return finalImage; } private static int mixColor(int red, int g, int b) { return red&lt;&lt;16|g&lt;&lt;8|b; } public static int getRed(int rgb) { return (rgb &amp; 0x00ff0000) &gt;&gt; 16; } public static int getGreen(int rgb) { return (rgb &amp; 0x0000ff00) &gt;&gt; 8; } public static int getBlue(int rgb) { return (rgb &amp; 0x000000ff) &gt;&gt; 0; } }
accepted answer: http://stackoverflow.com/a/25684221
favorite count: 0
type: Question
has title: Creating an ArrayList containing only specified pixels
tagged with: arraylist
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25684221
score: 1
tagged with: java

http://stackoverflow.com/a/25625312
type: Answer
has comment: http://stackoverflow.com/comment/40038149
answers question: http://stackoverflow.com/q/25624669
upvote count: 2
has comment: http://stackoverflow.com/comment/40038027
has comment: http://stackoverflow.com/comment/40037792
score: 1
downvote count: 1
has body: def N = 3 def i = 0 def j = 0 int[][] numbers = new int[N][] // Generate, print, and store numbers while( i &lt; numbers.length ){ numbers[i] = new int[i+1] j = 0 while( j &lt; numbers[i].length ){ numbers[i][j] = j+1 ++j print j } println "" i++ } // Print them again, in reverse order i = numbers.length - 1 while( i &gt;= 0 ){ j = 0 while( j &lt; numbers[i].length ){ print numbers[i][j] j++ } println "" i-- } Output: 1 12 123 123 12 1 The code is pretty self-explanatory. You need just N rows but print 2N because, wait for it ... symmetry. If you have 6 rows, first 3 are new while the other 3 are just mirrored images so why waste the memory space when you can just print them again?

http://stackoverflow.com/a/25623417
accepted answer of: http://stackoverflow.com/q/25622894
has comment: http://stackoverflow.com/comment/81011613
has body: You must have an error in the way you read the key back from the database. The following code works just fine for me: String key = "3082012230..."; // full key omitted for brevity byte[] derPublicKey = DatatypeConverter.parseHexBinary(key); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(derPublicKey); keyFactory.generatePublic(publicKeySpec); I would guess, based on the use of pkey.getBytes(), that you've simply tried to get the bytes from the string rather than hex-decoding it.
answers question: http://stackoverflow.com/q/25622894
score: 10
type: Answer
downvote count: 0
upvote count: 10
type: AcceptedAnswer

http://stackoverflow.com/a/25579442
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25579409
has body: static final String AB = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; static Random rnd = new Random(); String randomString( int len ) { StringBuilder sb = new StringBuilder( len ); for( int i = 0; i &lt; len; i++ ) sb.append( AB.charAt( rnd.nextInt(AB.length()) ) ); return sb.toString(); } String random_st=randomString(10)

http://stackoverflow.com/a/25659404
has comment: http://stackoverflow.com/comment/40133486
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25654506
has comment: http://stackoverflow.com/comment/40127453
answers question: http://stackoverflow.com/q/25654506
has body: Using a temporary table might be slower because all the data must be copied twice. However, creating a new table and then renaming it needs more space for the actual database (which needs to hold the old and new tables at the same time), while the temporary table will be stored in the temporary database. Both methods are perfectly safe when run inside a transaction.
type: Answer
has comment: http://stackoverflow.com/comment/40098345

http://stackoverflow.com/a/25589946
type: AcceptedAnswer
has body: The ternary operator is a short-hand for writing an if-else statement. Its general for is &lt;boolean condition to evaluate&gt; ? &lt;return value if condition is true - i.e., the "if" branch &gt; : &lt;return value is condition is false - i.e., the "else" branch&gt; So, if you unwrap the method you showed, you'd get: public boolean collidesWith(Rectangle object){ if (isDestroyed) { return false; } else { return hitbox.intersects(object); } }
answers question: http://stackoverflow.com/q/25589906
type: Answer
upvote count: 4
score: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25589906

regex
tags question: http://stackoverflow.com/q/25642244
tags question: http://stackoverflow.com/q/25568168
tags question: http://stackoverflow.com/q/25671049
tags question: http://stackoverflow.com/q/25553470
tags question: http://stackoverflow.com/q/25597469
tags question: http://stackoverflow.com/q/25570907
tags question: http://stackoverflow.com/q/25669975
tags question: http://stackoverflow.com/q/25633652
tags question: http://stackoverflow.com/q/25628083
tags question: http://stackoverflow.com/q/25645641
tags question: http://stackoverflow.com/q/25558488
tags question: http://stackoverflow.com/q/25671827
tags question: http://stackoverflow.com/q/25656040
tags question: http://stackoverflow.com/q/25608925
tags question: http://stackoverflow.com/q/25606501
tags question: http://stackoverflow.com/q/25578325
tags question: http://stackoverflow.com/q/25664401
tags question: http://stackoverflow.com/q/25599739
tag name: regex
tags question: http://stackoverflow.com/q/25702507
tags question: http://stackoverflow.com/q/25699170
tags question: http://stackoverflow.com/q/25670401
tags question: http://stackoverflow.com/q/25683816
tags question: http://stackoverflow.com/q/25685649
tags question: http://stackoverflow.com/q/25631550
tags question: http://stackoverflow.com/q/25665867
tags question: http://stackoverflow.com/q/25708024
tags question: http://stackoverflow.com/q/25556132
tags question: http://stackoverflow.com/q/25707234
tags question: http://stackoverflow.com/q/25643621
tags question: http://stackoverflow.com/q/25662683
tags question: http://stackoverflow.com/q/25630492
tags question: http://stackoverflow.com/q/25631530
tags question: http://stackoverflow.com/q/25634227
tags question: http://stackoverflow.com/q/25675868
tags question: http://stackoverflow.com/q/25563201
tags question: http://stackoverflow.com/q/25555981
tags question: http://stackoverflow.com/q/25583078
tags question: http://stackoverflow.com/q/25686621
tags question: http://stackoverflow.com/q/25706385
tags question: http://stackoverflow.com/q/25555315
tags question: http://stackoverflow.com/q/25638498
tags question: http://stackoverflow.com/q/25591596
tags question: http://stackoverflow.com/q/25560332
tags question: http://stackoverflow.com/q/25608537
tags question: http://stackoverflow.com/q/25703746
tags question: http://stackoverflow.com/q/25557088
tags question: http://stackoverflow.com/q/25707779
tags question: http://stackoverflow.com/q/25585586
tags question: http://stackoverflow.com/q/25703479
tags question: http://stackoverflow.com/q/25580869
tags question: http://stackoverflow.com/q/25651092
tags question: http://stackoverflow.com/q/25638297
tags question: http://stackoverflow.com/q/25551364
tags question: http://stackoverflow.com/q/25671967
tags question: http://stackoverflow.com/q/25667203
tags question: http://stackoverflow.com/q/25610966
tags question: http://stackoverflow.com/q/25635373
tags question: http://stackoverflow.com/q/25712373
tags question: http://stackoverflow.com/q/25655046
tags question: http://stackoverflow.com/q/25564315
tags question: http://stackoverflow.com/q/25657043
tags question: http://stackoverflow.com/q/25700987
tags question: http://stackoverflow.com/q/25591557
tags question: http://stackoverflow.com/q/25655853
tags question: http://stackoverflow.com/q/25580335
tags question: http://stackoverflow.com/q/25565193
tags question: http://stackoverflow.com/q/25588800
tags question: http://stackoverflow.com/q/25641027
tags question: http://stackoverflow.com/q/25556309
tags question: http://stackoverflow.com/q/25617490
tags question: http://stackoverflow.com/q/25667381
tags question: http://stackoverflow.com/q/25597267
tags question: http://stackoverflow.com/q/25659878
tags question: http://stackoverflow.com/q/25574763
tags question: http://stackoverflow.com/q/25669500
tags question: http://stackoverflow.com/q/25618435
tags question: http://stackoverflow.com/q/25644144
tags question: http://stackoverflow.com/q/25648137
type: Tag

http://stackoverflow.com/q/25615228
type: Question
tagged with: eclipse
has answer: http://stackoverflow.com/a/25615322
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25750631
answer count: 3
has title: How to quickly and efficiently test project on Tomcat local server after making changes
has answer: http://stackoverflow.com/a/25750631
tagged with: java
possible better answer: http://stackoverflow.com/a/25751246
tagged with: tomcat
has answer: http://stackoverflow.com/a/25751246
has body: I'm trying to build a Dynamic Web Application in Eclipse and I'm having trouble when I test my changes. Sometimes when I make changes, I relaunch the Tomcat server and behold, my project looks exactly the same as last time. I then clean and rebuild the project a few times as well as clean the server, and finally my changes are visible. This is time consuming and doesn't feel correct. Is there a proper, quicker, more efficient way to launch a clean copy of your project on the local server?

http://stackoverflow.com/q/25649151
tagged with: datetime
has comment: http://stackoverflow.com/comment/40081682
has body: I am having a problem with freemarker dates. I want to compare to dates and also print the day diff. the first date is passed to the model (java.util.Date) The second one is the freemarker .now var. So I am doing this: &lt;#assign currentDate = .now&gt; &lt;#if currentDate?long &lt; trip.endDate?long&gt; &lt;#-- Not ended --&gt; This is working fine, but then when I try to get the day diff, as stated here: How do I calculate the difference in days between two ISO8601 dates with Freemarker? I am doing: &lt;#assign currentDate = .now&gt; ${((trip.startDate?datetime("yyyy-MM-dd'T'HH:mm:ssZ")?long - currentDate?datetime("yyyy-MM-dd'T'HH:mm:ssZ")?long) / (1000 * 60 * 60 * 24))?int} And this is throwing: Expected method. trip.startDate?datetime evaluated instead to freemarker.template.SimpleDate Then I tryied adding ?date as I saw that some do that in order to get the right type of the object, like this &lt;#assign currentDate = .now&gt; ${((trip.startDate?date?datetime("yyyy-MM-dd'T'HH:mm:ssZ")?long - currentDate?datetime("yyyy-MM-dd'T'HH:mm:ssZ")?long) / (1000 * 60 * 60 * 24))?int} And it throws: Cannot convert DATE into DATETIME Just to make sure that the object I am using is java.util.Date, here is my Trip class: package com.test.planner.dto; import java.util.Date; public class Trip implements Comparable&lt;Trip&gt; { private Date startDate; // start date private Date endDate; // end date // ... public Date getStartDate() { return this.startDate; } public void setStartDate(Date startDate) { this.startDate = startDate; } public Date getEndDate() { return this.endDate; } public void setEndDate(Date endDate) { this.endDate = endDate; } @Override public int compareTo(Trip o) { return this.getStartDate().compareTo(o.getStartDate()); } } And I am passing this to the model: Trip trip = new Trip(); trip.setStartDate(new Date(1410318000000L)); // Wed Sep 10 2014 00:00:00 GMT-0300 (BRT) trip.setEndDate(new Date(1410318000000L + 691200000L)); // Plus 8 days mav.addObject("trip",…
tagged with: date
linked to: http://stackoverflow.com/q/11412040
has comment: http://stackoverflow.com/comment/40081651
score: 0
has comment: http://stackoverflow.com/comment/40081748
accepted answer: http://stackoverflow.com/a/25653177
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25653177
type: Question
type: AnsweredQuestion
has title: Error printing dates days diff in Freemarker
tagged with: freemarker

http://stackoverflow.com/comment/40132967
type: QuestionComment
score: 0
has text: replace ALL the `" "`(whitespaces) with `"\\ "`
comment on: http://stackoverflow.com/q/25679521
type: Comment

http://stackoverflow.com/q/25639075
tagged with: android
tagged with: java
tagged with: service
type: Question
tagged with: timer
has comment: http://stackoverflow.com/comment/40059933
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25639311
has comment: http://stackoverflow.com/comment/40060080
answer count: 1
has body: I have service which is basically timer. It receives object with location data, start time, user id etc, and every seconds it increments stop value. I'd like to have this service running non-stop until stopped in application. I've read that i need to start this service as sticky, so i did that. But I've noticed that after my main application is beeing killed by system or user, service restarts and lose all information (about current timers running etc - I have there array with list of objects). Idea of that service was that: user clicks button in app -> service is starting and counting time changing information in notification bar and sending broadcast to main application -> I wish to continue updating notification bar even if app is killed by user or system. My class below: public class TimerService extends Service{ private NotificationCompat.Builder builder; private static JsonHistoryList activities; private Intent intent; private Handler handler; private Runnable sendUpdateToUi = new Runnable() { @Override public void run() { sendBroadcast(); handler.postDelayed(this, 1000); } }; private NotificationManager mNotificationManager; private BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if(action.equals(ACTION_ADD)){ JsonHistory item = (JsonHistory) intent.getSerializableExtra(HISTORY_ARG); new NetworkAsyncTask().execute(ACTION_ADD_ID, item); }else if(action.equals(ACTION_DELETE)){ int id = intent.getIntExtra(CATEGORY_ID_ARG, -1); if(id &gt; 0){ new NetworkAsyncTask().execute(ACTION_DELETE_ID, id); } }else if(action.equals(ACTION_CLEAR)){ activities.clear(); } } }; public TimerService() { handler = new Handler(); } private void sendBroadcast() { Long time = new Date().getTime(); for(JsonHistory item: activities){ ContentValues values = new ContentValues(); values.put(History.C_STOP, time); String[] selectionArgs = {String.valueOf(item.id)}; getContentResolver…
has title: Android sticky service is beeing killed loosing all information
score: 0

http://stackoverflow.com/comment/40296662
comment on: http://stackoverflow.com/a/25651812
type: Comment
score: 0
type: AnswerComment
has text: no problem, I'll definitely look into it as I get some time. Mostly, I'd try to answer that by the end of the day.

twitter-oauth
tags question: http://stackoverflow.com/q/25605836
tag name: twitter-oauth
type: Tag

http://stackoverflow.com/a/25624457
downvote count: 0
has comment: http://stackoverflow.com/comment/40039103
has comment: http://stackoverflow.com/comment/40039184
answers question: http://stackoverflow.com/q/25624124
has body: Here's some interesting reading: prefer-web-inf-classes Element The weblogic.xml Web application deployment descriptor contains a element (a sub-element of the element). By default, this element is set to False. Setting this element to True subverts the classloader delegation model so that class definitions from the Web application are loaded in preference to class definitions in higher-level classloaders. This allows a Web application to use its own version of a third-party class, which might also be part of WebLogic Server. See “weblogic.xml Deployment Descriptor Elements.” taken from: http://docs.oracle.com/cd/E15051_01/wls/docs103/programming/classloading.html Other troubleshooting tips: You can try: -verbose:class and check your managed server's logs to check if the class is being loaded properly. An efficient way to confirm which intrusive jar might be getting loaded is by running a whereis.jsp within the same webcontext (i.e., JVM instance) of this app. --whereis.jsp -- &lt;%@ page import="java.security.*" %&gt; &lt;%@ page import="java.net.URL" %&gt; &lt;% Class cls = org.joda.time.DateTimeZone.class; ProtectionDomain pDomain = cls.getProtectionDomain(); CodeSource cSource = pDomain.getCodeSource(); URL loc = cSource.getLocation(); out.println(loc); // it should print something like "c:/jars/MyJar.jar" %&gt; You can also try jarscan on your $WEBLOGIC_HOME folder to see if you can find the jar that contains this class: https://java.net/projects/jarscan/pages/Tutorial
type: Answer
accepted answer of: http://stackoverflow.com/q/25624124
score: 2
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/25609300
type: AnsweredQuestion
tagged with: java
answer count: 2
tagged with: shark-sql
downvote count: 0
has answer: http://stackoverflow.com/a/25611504
has body: I use Datastax Enterprise 4.5. I hope I did the config right, I did it like on datastax website explained. I can write into the Cassandra DB with an Windowsservice, this works but i can't query with Spark using the where function. I start the Cassandra node (there is only one for test purpose) with "./dse cassandra -k -t" (in the /bin folder) so hadoop and spark are running both. I can write into Cassandra without a problem. So you cannot use a 'where' clause in a Cassandra query when the 'where' isn't the RowKey. So I need to use Spark/Shark. I can start and use all queries I need with shark (./dse shark) but I need to write a Standalone program in Scala or Java. So I tried this link: https://github.com/datastax/spark-cassandra-connector And I can query a simple statement like: val conf = new SparkConf(true) .set("spark.cassandra.connection.host", "MY_IP") .setMaster("spark://MY_IP:7077") .setAppName("SparkTest") // Connect to the Spark cluster: lazy val sc = new SparkContext(conf) val rdd = sc.cassandraTable("keyspace", "tablename") println(rdd.first) and this works well but if I ask for more line or count: println(rdd.count) rdd.toArray.foreach(println) then I get this exception: Exception in thread "main" org.apache.spark.SparkException: Job aborted due to stage failure: All masters are unresponsive! Giving up. at org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1049) at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1033) at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1031) at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47) at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:1031) at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:635)…
has title: Datastax DSE Cassandra, Spark, Shark, Standalone Programm
favorite count: 0
tagged with: cassandra
accepted answer: http://stackoverflow.com/a/25638483
type: Question
tagged with: scala
has answer: http://stackoverflow.com/a/25638483
tagged with: apache-spark
possible better answer: http://stackoverflow.com/a/25611504
score: 2
upvote count: 2

http://stackoverflow.com/comment/40068795
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25644020
has text: I think it is specified in comments in code "how to do that for i arrays and for j numbers in array?"
score: 0

http://stackoverflow.com/q/25586687
has title: Resolve JPA association while deserializing JAX-RS JSON Object
has comment: http://stackoverflow.com/comment/100647391
upvote count: 3
answer count: 1
tagged with: jpa
downvote count: 0
tagged with: jax-rs
tagged with: jackson
favorite count: 0
has body: I have some problems combining JAX-RS (in JBoss Wildfly container) with JSON payload and with JPA assiciations. Follwoing scenario: There are two JPA entities @Entity class Organization { @Id private long id; private String name; } @Entity class Empolyee { @Id private long id; @Id private String name; @ManyToOne(fetch = FetchType.EAGER) @JsonProperty("organization_id") @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id") @JsonIdentityReference(alwaysAsId = true) private Organization organization; } Next I have a JAX-RS service to create a new Employee with the following signature: @POST @Consumes({ "application/json" }) public Response create(final Employee employee) { } The JSON for a new Employee sent by the client looks like: { "name" : "Sam Sample", "organization_id" : 2 } My problem is that this JSON (obviously) cannot be deserialized into an instance of "Employee" since the mapping of the "organization_id" to the corresponding JPA Entity fails. How can I configure JAX-RS (or the Jackson JSON mapper) to interpret the "orgainization_id" as the id of a JPA entity?
type: Question
has comment: http://stackoverflow.com/comment/72390268
score: 3
has comment: http://stackoverflow.com/comment/100943798
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/75037237
has answer: http://stackoverflow.com/a/25589358

http://stackoverflow.com/comment/39961443
comment on: http://stackoverflow.com/q/25584335
has text: I can handle all Runtime and Checked exceptions using ExceptionHandler or ExceptionMapper. But the problem is how do i do with errors?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39925034
comment on: http://stackoverflow.com/q/25565452
type: Comment
has text: I am trying to use **p** to capture starting position and ending position of the sequence of 1's and 0's. But the value in p is not exact. So if the sequence of 0's start at the 19th position and ends at the 21st position the result is off by 1 or 2 positions. It is difficult to reconcile.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39989976
type: AnswerComment
comment on: http://stackoverflow.com/a/25600335
has text: I think a good way to think about the situation is to compare classes as a whole to variables instead of only methods to variables. primitive types, like classes, have both state and behavior, although their functionality is more simple. The behavior is defined at declaration (like class declaration and, in turn, method declaration), and their state is determined at initialization (like object initialization). When I think of it this way, everything makes a lot more sense.
type: Comment
score: 0

http://stackoverflow.com/comment/40066329
has text: yes I am using `Java 7 update 67` so i can't use them.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25642884
type: Comment

http://stackoverflow.com/a/25662769
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25650568
upvote count: 1
score: 1
type: Answer
has body: DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(MEMORY_THRESHOLD); factory.setRepository(new File(System.getProperty("java.io.tmpdir"))); ServletFileUpload upload = new ServletFileUpload(factory); upload.setFileSizeMax(MAX_FILE_SIZE); upload.setSizeMax(MAX_REQUEST_SIZE); // sets maximum size of request (include file + form data) String uploadPath = getServletContext().getRealPath("") + File.separator + UPLOAD_DIRECTORY; File uploadDir = new File(uploadPath); if (!uploadDir.exists()) { uploadDir.mkdir(); } List&lt;FileItem&gt; formItems = upload.parseRequest(request); if (formItems != null &amp;&amp; formItems.size() &gt; 0) { for (FileItem item : formItems) { if (!item.isFormField()) { String fileName = new File(item.getName()).getName(); System.out.println("item.getFieldName() =&gt; "+item.getFieldName()); String fileAttr[] = fileName.split("\\."); String newFileName = fileAttr[0]; int i = 1; while (true) { File f = new File(uploadPath + "\\" + newFileName + "." + fileAttr[1]); if (f.exists()) { newFileName = fileAttr[0] + i; i++; } else { fileName = newFileName + "." + fileAttr[1]; break; } } String filePath = uploadPath + File.separator + fileName; File storeFile = new File(filePath); item.write(storeFile); request.setAttribute("message","Upload has been done successfully!"); } else { System.out.println("1 item.getFieldName() =&gt; "+item.getFieldName()); if("description1".equalsIgnoreCase(item.getFieldName())){ //this part is for other field except file field } } } } you have to add commons-fileupload-1.3.jar
answers question: http://stackoverflow.com/q/25650568

http://stackoverflow.com/a/25704117
downvote count: 0
has comment: http://stackoverflow.com/comment/40180217
upvote count: 1
type: AcceptedAnswer
score: 1
accepted answer of: http://stackoverflow.com/q/25703996
has body: You can use the Maven Resource Plugin in order to add additional resources (that will be packed into final archive) and which are not into the usual resource directory aka src/main/resources/: ... ... ${project.build.directory}/generated/schema ... ...
type: Answer
answers question: http://stackoverflow.com/q/25703996
has comment: http://stackoverflow.com/comment/40180406

http://stackoverflow.com/comment/39988138
has text: setLabelFor() I am using just to specify the radio button belongs to which label and why I cannot use same label for two ?
comment on: http://stackoverflow.com/a/25570133
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40109361
has text: @JüsteengJace look at my recent edit and accept this as answer if it worked for you.
comment on: http://stackoverflow.com/a/25646536
type: Comment
score: 0
type: AnswerComment

optimization
tags question: http://stackoverflow.com/q/25563706
tags question: http://stackoverflow.com/q/25694872
tag name: optimization
tags question: http://stackoverflow.com/q/25583339
tags question: http://stackoverflow.com/q/25572376
tags question: http://stackoverflow.com/q/25561392
tags question: http://stackoverflow.com/q/25583297
tags question: http://stackoverflow.com/q/25671326
type: Tag
tags question: http://stackoverflow.com/q/25683624

http://stackoverflow.com/q/25588325
has comment: http://stackoverflow.com/comment/39967504
possible better answer: http://stackoverflow.com/a/25588370
has body: I'm new to android development and Java programming. I am trying to create a separate class without a new user interface. Supposed I have a main activity wherein if I click a button it will initiate a class and call the method in it and display the text on the main activity. Now I have create created a Main activity and a class which named as BluetoothOn: Please take a look at my code: This is the main activity where the enablemyBluetooth method is the button click public class MainActivity{ .... .... public void enablemyBluetooth(View view){ BluetoothOn ble = new BluetoothOn(); ble.initializeBlue(); } } Now I create a class wherein I planned to do all the processes here without intervening on the Main activity of the program, like it is running on the background.. here in my code I just want to change the Textview but when I run it on my android it states that unfortunately the app stopped. public class BluetoothOn { private void initializeBlue(){ textView1 =(TextView)findViewById(R.id.textView1); textView1.setText(BleisOn); } } Please take note that I have compiled this program with no error/ all variables are declared. I have tried to create the Bluetooth class as private on the Main and it works. I just want to create it as another class on the package for organizing my code. Is it really necessary that I have to create another activity if I want to create a separate class? Can anyone give me hints what should I do or declare? Please help thank you. Update: thank you for all your answers, unfortunately I can't make this simple process to work on another class... I'm quite new to Java and still learning my way.. anyways here is what I encountered. I followed the post suggested by unohu however it provides me an error on the Main that "The method to initializeBlue() in the type BluetoothOn is not applicable for the arguments. Here is a more complete code of the classes: Main activity: public class MainActivity extends Activity { public void enableBluetooth (View v…
tagged with: android
has title: creating a separate class without a user interface
has answer: http://stackoverflow.com/a/25588370
tagged with: class
has answer: http://stackoverflow.com/a/25588432
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25588705
answer count: 3
has answer: http://stackoverflow.com/a/25588705
tagged with: java
tagged with: android-activity
type: Question
has comment: http://stackoverflow.com/comment/39967316

http://stackoverflow.com/a/25632589
accepted answer of: http://stackoverflow.com/q/25632576
has comment: http://stackoverflow.com/comment/40048783
type: Answer
has comment: http://stackoverflow.com/comment/40049600
score: 4
answers question: http://stackoverflow.com/q/25632576
has comment: http://stackoverflow.com/comment/40049187
has body: assumming both of the type are same List&lt;&gt; could be already an ArrayList&lt;&gt; in that case just change reference if not iterate and add
downvote count: 0
type: AcceptedAnswer
upvote count: 4
has comment: http://stackoverflow.com/comment/40048762

http://stackoverflow.com/q/25673362
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/25673664
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40121834
has comment: http://stackoverflow.com/comment/40122048
favorite count: 0
tagged with: registration
type: Question
has comment: http://stackoverflow.com/comment/40121903
has comment: http://stackoverflow.com/comment/40122125
tagged with: nullpointerexception
downvote count: 3
accepted answer: http://stackoverflow.com/a/25673664
has body: I'm working on connecting mobile app and server Apache. I tried debug and solved all the misspelling, I think. This is my code, please help: @Override protected void onPostExecute(JSONObject json) { // Checks for success message try { Log.e(KEY_ERROR, "Comes to Here"); if (json.getString(KEY_SUCCESS) != null) { registerErrorMsg.setText(""); String res = json.getString(KEY_SUCCESS); String red = json.getString(KEY_ERROR); if (Integer.parseInt(res) == 1) { pDialog.setTitle("Getting Data"); pDialog.setMessage("Loading Info"); registerErrorMsg.setText("Successfully Registerd"); DatabaseHandler db = new DatabaseHandler(getApplicationContext()); JSONObject json_user = json.getJSONObject("user"); // Removes all the previous data in the SQlite database UserFunctions logout = new UserFunctions(); logout.logoutUser(getApplicationContext()); db.addUser(json_user.getString(KEY_FIRSTNAME), json_user.getString(KEY_LASTNAME), json_user.getString(KEY_EMAIL), json_user.getString(KEY_USERNAME), json_user.getString(KEY_UID), json_user.getString(KEY_CREATED_AT)); // Stores registered data in SQLite Database //Launch Registered screen Intent registered = new Intent(getApplicationContext(), Registered.class); // Close all views before launching Registered Screen registered.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); pDialog.dismiss(); startActivity(registered); finish(); } else if (Integer.parseInt(red) == 2) { pDialog.dismiss(); registerErrorMsg.setText("User already exists"); } else if (Integer.parseInt(red) == 3) { pDialog.dismiss(); registerErrorMsg.setText("Invalid Email id"); } else { pDialog.dismiss(); registerErrorMsg.setText("Error occurred in registration"); } } } catch (JSONException e) { e.printStackTrace(); } } } public void NetAsync(View view){ new NetCheck().execute(); } logcat: 09-04 15:07:53.245 1995-1995/com.knedl.testloginapp E/error﹕ Comes to Here 09-04 15:07:53.245 1995-1995/com.knedl.testloginapp D/AndroidRuntime﹕ Shutting down VM 09-04 15:07:53.245 1995-1995/com.kned…
tagged with: android
has title: NullPointerException NetAsync error: App always crashes when on Contacting Server screen
score: -3
tagged with: php
has comment: http://stackoverflow.com/comment/40122514
has comment: http://stackoverflow.com/comment/40121838

http://stackoverflow.com/comment/40005163
type: Comment
score: 0
type: AnswerComment
has text: Sorry Luiggi but I am a beginner here. I use Notepad++ for my codes. Could you please tell me the way to generate Stack Trace ? Thanks in advance.
comment on: http://stackoverflow.com/a/25608800

http://stackoverflow.com/q/25626514
tagged with: robovm
tagged with: java
has title: Cannot access the roboVM settings under preferences in Eclipse
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/40111796
answer count: 0
has comment: http://stackoverflow.com/comment/40037848
score: 0
type: UnansweredQuestion
has body: I just installed the RoboVM plugin in Eclipse and am trying to access the settings from preferences, but I am getting this error: Unable to create the selected preference page. An error occurred while automatically activating bundle org.robovm.eclipse.ui (879). I saw that it may have something to do with not having JDK 7 installed, but I have made sure that JDK 7 is enabled on my system. Here Is the output for JAVA_HOME: $ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home and here is the Java version $ java -version java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode) Am I missing something? Note: I am running this on a mac with mavericks. Edit: Here is the stack trace: org.osgi.framework.BundleException: Error starting module. at org.eclipse.osgi.container.Module.doStart(Module.java:580) at org.eclipse.osgi.container.Module.start(Module.java:439) at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:454) at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107) at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:531) at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:324) at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:311) at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:386) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:336) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:328) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:568) at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.…
linked to: http://stackoverflow.com/q/10352715
has comment: http://stackoverflow.com/comment/40043489

http://stackoverflow.com/comment/39962474
has text: Why do you care for the `*.class` file? Are you sure you're not really interested in the `*.java` file?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25585707
score: 0

http://stackoverflow.com/comment/40007533
type: Comment
has text: That's why it's a "strictly theoretical" question.
comment on: http://stackoverflow.com/a/25610363
score: 3
type: AnswerComment

http://stackoverflow.com/a/25647905
has body: You can use hibernate.hbm2ddl.auto configuration property to make Hibernate generate the tables according to the Hibernate mappings. More information can be found here in the "Miscellaneous Properties" section.
answers question: http://stackoverflow.com/q/25647835
upvote count: 2
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/40180492
has text: Yes, so they need to be made static.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25705209
type: AnswerComment

http://stackoverflow.com/q/25576905
answer count: 1
accepted answer: http://stackoverflow.com/a/25577361
downvote count: 1
has body: I want to read my "@" seperated txt file and write my 2d array. String[][] Array = new String[maxLines][1] row=sentence column=id by the way sorry my broken english. thanks here is my txt file Sözcük Anlamı (1/4)@KyrXKdh00r8 Sözcük Anlamı (2/4)@kwHMZY_KG4Y Sözcük Anlamı (3/4)@y9zQn2_0zg8 Sözcük Anlamı → Söz Yorumu (4/4)@xbUMVW7ru-w Cümle Anlamı (1/3)@RWq2-idYCJ8 Cümle Anlamı (2/3)@b2Ey7KLv980 Cümle Anlamı (3/3)@fd7FFJo_iyw Paragraf (1/4)@E2XP6w7a4Iw Paragraf (2/4)@4xix0HoygXU Paragraf (3/4)@-9XWCKjzNic Paragraf (4/4)@mhS-Cl22LIw Sözcük Türleri → İsim (1/8)@15fYjVVEV8I Sözcük Türleri → Zamirler (2/15)@wqVAscXd9fg Sözcük Türleri → Sıfat I (3/8)@RshzRhWpCUk Sözcük Türleri → Sıfat II (4/8)@bXjWUvDPbIA Sözcük Türleri → Belirteç I (5/8)@-D0GowEK06c Sözcük Türleri → Belirteç II (6/8)@En7lPNgu278 Sözcük Türleri → İlgeç Bağlaç Ünlem I (7/8)@1ab_9yXZ5GA Sözcük Türleri → İlgeç Bağlaç Ünlem II (8/8)@f2KQnfAgQwA Tamlamalar (1/2)@HgXisrprtUI Tamlamalar (2/2)@DmNl2FZfLko here is my sample code: package readfile; import java.io.; import java.util.; public class main { public static void main(String[] args) throws FileNotFoundException { File file = new File("turkce.txt"); Scanner scanner = new Scanner(file); final int maxLines = 100; String[][] resultArray = new String[maxLines][1]; int linesCounter = 0; while (scanner.hasNextLine() &amp;&amp; linesCounter &lt; maxLines) { resultArray[linesCounter] = scanner.nextLine().split("@"); linesCounter++; } scanner.close(); System.out.println(resultArray[1][0]); } } edit my output is resultArray [1][0] is empty (it is my first problem) resultArray [1][0] is S ö z c ü k A n l a m ? ( 2 / 4) (my second problem. its output should be "Sözcük Anlamı (2/4) thanks again
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25577361
type: AnsweredQuestion
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/39946730
upvote count: 0
has title: how to read txt file into 2d array in java?

http://stackoverflow.com/q/25691653
has comment: http://stackoverflow.com/comment/40165064
type: Question
has body: Today I started learning Java GUI and tried to create a simple window on my Ubuntu. I am using jre7 for now. I wrote code exactly from tutorial because from experience there are stuff that doesn't work even if it's correctly typed onto my screen. So, now I used thenewboston's first tutorial with Java GUI. Typed all syntax correctly, classes seems fine, no errors. He got window that was expected - mine only got blank window with no title and no text. Screenshot with that (source: scaleengine.net) Code in JFrames.java file: import java.awt.FlowLayout; // importē plūstošo skatu / default layout import javax.swing.JFrame; // dod iespēju piekļūt pamata logu struktūrai import javax.swing.JLabel; // ļauj rakstīt tekstu logos public class JFrames extends JFrame { private JLabel item1; public JFrames() { super("The Title Of The Program"); // parāda title bar ar tekstu setLayout(new FlowLayout()); item1 = new JLabel("This is sentence with something"); item1.setToolTipText("This is tooltip on hover"); add(item1); // pievieno logam šo lietiņu } } Please, ignore latvian comments, that's just for my reference. So I want to know - why my window appears blank?
type: UnansweredQuestion
has title: Java GUI with JFrames
has answer: http://stackoverflow.com/a/25691687
score: 0
tagged with: java
tagged with: user-interface
answer count: 1
tagged with: swing

http://stackoverflow.com/comment/40177618
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25695841
has text: @MikeM. Thank you, I ended up using user2713030's solution.

http://stackoverflow.com/comment/39915352
type: Comment
comment on: http://stackoverflow.com/a/25560355
has text: Mr. P -- why `./resources/` in particular rather than in a directory with another name? Perhaps you should mention it in your own answer.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25590858
has title: unable to invoke rest cxf service
has body: I am new to RESTful services and I followed the tutorial here. My deployment descriptor web.xml <?xml version="1.0"?> RestDemo contextConfigLocation classpath:com/example/rest/cxf.xml org.springframework.web.context.ContextLoaderListener CXFServlet org.apache.cxf.transport.servlet.CXFServlet CXFServlet /services/* The cxf.xml descriptor: <beans xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <jaxrs:server address="/" id="connectionService"> <jaxrs:serviceBeans> </jaxrs:serviceBeans> <jaxrs:extensionMappings> </jaxrs:extensionMappings> </jaxrs:server> </beans> My Rest service Interface OrderInfo.java: package com.example.rest; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @Path("/Order/") public interface OrderInfo { @GET @Produces("application/xml") @Path("{orderId}") public Order getOrder(@PathParam("orderId") int officeId); @GET @Produces("application/xml") @Path("All") public OrderList getAllOrders(); } The implementation OrderInfoImpl.java. When I am trying to run localhost:8080/RestDemo/services?_wadl, localhost:8080/RestDemo/services/order/1 I get 404 Error.
tagged with: cxf
type: UnansweredQuestion
answer count: 1
tagged with: tomcat
tagged with: rest
tagged with: java
has answer: http://stackoverflow.com/a/25591079
type: Question
score: 0

http://stackoverflow.com/comment/39917591
comment on: http://stackoverflow.com/a/25561558
type: Comment
has text: http://developer.android.com/reference/android/os/Handler.html#postDelayed(java.lang.Runnable, long)
score: 0
type: AnswerComment

jpa
tags question: http://stackoverflow.com/q/25646479
tags question: http://stackoverflow.com/q/25612096
tags question: http://stackoverflow.com/q/25626028
tags question: http://stackoverflow.com/q/25600292
tags question: http://stackoverflow.com/q/25630576
tags question: http://stackoverflow.com/q/25688241
tags question: http://stackoverflow.com/q/25586687
tags question: http://stackoverflow.com/q/25629107
tags question: http://stackoverflow.com/q/25666228
tags question: http://stackoverflow.com/q/25640234
tags question: http://stackoverflow.com/q/25563131
tags question: http://stackoverflow.com/q/25690775
tags question: http://stackoverflow.com/q/25632460
tags question: http://stackoverflow.com/q/25695801
tags question: http://stackoverflow.com/q/25554920
tags question: http://stackoverflow.com/q/25586735
tags question: http://stackoverflow.com/q/25639600
tags question: http://stackoverflow.com/q/25681557
tags question: http://stackoverflow.com/q/25636091
tags question: http://stackoverflow.com/q/25642157
tags question: http://stackoverflow.com/q/25629485
tags question: http://stackoverflow.com/q/25659010
tags question: http://stackoverflow.com/q/25639875
tags question: http://stackoverflow.com/q/25660565
tags question: http://stackoverflow.com/q/25674713
tags question: http://stackoverflow.com/q/25626675
tags question: http://stackoverflow.com/q/25624768
tags question: http://stackoverflow.com/q/25705713
tags question: http://stackoverflow.com/q/25684106
tags question: http://stackoverflow.com/q/25576410
tags question: http://stackoverflow.com/q/25612931
tags question: http://stackoverflow.com/q/25574072
tag name: jpa
tags question: http://stackoverflow.com/q/25684624
tags question: http://stackoverflow.com/q/25581219
tags question: http://stackoverflow.com/q/25571898
tags question: http://stackoverflow.com/q/25574776
tags question: http://stackoverflow.com/q/25640057
tags question: http://stackoverflow.com/q/25691312
tags question: http://stackoverflow.com/q/25595001
tags question: http://stackoverflow.com/q/25700203
tags question: http://stackoverflow.com/q/25615952
tags question: http://stackoverflow.com/q/25618829
tags question: http://stackoverflow.com/q/25689284
tags question: http://stackoverflow.com/q/25553048
tags question: http://stackoverflow.com/q/25600244
tags question: http://stackoverflow.com/q/25643000
tags question: http://stackoverflow.com/q/25571580
tags question: http://stackoverflow.com/q/25630290
tags question: http://stackoverflow.com/q/25629574
tags question: http://stackoverflow.com/q/25572947
tags question: http://stackoverflow.com/q/25710413
tags question: http://stackoverflow.com/q/25632292
tags question: http://stackoverflow.com/q/25639515
tags question: http://stackoverflow.com/q/25649326
tags question: http://stackoverflow.com/q/25712859
tags question: http://stackoverflow.com/q/25619278
tags question: http://stackoverflow.com/q/25623458
tags question: http://stackoverflow.com/q/25559507
type: Tag
tags question: http://stackoverflow.com/q/25664452
tags question: http://stackoverflow.com/q/25616337
tags question: http://stackoverflow.com/q/25684581
tags question: http://stackoverflow.com/q/25640633
tags question: http://stackoverflow.com/q/25576178
tags question: http://stackoverflow.com/q/25552094
tags question: http://stackoverflow.com/q/25664237
tags question: http://stackoverflow.com/q/25627850
tags question: http://stackoverflow.com/q/25623435
tags question: http://stackoverflow.com/q/25703203
tags question: http://stackoverflow.com/q/25701919
tags question: http://stackoverflow.com/q/25690447
tags question: http://stackoverflow.com/q/25596746
tags question: http://stackoverflow.com/q/25643509
tags question: http://stackoverflow.com/q/25597794
tags question: http://stackoverflow.com/q/25633085
tags question: http://stackoverflow.com/q/25668945
tags question: http://stackoverflow.com/q/25597213
tags question: http://stackoverflow.com/q/25640217
tags question: http://stackoverflow.com/q/25681260

http://stackoverflow.com/q/25646891
has body: Lately I've been experementing with java and swing and I run into a problem I have a "Welcome screen" with some random generated background. I overrided paintComponent and made it painting the background based on current JPanel's resolution. Not something fancy just ovals But when I use menu, the background of menu is repainted. The size and potision of ovals are based on screens resolution. There is any way to solve? NOTE: welcome panel is JPanel
type: Question
tagged with: jmenubar
has comment: http://stackoverflow.com/comment/40079659
answer count: 2
downvote count: 0
upvote count: 1
tagged with: jpanel
has comment: http://stackoverflow.com/comment/40075649
tagged with: swing
has comment: http://stackoverflow.com/comment/40075505
accepted answer: http://stackoverflow.com/a/25647228
has answer: http://stackoverflow.com/a/25647228
has comment: http://stackoverflow.com/comment/40073943
has comment: http://stackoverflow.com/comment/40074069
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40079311
has comment: http://stackoverflow.com/comment/40074004
possible better answer: http://stackoverflow.com/a/25647223
score: 1
has title: Java JMenuBar repainting background
has answer: http://stackoverflow.com/a/25647223
tagged with: repaint
favorite count: 0
has comment: http://stackoverflow.com/comment/40077001

http://stackoverflow.com/comment/119527491
score: 1
comment on: http://stackoverflow.com/a/58468010
has text: @algrid I would like to confirm this works on physical device, but on emulator does not. When connection is lost on emulator, onAvaiable is triggered also.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25679850
linked to: http://stackoverflow.com/q/510632
accepted answer: http://stackoverflow.com/a/25680452
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40134082
tagged with: java
answer count: 1
tagged with: concurrency
has comment: http://stackoverflow.com/comment/40133823
has title: Partitioning concurrent HashMap
type: Question
has body: I need to store some values category wise in key-value pair in cache,for eg: category1 = {(k1,v1),(k2,v2)} category1 = {(k3,v3),(k4,v4)} which can be accessed concurrently. I am looking like partitioning the concurrent HashMap, but dont know exactly what data structure to use. Any idea?, Thanks
has comment: http://stackoverflow.com/comment/40134420
has answer: http://stackoverflow.com/a/25680452
tagged with: concurrenthashmap

http://stackoverflow.com/a/25702622
answers question: http://stackoverflow.com/q/25702379
score: 0
type: Answer
has body: You need not use a hashmap . You can just check for the null value and substitute with zero and add and hence merge the values between the two lists. You can avoid 2 get calls by assigning mergeballs.get(0) to an Integer local variable and use it in the conditional expression. Integer result; ArrayList&lt;Integer&gt; hatsMerged = new ArrayList&lt;Integer&gt;(arraylength); // A &amp; B merged for (int o = 0; o &lt; arraylength; o++) { result = ((mergeballs.get(o) == null) ? 0 : mergeballs.get(o)) + ((hats.get(o) == null) ? 0 : hats.get(o)); hatsMerged.add(result); System.out.print(hatsMerged.get(o)); }

http://stackoverflow.com/comment/40061450
comment on: http://stackoverflow.com/a/25639998
type: Comment
score: 0
type: AnswerComment
has text: Sir it would have been better if you just gave the OP the guidelines,not ready to use code.

http://stackoverflow.com/a/25567924
has body: You are using your LinkedList from multiple threads. The javadoc of LinkedList clearly states (in bold) that: Note that this implementation is not synchronized. If multiple threads access a linked list concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally. Your thread name "scares" me: Exception in thread "Thread-742" java.lang.NullPointerException It looks you have many (hundreds?) of threads. You access LinkedList concurrently and chances are high that its internal state gets corrupted. Then Collections.frequency() tries to go over the list using its iterator which hits a null value in its implementation probably due to LinkedList being corrupted. Don't use the LinkedList from multiple threads without proper synchronization.
has comment: http://stackoverflow.com/comment/39928979
has comment: http://stackoverflow.com/comment/39929037
has comment: http://stackoverflow.com/comment/39929344
accepted answer of: http://stackoverflow.com/q/25567375
has comment: http://stackoverflow.com/comment/39929391
type: Answer
answers question: http://stackoverflow.com/q/25567375
has comment: http://stackoverflow.com/comment/39929505
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39929294

http://stackoverflow.com/comment/39941928
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25574421
type: QuestionComment
has text: What's `value` ? Show the log command too.

http://stackoverflow.com/q/25673899
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/25674138
type: UnansweredQuestion
tagged with: selenium-firefoxdriver
downvote count: 0
score: 6
has answer: http://stackoverflow.com/a/47054797
has body: While trying to: WebDriver driver=new FirefoxDriver(); I get the following error: java.lang.NoSuchMethodError: org.openqa.selenium.Proxy.extractFrom(Lorg/openqa/selenium/Capabilities;)Lorg/openqa/selenium/Proxy; at org.openqa.selenium.firefox.FirefoxDriver.dropCapabilities(FirefoxDriver.java:313) at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:191) at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:186) at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:182) at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:95) This problem started right after firefox on ubuntu updated to 32.0 version, I tried to install version 28.0 but still didn't worked. Any ideas? Thanks in advance After changing drivers version to 2.39 like curiosu said, a new error shows: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: pp-system-share:{2e1445b0-2682-11e1-bfc2-0800200c9a66} visible 1409862347400 DeferredSave.extensions.json DEBUG Save changes 1409862347400 DeferredSave.extensions.json DEBUG Save changes 1409862347405 addons.xpi DEBUG Updating database with changes to installed add-ons 1409862347405 addons.xpi-utils DEBUG Updating add-on states 1409862347406 addons.xpi-utils DEBUG Writing add-ons list 1409862347407 addons.xpi DEBUG Registering manifest for /usr/lib/firefox/browser/extensions/langpack-en-ZA@firefox.mozilla.org.xpi 1409862347408 addons.xpi DEBUG Registering manifest for /usr/lib/firefox/browser/extensions/langpack-en-GB@firefox.mozilla.org.xpi 1409862347408 addons.xpi DEBUG Registering manifest for /usr/lib/firefox/browser/extensions/langpack-ar@firefox.mozilla.org.xpi 1409862348534 DeferredSave.extensions.json DEBUG Starting timer 1409862348581 addons.manager DEBUG shutdown 1409862348587 DeferredSave.extensions.json DEBUG Starting write 1409862348587 addons.xpi DEBUG shutdown 140986…
has answer: http://stackoverflow.com/a/25674011
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25680546
has title: java.lang.NoSuchMethodError while creating a FirefoxDriver in java
answer count: 5
has answer: http://stackoverflow.com/a/26103839
linked to: http://stackoverflow.com/q/17919769
tagged with: java
upvote count: 6

http://stackoverflow.com/comment/40515482
has text: Sir!! can u please specify the code to replace a function call. Am not getting which method to call and override. It ll b of grt help sir!
comment on: http://stackoverflow.com/a/25568283
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40136850
type: AnswerComment
comment on: http://stackoverflow.com/a/25680352
type: Comment
has text: I think you missunderstood! Serious error must be fixed immediately! but sometime, with minor error is difference one! Let suppose that, you fix all bug in a program and release it. It cause some minor error but everything still fine! That's what I mean
score: 0

http://stackoverflow.com/comment/39932374
type: AnswerComment
score: 0
type: Comment
has text: This is the only other piece of code i have for drawing the tiles:Texture grass = new Texture(Gdx.files.internal("grass.png")); Texture stone = new Texture(Gdx.files.internal("stone.png")); Texture dirt = new Texture(Gdx.files.internal("dirt.png"));
comment on: http://stackoverflow.com/a/25567844

http://stackoverflow.com/comment/40004851
type: AnswerComment
has text: is it necessary to define the main class and arguments parameters?
comment on: http://stackoverflow.com/a/25605901
type: Comment
score: 0

http://stackoverflow.com/comment/40044577
comment on: http://stackoverflow.com/q/25615332
type: Comment
has text: @Satya The file is saved in HelloWorld.java
score: 0
type: QuestionComment

http://stackoverflow.com/comment/59684665
type: QuestionComment
comment on: http://stackoverflow.com/q/25651456
score: 0
has text: I'm pretty sure the Java progress bar on Mac OS X doesn't support displaying the string for indeterminate progress bars. The behavior on my system is the same. Mac OS X El Capitan.
type: Comment

http://stackoverflow.com/comment/40132161
type: Comment
type: QuestionComment
score: 0
has text: Shift the letter "y" that is the 25th character in alphabet two place, which should be the 27th character in alphabet. Unfortunately, alphabet has only 26 characters. You expect the letter 'a' that is first character in alphabet, you apply modulo operation in your mind. 27 % 26 = 1 . If you use index in the range between 0 to 25, no ArrayIndexOutOfBoudException will be raise.
comment on: http://stackoverflow.com/q/25678955

http://stackoverflow.com/comment/40162049
comment on: http://stackoverflow.com/q/25692692
score: 0
has text: @pavel: the question you provided is not the same, i already have a synchronized block and the block IS synchronized. But the hibernate is not seeing the newly created user.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40180247
type: Comment
type: QuestionComment
has text: This problem doesn't exist in case of declaring exception of type derived from already declared ones because derived exceptions can be caught by `catch` blocks handling their supertypes. Also you can add any RuntimeException because they don't need to be handled.
score: 0
comment on: http://stackoverflow.com/q/25704941

http://stackoverflow.com/comment/40020161
score: 0
has text: Np man. If you apply my answer i will happy. Good Luck.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25615936

http://stackoverflow.com/q/25595844
upvote count: 8
possible better answer: http://stackoverflow.com/a/25759853
has comment: http://stackoverflow.com/comment/39981122
linked to: http://stackoverflow.com/q/4716503
linked to: http://stackoverflow.com/q/25576302
has answer: http://stackoverflow.com/a/25759853
has comment: http://stackoverflow.com/comment/39981300
has comment: http://stackoverflow.com/comment/39981017
has comment: http://stackoverflow.com/comment/39993630
accepted answer: http://stackoverflow.com/a/25595940
has comment: http://stackoverflow.com/comment/40281942
has comment: http://stackoverflow.com/comment/39981052
has answer: http://stackoverflow.com/a/25595940
type: AnsweredQuestion
has title: How to read integers from a file when performance is a concern?
has comment: http://stackoverflow.com/comment/39981106
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39994052
downvote count: 5
has comment: http://stackoverflow.com/comment/39981095
has comment: http://stackoverflow.com/comment/39991455
has body: I'm doing some tasks on CodeEval. Basically the task is very simple: "Print out the sum of all the integers read from the file". My solution is following: import java.io.File; import java.io.IOException; import java.io.BufferedReader; import java.io.FileReader; public class SumIntegersFromFile { public static void main(String args[]) throws IOException{ File file = new File(args[0]); BufferedReader br = new BufferedReader( new FileReader(file)); String line; int i=0; while((line=br.readLine())!=null){ int k = Integer.parseInt(line); i+=k; } br.close(); System.out.println(i); } } But I was told this solution is not optimal from a performance point of view. The code is based on the recommendations in the question Best way to read a text file. The only difference here is I am reading integers instead of strings. What is the most performance-efficient way to read integers from a file in Java?
linked to: http://stackoverflow.com/q/25606833
favorite count: 0
type: Question
answer count: 2

http://stackoverflow.com/comment/40127798
type: Comment
has text: for each `String` in `String[]`, `String` -> `char[]`\ iterate reverse order
type: QuestionComment
comment on: http://stackoverflow.com/q/25676621
score: 1

http://stackoverflow.com/comment/39988868
type: QuestionComment
type: Comment
has text: Got it, Thanks :), I just missed the first comment (JVM)!
score: 0
comment on: http://stackoverflow.com/q/25600061

http://stackoverflow.com/comment/40006472
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25608260
has text: ok. i do understand now. but when the "user" is aware of -D JVM-Options,it should not be a problem to the user to append "-classpath lib\* com.blah.MyClass". I don't think that someone will really benefit by using this Batch-File.
score: 0

http://stackoverflow.com/comment/39949300
score: 1
has text: *"You would have to create an "uberjar""* No you don't. It will work if the LAF is on the run-time class-path of the app. Making an all inclusive Jar is just one way (and not an especially optimal way) to achieve that.
type: Comment
comment on: http://stackoverflow.com/a/25566557
type: AnswerComment

http://stackoverflow.com/q/25583339
has comment: http://stackoverflow.com/comment/39958293
has answer: http://stackoverflow.com/a/25585937
has comment: http://stackoverflow.com/comment/39965916
has answer: http://stackoverflow.com/a/25584690
score: 5
has title: How can I optimize this class that solves this math sequence
linked to: http://stackoverflow.com/q/1306727
accepted answer: http://stackoverflow.com/a/25592720
tagged with: micro-optimization
upvote count: 6
possible better answer: http://stackoverflow.com/a/25584572
answer count: 4
has comment: http://stackoverflow.com/comment/39958579
tagged with: optimization
has comment: http://stackoverflow.com/comment/39958301
has comment: http://stackoverflow.com/comment/39958218
type: AnsweredQuestion
has body: Given an infinite sequence like so (commas inserted to make pattern more apparent): 1, 1 2, 1 2 3, 1 2 3 4, 1 2 3 4 5, 1 2 3 4 5 6 ,1 2 3 4 5 6 7, 1 2 3 4 5 6 7 8, 1 2 3 4 5 6 7 8 9, 1 2 3 4 5 6 7 8 9 1 0, 1 2 3 4 5 6 7 8 9 1 0 1 1, 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2, 1 2 3 . . . . . . . . . . I am given an index (1 &lt;= index &lt;= 10^10) and I need to find what digit is in that index. I have wrote this working code but it is too slow. I have optimized it as much as I can but it's still not enough. Is there any other way I can make this run faster? public class Foo { private static Scanner sc = new Scanner(System.in); private static long input; private static long inputCounter = 0; private static int numberOfInputs; public static void main(String[] args) { numberOfInputs = Integer.parseInt(sc.nextLine().trim()); while (inputCounter != numberOfInputs) { input = Long.parseLong(sc.nextLine().trim()); System.out.println(step()); inputCounter++; } } public static char step() { int incrementor = 1; long _counter = 1L; while (true) { for (int i = 1; i &lt;= incrementor; i++) { _counter += getNumberOfDigits(i); if (_counter &gt; input) { return ((i + "").charAt((int)(input - _counter + getNumberOfDigits(i)))); } } incrementor++; } } private static long getNumberOfDigits(int n) { // 5 or less if (n &lt; 100) { // 1 or 2 if (n &lt; 10) return 1; else return 2; } else { // 3 or 4 or 5 if (n &lt; 1000) return 3; else { // 4 or 5 if (n &lt; 10000) return 4; else return 5; } } } } EDIT: Credit to Marian's method of getting the number of digits in a number. His divide and conquer method which I've named getNumberOfDigits(int n) sped up my program execution a lot. Initially I was converting the number to a String then calling length() and that was taking a lot longer than I expected EDIT2: Some sample I/O: 1 : 1 2 : 1 3 : 2 4 : 1 5 : 2 6 : 3 7 : 1 8 : 2 9 : 3 10 : 4 11 : 1 12 : 2 13 : 3 14 : 4 15 : 5 16 : 1 17 : 2 18 : 3 19 : 4 20 : 5 21 : 6 22 : 1 23 : 2 24 : 3 25 : 4 26 : 5 27 : 6 2…
has comment: http://stackoverflow.com/comment/39958588
has comment: http://stackoverflow.com/comment/39958249
has comment: http://stackoverflow.com/comment/39966040
tagged with: java
has answer: http://stackoverflow.com/a/25592720
downvote count: 1
has comment: http://stackoverflow.com/comment/39958234
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25584572

http://stackoverflow.com/comment/39991682
score: 0
type: AnswerComment
has text: yes this is true but the code is structured like this. All the native methods are pointing to org.libsdl.app.(SDLActivity) And i did not change this i only changed the package name (com.van.gba) In the manifest and the package hierarchy(com.van.gba). I dind't edit the org.libsdl.app package hierarchy. This was my problem ,no native method is pointed to com.van.gba.But still it breaks because of the android manifest package name change. And i could not figure out what the android manifest package name has to do with the files in JNI. (I could not find a single refrence to com.van.gba in the JNI
comment on: http://stackoverflow.com/a/25600494
type: Comment

http://stackoverflow.com/a/25691652
answers question: http://stackoverflow.com/q/25691419
score: 2
upvote count: 3
has body: It sounds like you are looking for a FocusListener. The Text control inherits addFocusListener() etc. from Control, so check the inherited methods section of its API docs.
downvote count: 1
type: Answer

http://stackoverflow.com/comment/40178357
type: AnswerComment
score: 0
has text: So you explaned the question for me, what is the best, async task or executor(Runnable) ( i want build the app for 2.3 until 4.4 android os )?
comment on: http://stackoverflow.com/a/25700980
type: Comment

http://stackoverflow.com/a/25709917
has body: About the iOS part, I found this http://hayageek.com/execute-javascript-in-ios/ import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import sun.org.mozilla.javascript.internal.NativeArray; public class Main { public static void main(String[] args) { try { URL jsUrl = new URL("https://dl.dropboxusercontent.com/u/16258361/urnik/data.js"); Reader reader = new InputStreamReader(jsUrl.openStream()); ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("JavaScript"); // evaluate script engine.eval(reader); System.out.println(Arrays.toString(parseJsArray(engine, "podatki").toArray())); System.out.println(Arrays.toString(parseJsArray(engine, "razredi").toArray())); System.out.println(Arrays.toString(parseJsArray(engine, "ucitelji").toArray())); System.out.println(Arrays.toString(parseJsArray(engine, "ucilnice").toArray())); } catch (Exception e) { e.printStackTrace(); } } public static List&lt;Object&gt; parseJsArray(ScriptEngine engine, String key) { NativeArray jsVar = (NativeArray)engine.get(key); List&lt;Object&gt; list = new ArrayList&lt;Object&gt;((int)jsVar.getLength()); for(int i = 0; i &lt; jsVar.getLength(); i++) { if(jsVar.get(i).getClass().equals(NativeArray.class)) { NativeArray inner = (NativeArray)jsVar.get(i); List&lt;Object&gt; innerList = new ArrayList&lt;Object&gt;((int)inner.getLength()); for(int j = 0; j &lt; inner.getLength(); j++) { innerList.add(inner.get(j)); } list.add(innerList); } else { list.add(jsVar.get(i)); } } return list; } }
has comment: http://stackoverflow.com/comment/40190320
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25704694

http://stackoverflow.com/comment/40080472
type: Comment
type: QuestionComment
score: 0
has text: Transitions sorry ;) but does not fix the error
comment on: http://stackoverflow.com/q/25650424

http://stackoverflow.com/comment/40059766
type: Comment
type: QuestionComment
has text: can you put an example to clarify the question (input and expected result ) ?
comment on: http://stackoverflow.com/q/25638498
score: 1

http://stackoverflow.com/a/25565412
has comment: http://stackoverflow.com/comment/39924779
has comment: http://stackoverflow.com/comment/39924703
upvote count: 1
has body: Its better if you use Scanner Class and read the file word by word: Scanner s = null; try { s= new Scanner(new File("translate.txt")); } catch (FileNotFoundException e) { e.printStackTrace(); } while (s.hasNextLine()) { Scanner s2 = new Scanner(s.nextLine()); boolean b; while (b = s2.hasNext()) { String s1 = s2.next(); System.out.println(s1); } }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25565171
has comment: http://stackoverflow.com/comment/39924762
has comment: http://stackoverflow.com/comment/39924857
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39924384
has comment: http://stackoverflow.com/comment/39924729
accepted answer of: http://stackoverflow.com/q/25565171

http://stackoverflow.com/a/61442829
type: Answer
answers question: http://stackoverflow.com/q/25655404
score: 0
has body: I don't believe that Gson library makes any statements that the JSON output from two equal JSON elements will be the same, mostly due to the order of properties in objects, since the standard doesn't require any kind of order. Gson library itself doesn't offer a functionality to compare JSON elements or serialized representation thereof. One can write a function that will compare two JSON elements and properly descend into the underlying compound structures (i.e. arrays and objects). I was able to find this article here that seems to contain a working comparison function.

http://stackoverflow.com/comment/40029139
comment on: http://stackoverflow.com/a/25616196
has text: OK so what i need to know now is how to display it on screen with the option to print. maybe just send it through to the printer and Windows will show a print preview.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25612702
accepted answer of: http://stackoverflow.com/q/25612524
has body: Restrictions.gt() returns a SimpleExpression which is a Criterion (implements Criterion) So you should not cast a SimpleExpression to a Criteria. You already have a criteria ( You create one criteria which actually transforms into a query and executed on database ), so what you need is: Criteria cr=sn.createCriteria(PC.class); Criterion id=Restrictions.gt("id",11); // No need to cast as SimpleExpression implements Criterion Criterion os= Restrictions.ilike("os","d%"); LogicalExpression and=Restrictions.and(id,os); cr.add(and); A compiler error shows up because you are passing two Criteria objects to and() method of Restriction class but it expects Criterion objects. So change it as above and you are good to do.
type: AcceptedAnswer
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25612524
downvote count: 0

http://stackoverflow.com/q/25617517
tagged with: java
tagged with: hibernate
has title: Function result AS class field value
type: Question
has comment: http://stackoverflow.com/comment/40033913
has comment: http://stackoverflow.com/comment/40027115
accepted answer: http://stackoverflow.com/a/25624756
has answer: http://stackoverflow.com/a/25624756
answer count: 1
downvote count: 0
upvote count: 1
has body: I have PostgreSQL database, in which there is a function month_traffic() CREATE FUNCTION month_traffic(hostcode int) RETURNS numeric(14,2) AS $$ DECLARE start_date date := CAST((EXTRACT(year FROM now()) || '-' || EXTRACT(month FROM now()) || '-' || '01') AS date); end_date date := CAST((EXTRACT(year FROM now()) || '-' || EXTRACT(month FROM now()) + 1 || '-' || '01') AS date); BEGIN RETURN (SELECT SUM(day_mbytes) FROM daily WHERE (day_hstcode = hostcode) AND (day_date &gt;= start_date) AND (day_date &lt; end_date)); END; $$ LANGUAGE plpgsql; I also have Host class package ru.gooamoko.model; import java.io.Serializable; import javax.persistence.Column; 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 javax.persistence.Table; import org.hibernate.annotations.Formula; @Entity @Table(name="hosts") public class Host implements Serializable { @Id @Column(name="hst_pcode") @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; @ManyToOne @JoinColumn(name="hst_grpcode", insertable=false, updatable=false) private Department group; @Column(name="hst_description", length=50, nullable=false) private String description; @Column(name="hst_net", nullable=false) private short net; @Column(name="hst_addr", nullable=false) private short addr; @Column(name="hst_ballance", nullable=false, columnDefinition="numeric(11,2) NOT NULL DEFAULT 0") private float ballance; @Column(name="hst_price", nullable=false, columnDefinition="numeric(5,2) NOT NULL DEFAULT 0") private float price; @Column(name="hst_enabled", nullable=false, columnDefinition="boolean NOT NULL DEFAULT false") private boolean enabled; @Column(name="hst_still", nullable=false, columnDefinition="boolean NOT NULL DEFAULT false") private boolean steel; // daily traffic private transient float dayKBytes = 0; // monthly traffic private transient floa…
favorite count: 0
tagged with: postgresql
type: AnsweredQuestion
score: 1
linked to: http://stackoverflow.com/q/2986318

http://stackoverflow.com/comment/40082155
type: Comment
type: QuestionComment
has text: Order doesn't matter because it is random anyways. As long as each Lottery is stored in a separate element in Game because right now it will store them all in the same element then duplicate that element x amount of times.
comment on: http://stackoverflow.com/q/25651227
score: 0

http://stackoverflow.com/a/25557168
score: 2
has body: how would get all the selected rows Check out the JTable API. You can use the getSelectedRows() method to get the indexes of all the selected rows. Then you write a loop to iterate through the indexes to access the data that you need.
answers question: http://stackoverflow.com/q/25556326
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/52780266
has text: Can you achieve asynchronous implementation in activities using manual completion?
comment on: http://stackoverflow.com/a/25670791
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25670126
has comment: http://stackoverflow.com/comment/40117048
has body: class MyDialogFragment extends DialogFragment{ Context mContext; public MyDialogFragment() { mContext = getActivity(); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mContext); alertDialogBuilder.setTitle("Really?"); alertDialogBuilder.setMessage("Are you sure?"); alertDialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(getApplicationContext(), "CLick-Click!!",Toast.LENGTH_LONG).show(); } }); alertDialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); return alertDialogBuilder.create(); } } To create the dialog call: new MyDialogFragment().show(getFragmentManager(), "MyDialog"); And to dismiss the dialog from somewhere: ((MyDialogFragment)getFragmentManager().findFragmentByTag("MyDialog")).getDialog().dismiss(); OR Try using this snippet: AlertDialog.Builder mDialog = new AlertDialog.Builder(MyClassNane.this); mDialog.setTitle("Title"); mDialog.setMessage("Do you want to delete ?"); mDialog.setPositiveButton("Yes",new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int which) { Toast.makeText(getApplicationContext(), "Click-Click!!",Toast.LENGTH_LONG).show(); } dialog.cancel(); } }); mDialog.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog alert = mDialog.create(); alert.show();
type: Answer
has comment: http://stackoverflow.com/comment/40116738
has comment: http://stackoverflow.com/comment/40117081
has comment: http://stackoverflow.com/comment/40116061
has comment: http://stackoverflow.com/comment/40116937
has comment: http://stackoverflow.com/comment/40115968
answers question: http://stackoverflow.com/q/25670051
has comment: http://stackoverflow.com/comment/40116791
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40116051

http://stackoverflow.com/q/25618957
has comment: http://stackoverflow.com/comment/40023229
has answer: http://stackoverflow.com/a/25618994
accepted answer: http://stackoverflow.com/a/25618994
favorite count: 0
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/40023318
has body: I am trying to send an Html Page through javamail from servlet class Servlet package com.kunal.servlet; import java.io.IOException; import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; 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 CartCheckout */ @WebServlet("/CartCheckout") public class CartCheckout extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public CartCheckout() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub try { Properties props = new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("user","password"); } }); Message message=new MimeMessage(session); message.setFrom(new InternetAddress("user")); message.setRecipients(Message.RecipientType.TO,InternetAddress.parse("Receiver")); message.setSubject("Agro Test"); message.setContent(message.setContent(" \n" + " \n" + "\n" + "\n" + "T…
score: -1
type: AnsweredQuestion
tagged with: jakarta-mail
has title: How to send Html Email using Javamail?
tagged with: java
answer count: 1
downvote count: 1

http://stackoverflow.com/comment/39970724
type: Comment
comment on: http://stackoverflow.com/q/25590139
type: QuestionComment
has text: "to create a new cursor contiain the data in this listview item"...umm...why do you need a new cursor? Are you not using `CursorAdapter`? If not, I strongly suggest that you do. It sounds like you are trying to reinvent the wheel here.
score: 0

http://stackoverflow.com/comment/40279914
type: Comment
type: QuestionComment
has text: I think you should create a view and make it invisible or change its opactity to 0. and it will take space and also transparent. And the area you don't want to show camera but that view over there..
score: 0
comment on: http://stackoverflow.com/q/25660182

http://stackoverflow.com/comment/40095689
comment on: http://stackoverflow.com/q/25658482
has text: 1- Instead of using `System.out.println(sqlException.toString());`, use `sqlException.printStackTrace()`; 2- Don't ignore exceptions
type: QuestionComment
type: Comment
score: 1

thumbnails
tags question: http://stackoverflow.com/q/25681351
tag name: thumbnails
type: Tag
tags question: http://stackoverflow.com/q/25609143

http://stackoverflow.com/q/25655611
type: Question
has answer: http://stackoverflow.com/a/25656459
possible better answer: http://stackoverflow.com/a/25655718
tagged with: finalizer
has title: Check that a method is called before object is collected
accepted answer: http://stackoverflow.com/a/25656459
has comment: http://stackoverflow.com/comment/40090392
type: AnsweredQuestion
score: 0
has body: I have an object that user typically creates using my factory. I want to make sure my user calls object.undo() before they throw it into the garbage collector. This class setups the necessary resources so the user isn't writing to production services and instead use test specific services. The user needs to call undo to revert their override. Here is what I want the user to do // in setup() FooObject object = FooFactory.overrideProductionServicesToTestServices(); // do your testing in test*() // in tearDown() object.undo() Here is what the user end up doing // in setup() FooFactory.overrideProductionServicesToTestServices() // do their testing. Everything works. // Another test, everything breaks How do I notify the user either via throwing an exception or via class design that the user should call undo()?
answer count: 3
has answer: http://stackoverflow.com/a/25655718
tagged with: java
has comment: http://stackoverflow.com/comment/40090341
tagged with: destructor
has answer: http://stackoverflow.com/a/25655906

http://stackoverflow.com/comment/40228523
score: 1
has text: @JohnnyWiller I think that would also work but it's a more egregious lie. The cast in `return (E) array[i]` is okay because the runtime type of `array[i]` must be `E`. The cast in `(E[]) new Object[size]` is never type-correct because `Object[]` and `E[]` are fundamentally different types.
comment on: http://stackoverflow.com/a/25695169
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40008020
type: AnswerComment
comment on: http://stackoverflow.com/a/25599818
has text: This is working but it raises one additional issue that I just want to confirm. I'm doing this in a separate thread so I can't actually render the bitmap until `onPostExecute`. Again - it's working great but I just want to be sure that this isn't creating an additional bitmap when passed into `onPostExecute`. So I understand, Java is only passing a _reference_, so the entire process really only creates one bitmap. Is this correct?
type: Comment
score: 0

http://stackoverflow.com/comment/40125544
score: 0
comment on: http://stackoverflow.com/q/25675173
has text: Is `Code` with a capital C supposed to be `code` in lower case? because they're different identifiers
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25630906
has comment: http://stackoverflow.com/comment/40045673
has comment: http://stackoverflow.com/comment/40046074
has comment: http://stackoverflow.com/comment/40045616
downvote count: 5
has comment: http://stackoverflow.com/comment/40045534
tagged with: stack-overflow
has answer: http://stackoverflow.com/a/25631043
possible better answer: http://stackoverflow.com/a/25631043
type: AnsweredQuestion
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/40045847
has body: I am getting: java.lang.StackOverflowError at tesseract.MazeApplet.reshape(MazeApplet.java:60) at java.awt.Component.setBounds(Unknown Source) at tesseract.MazeApplet.reshape(MazeApplet.java:60) at java.awt.Component.setBounds(Unknown Source) And that repeats all the way down. This is the code that gives the error: public void reshape (int x, int y, int w, int h) { super.setBounds(x, y, w, h); setMaze(); } Also, I am getting a yellow underline beneath stop() on this code: private void stopThread (int index) { if (threads[index] != null) { threads[index].stop(); try { threads[index].join(); } catch (InterruptedException e) {} threads[index] = null; } } I am not really sure why. However I added a @SuppressWarnings("deprecation") to get rid of the underline, and it hasn't come up as a problem. Another spot has the same yellow underline in a separate class beneath Vector: private Vector pending; And here: if (pending.size() &gt; 10 &amp;&amp; prob(dens)) pending.setElementAt(sq, pending.size() - 1); else // not pruning, add pending Sqr to list pending.addElement(sq); } And here: pending = new Vector(); maze[startX = 0][startY = rint(mzHyt - 2) + 1] = FLOOR; dirtySquare(startX, startY); pending.addElement(new Sqr(startX, startY, RIGHT, false, false, false, true)); I would greatly appreciate all the help you all can give.
has comment: http://stackoverflow.com/comment/40045661
has title: Not sure why I am getting a StackOverflowError. Also have a yellow underline under Vector, and 1 other place in code
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25631037
accepted answer: http://stackoverflow.com/a/25631037
has comment: http://stackoverflow.com/comment/40045554
answer count: 2
upvote count: 0

http://stackoverflow.com/comment/40140971
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25663165
has text: @Andrew: i did some more tests! when using JAVA 7, i get **Bitsream Vera Sans**, **DejaVu Sans** , **Dialog.plain** and **SansSerif.plain**! (so there are also differences between J6 and J7 here)

jsoup
tags question: http://stackoverflow.com/q/25619360
type: Tag
tags question: http://stackoverflow.com/q/25619849
tags question: http://stackoverflow.com/q/25710884
tag name: jsoup
tags question: http://stackoverflow.com/q/25586050
tags question: http://stackoverflow.com/q/25629438
tags question: http://stackoverflow.com/q/25590720
tags question: http://stackoverflow.com/q/25643266
tags question: http://stackoverflow.com/q/25586025
tags question: http://stackoverflow.com/q/25631084
tags question: http://stackoverflow.com/q/25617420
tags question: http://stackoverflow.com/q/25677782

http://stackoverflow.com/q/25658330
downvote count: 0
has comment: http://stackoverflow.com/comment/40095258
has comment: http://stackoverflow.com/comment/40095381
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/61198166
linked to: http://stackoverflow.com/q/398953
has comment: http://stackoverflow.com/comment/40095657
accepted answer: http://stackoverflow.com/a/25658502
upvote count: 12
possible better answer: http://stackoverflow.com/a/25658527
has answer: http://stackoverflow.com/a/25658502
has title: Why java.util.Objects private constructor throws assertionError
has comment: http://stackoverflow.com/comment/40095226
type: AnsweredQuestion
score: 12
has comment: http://stackoverflow.com/comment/40095151
has body: I have observed that java.util.Objects has a constructor which is throwing AssertionError. * @since 1.7 */ public final class Objects { private Objects() { throw new AssertionError("No java.util.Objects instances for you!"); } ... This is a static utility class and hence no instance needed. One possible reason I understand is, the developer is trying to ensure that no instance of this class is created. As the only way anyone can call this constructor is by reflection. Is there any other reason to have this kind of constructor?
answer count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40095129
has answer: http://stackoverflow.com/a/25658527

http://stackoverflow.com/a/25710780
has comment: http://stackoverflow.com/comment/40190866
has comment: http://stackoverflow.com/comment/40190313
has comment: http://stackoverflow.com/comment/40191014
has comment: http://stackoverflow.com/comment/40193496
accepted answer of: http://stackoverflow.com/q/25710543
has comment: http://stackoverflow.com/comment/40193683
has comment: http://stackoverflow.com/comment/40192828
has comment: http://stackoverflow.com/comment/40190524
has comment: http://stackoverflow.com/comment/40192894
type: Answer
has comment: http://stackoverflow.com/comment/40192318
has comment: http://stackoverflow.com/comment/40190607
has comment: http://stackoverflow.com/comment/40193263
answers question: http://stackoverflow.com/q/25710543
has comment: http://stackoverflow.com/comment/40192962
has comment: http://stackoverflow.com/comment/40190794
has comment: http://stackoverflow.com/comment/40193624
has comment: http://stackoverflow.com/comment/40194320
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40190541
has comment: http://stackoverflow.com/comment/40194206
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40193708
has body: You implement effects like this: Camera.Parameters parameters = camera.getParameters(); parameters.setColorEffect(Camera.Parameters.EFFECT_AQUA); camera.setParameters(parameters); Docu: http://developer.android.com/reference/android/hardware/Camera.Parameters.html#EFFECT_AQUA Update: Button filterbutton; Button filterbutton = (Button)findViewById(R.id.filterbutton); } filterbutton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { v.setColorEffect(Camera.Parameters.EFFECT_AQUA); }

http://stackoverflow.com/comment/39976440
has text: Can you show some examples of the face ("f") records in your OBJ file? Your parsing code assumes that each face has only 3 vertices, but they can have an arbitrary number of vertices in the OBJ format. If the exporting app only generates faces with 3 vertices, you're fine. Otherwise, you have a problem.
score: 0
comment on: http://stackoverflow.com/q/25586854
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25693828
has title: how can an object be not json serializable?
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25702242
tagged with: gson
score: 0
has comment: http://stackoverflow.com/comment/40173396
has comment: http://stackoverflow.com/comment/40159767
answer count: 1
tagged with: string
tagged with: facebook-graph-api
has body: private FbDataToServer generateFbDataToServer( GraphObject graphObject) { Gson gson = new Gson(); FbDataToServer fbDataToServer = new FbDataToServer(); ֿ fbDataToServer.fbJson = gson.toJson(graphObject .getInnerJSONObject()); Everytime I try to parse FB graphObject object to Json - an error is thrown. How can it be? how can an object be not json serializable? The error said the object is not serializable. I'll try to get reproduce the error again.
type: Question

http://stackoverflow.com/a/25553474
answers question: http://stackoverflow.com/q/25553202
score: 0
has comment: http://stackoverflow.com/comment/39941164
accepted answer of: http://stackoverflow.com/q/25553202
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39940843
type: Answer
has body: This question gets asked often, the answer is to tell weblogic what version it should prefer in your weblogic/application.xml document: &lt;wls:prefer-application-packages&gt; &lt;wls:package-name&gt;com.sun.xml.messaging.saaj.*&lt;/wls:package-name&gt; &lt;/wls:prefer-application-packages&gt; That will force weblogic to use the saaj package in your ear APP-INF/lib directory. Check the Oracle docs here Also see: How to set order of jars in WebLogic? Prevent Weblogic 12c from using system&#39;s slf4j binding Weblogic Configuration - prefer-web-inf-classes

http://stackoverflow.com/q/25655283
tagged with: maven
has comment: http://stackoverflow.com/comment/40309188
score: 4
upvote count: 4
has title: Unsupported Class Version during Maven build in Jenkins
has comment: http://stackoverflow.com/comment/40095352
answer count: 2
tagged with: jdk6
tagged with: java
tagged with: java-7
downvote count: 0
has comment: http://stackoverflow.com/comment/40308813
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/73926311
has body: I've seen a few of these questions on here, but none of the solutions/tips seem to be pointing me in the right direction. So I have 3 JDK's installed in the locations of "/opt/java/6", "/opt/java/7", and "/opt/java/8". All of these are set in the global Jenkins configuration. Jenkins itself is run using Java 8 which is the system default JRE that I set manually through alternatives (I'm using CentOS 7). I had a bunch of old projects that are built using maven and the maven compiler plugin which is set to source=1.6 target=1.6 . Every time I try to execute a build with the Java 6 JDK I get Started by user Antony Prince ln builds/lastSuccessfulBuild /var/lib/jenkins/jobs/BitCalculator/lastSuccessful failed java.nio.file.DirectoryNotEmptyException: /var/lib/jenkins/jobs/BitCalculator/lastSuccessful at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242) at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108) at java.nio.file.Files.deleteIfExists(Files.java:1165) at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at hudson.Util.createSymlinkJava7(Util.java:1194) at hudson.Util.createSymlink(Util.java:1112) at hudson.model.Run.createSymlink(Run.java:1851) at hudson.model.Run.updateSymlinks(Run.java:1832) at hudson.model.Run.execute(Run.java:1743) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529) at hudson.model.ResourceController.execute(ResourceController.java:89) at hudson.model.Executor.run(Executor.java:240) ln builds/lastStableBuild /var/lib/jenkins/jobs/BitCalculator/lastStable failed java.nio.file.DirectoryNotEmptyException: /var/lib/jenkins/jobs/BitCalculator/lastStable at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242) at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.…
has comment: http://stackoverflow.com/comment/40093558
tagged with: jenkins
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/40974690

http://stackoverflow.com/a/25707068
has body: There are many reasons for this to happen- 1. Project has not build properly. Try cleaning your project Check if there any problem in your XML file 2. You have not imported your R file import com.youpackage.name.R 3.You might not have leaderboard_id defined in your String.xml
score: 0
answers question: http://stackoverflow.com/q/25705252
type: Answer

http://stackoverflow.com/q/25711304
type: AnsweredQuestion
has title: SIGAR API not working after packaging to jar/exe
accepted answer: http://stackoverflow.com/a/29179722
answer count: 2
downvote count: 0
upvote count: 1
score: 1
tagged with: java
has body: I am trying to gather system information using the SIGAR API. After including sigar.jar in my library, Netbeans gave the error that sigar-amd64-winnt.dll was not found. After adding that file to the library, it worked perfectly. Now i needed to create an executable jar so I used NetBeans to Build my project. Netbeans automatically deleted the .dll file and after i manually copied it back to the dist folder, my program worked. I am now trying to create an exe file using Launch4j. When i run it, a java exception is thrown, probably because Launch4j deleted the .dll file. How can i make sure Launch4j includes it in the exe file? I browsed through numerous answers on SO but couldnt solve my problem. Have mentioned some below- sigar-amd64-winnt.dll ... can&#39;t reference it or bundle it with .jar How to include SIGAR API in Java Project Any help would be appreciated.. EDIT Launch4j gives the following Exception in its log when i test run the exe wrapper- Exception in thread "main" java.lang.NoClassDefFoundError: org/hyperic/sigar/SigarException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.validateMainClass(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.hyperic.sigar.SigarException at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more
linked to: http://stackoverflow.com/q/12214114
has answer: http://stackoverflow.com/a/43065423
possible better answer: http://stackoverflow.com/a/43065423
favorite count: 0
type: Question
tagged with: launch4j
linked to: http://stackoverflow.com/q/15570047
tagged with: jar
tagged with: sigar
tagged with: exe
has answer: http://stackoverflow.com/a/29179722

http://stackoverflow.com/comment/40019859
comment on: http://stackoverflow.com/a/25611968
score: 0
type: AnswerComment
has text: There are no imports except for `import scala.Option;`
type: Comment

http://stackoverflow.com/q/25567687
accepted answer: http://stackoverflow.com/a/25567796
type: AnsweredQuestion
has title: db.properties - null pointer exception
score: 1
tagged with: java
tagged with: jdbc
tagged with: datasource
tagged with: tomcat6
has answer: http://stackoverflow.com/a/25567796
favorite count: 0
has body: I tried many available answers for related question but none of them was success. Here's my problem, I'm having a dynamic web application and it uses oracle database to retrieve data. To make it nice I'm using a db.properties config file and making a datasource, Here's the code for dataFactory.class: public DataSource getDatasource() { Properties props = new Properties(); FileInputStream fis = null; InputStream in = null; OracleDataSource oracleDS = null; try { fis = new FileInputStream("db.properties"); props.load(fis); oracleDS = new OracleDataSource(); oracleDS.setURL(props.getProperty("url")); oracleDS.setUser(props.getProperty("user")); oracleDS.setPassword(props.getProperty("password")); } catch (IOException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } return oracleDS; } and to make a connection I'm using it in EmployeeDao.class, DataSource ds; EmpDatasourceFactory empDs = new EmpDatasourceFactory(); Connection conn; public boolean insertRecord(Employee emp) { boolean status = false; ds = empDs.getDatasource(); try { conn = ds.getConnection(); //Getting the null point exception } } Note: Please note that I'm having all other codes as necessary. And The problem, When i make a java file and make some methods and use this to make a connection it works fine, i mean when running it as a java application. But when using for a employeeDao.java and run it using apache tomcat server it gives me an error. Please help.!!!
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25599368
downvote count: 0
tagged with: web-applications
has answer: http://stackoverflow.com/a/25599368
upvote count: 1

http://stackoverflow.com/comment/40063162
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/60519/discussion-between-dieend-and-matt).
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25639907

http://stackoverflow.com/comment/40133149
comment on: http://stackoverflow.com/a/25679548
type: AnswerComment
has text: No I meant 4 slashes followed by a space. You need to escape the slash for the regex engine as wel.
score: 0
type: Comment

http://stackoverflow.com/q/25668298
tagged with: java
has answer: http://stackoverflow.com/a/25668439
tagged with: tomcat
has body: I have a scenario specific to tomcat deployment. I have 2 applications /Webapps /Application-1 /Application-2 Here: I want create a single .WAR file to deploy both application and access them independently When Application-1 is alive, bring down only Application-2 for maintenance When Application-2 is ready, deploy using single .WAR created (where it contains 2 applications), however, it should not impact Application-1 This is the challenge thrown at me and I am trying out ways with no solution yet. Appreciate any help to achieve these 3 steps, please. Thanks!!!
type: AnsweredQuestion
tagged with: web-deployment
has comment: http://stackoverflow.com/comment/40112730
accepted answer: http://stackoverflow.com/a/25668439
tagged with: deployment
has title: How to integrate 2 projects into one .WAR, Deploy and Maintain them independently?
type: Question
score: 0
answer count: 1

http://stackoverflow.com/q/25690410
score: 0
answer count: 1
tagged with: jsp
type: Question
has body: I have a set variable "vColspan" which has a value of 4 I also have two if conditionals, that if they are NOT EMPTY, I would like to them to EACH add 1 to vColSpan Then after those two conditional have been checked, I will set the colspan of my table with the variable vColspan. What is the proper syntax to increment a c:set variable? Here is my code so far: &lt;c:set var="vColspan" scope="session" value="4"/&gt; &lt;c:if test="${!empty vs.Data1}"&gt; what do I put here? &lt;/c:if&gt; &lt;c:if test="${!empty vl.Data2}"&gt; and what do I put here? &lt;/c:if&gt; &lt;td colspan="&lt;c:out value="${vColspan}"/&gt;"&gt;
tagged with: conditional-statements
tagged with: java
tagged with: increment
accepted answer: http://stackoverflow.com/a/25690481
has comment: http://stackoverflow.com/comment/40152814
has title: JSP If YES then Increment
has answer: http://stackoverflow.com/a/25690481
type: AnsweredQuestion

embedded-jetty
tag name: embedded-jetty
tags question: http://stackoverflow.com/q/25596030
type: Tag
tags question: http://stackoverflow.com/q/25619208
tags question: http://stackoverflow.com/q/25674206
tags question: http://stackoverflow.com/q/25690543

http://stackoverflow.com/q/25591768
linked to: http://stackoverflow.com/q/1467913
tagged with: for-loop
tagged with: contains
has body: I'm writing a simple Java method. I have instantiated the array to be iterated over int[] j = new int[8]; The array is then populated with random values between 1 and 100. for (int i = 0; i &lt; j.length; i++){ j[i] = (int)(Math.random() * 100); } Now I'm trying to iterate over this loop, while replacing a line when the iteration number is found in the array, using Arrays.asList. I can't figure out why the replacement isn't happening in the following statement. for(int i = 1; i &lt;= 100; i++){ //Iterate over the array if(Arrays.asList(j).contains(i)){ System.out.println(i + " Random Typo"); } else{ System.out.println(i + " I will never spam my friends again."); } } I know that I could loop over the array and compare, but I'd like to get the asList.contains method to work so that the array doesn't have to iterated over 100 times. The output prints "i I will never spam my friends again." on each pass instead of making the replacements. Does anyone see an error in my syntax? I don't have any import errors.
duplicate of: http://stackoverflow.com/q/1467913
score: 2
upvote count: 2
has title: Java Arrays.asList not
tagged with: arrays
downvote count: 0
answer count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25591808
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25591808
tagged with: java

http://stackoverflow.com/comment/40025731
score: 0
type: Comment
has text: I propose that you obtain the DataSource from the script via JNDI if possible
comment on: http://stackoverflow.com/q/25619154
type: QuestionComment

http://stackoverflow.com/q/25645581
has title: How to get position imageView in ListView Android
has comment: http://stackoverflow.com/comment/40071607
has comment: http://stackoverflow.com/comment/40071428
type: Question
tagged with: listener
answer count: 2
type: UnansweredQuestion
tagged with: android
has body: I have a list with pictures for each item, when I click on an image I need the position of the list. how can I get this? I tried to do View.getTag().ToString() but by mistake. Here's the code: ImageView im = (ImageView) convertView.findViewById(R.id.imageViewDSD); im.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { Toast.makeText(contextCustom, "ImageView clicked for the row = " + v.getTag(), Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.i("Error", "errore vista " + e); } } });
tagged with: listview
has answer: http://stackoverflow.com/a/25645618
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25645772

http://stackoverflow.com/comment/40059664
has text: @Aneesh - No. Field by field comparison is not done. instead, hashCode of the key is used.
type: Comment
comment on: http://stackoverflow.com/a/25638260
type: AnswerComment
score: 0

http://stackoverflow.com/q/25604906
tagged with: internet-explorer-11
has comment: http://stackoverflow.com/comment/39998760
has comment: http://stackoverflow.com/comment/39997772
answer count: 0
has title: Premature end of POST data - Ajax with FormData is Broken on IE10 / IE11 in Some Conditions
downvote count: 0
upvote count: 1
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: internet-explorer-10
tagged with: jsp
favorite count: 0
type: Question
tagged with: ajax
has body: I have a JSP application. Wherein a set of data will be sent to an JSP using AJAX request. The issue is, I am getting an error when a data is sent to the JSP in Internet Explorer 11. Whereas it properly works in IE9. IllegalStateException - IOException: Premature end of POST data I couldn't find answers in google, as well as i couldn't reveal the code as its proprietary. Request Class: request EvermindHttpServletRequest response EvermindHttpServletResponse pageContext EvermindPageContext session EvermindHttpSession
has comment: http://stackoverflow.com/comment/39999237
has comment: http://stackoverflow.com/comment/39997837

http://stackoverflow.com/q/25657241
accepted answer: http://stackoverflow.com/a/25758643
has title: Camel, JAXB into ActiveMQ creating XML automatically
has answer: http://stackoverflow.com/a/25758643
tagged with: apache-camel
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 0
tagged with: activemq-classic
tagged with: java
answer count: 1
tagged with: jaxb
has body: I have a Camel route set up as follows: <from uri="file://C:/incoming?noop=true"/> <log message="File Recieved"/> <jaxb contextPath="org.ben.camel.spareparts.model" ignoreJAXBElement="true"/> <log message="Store: ${body.getStore}"/> ${body.getStore} == 2 <log message="New Item from Store 2"/> <bean ref="processor" beanType="org.ben.camel.spareparts.model.StockReportProcessor"/> ${body} <log message="item split!"/> <jaxb contextPath="org.ben.camel.spareparts.model" ignoreJAXBElement="false"/> <to uri="activemq:queue:store2"/> ${body.getStore} == 1 <log message="New Item from Store 1"/> <bean ref="processor" beanType="org.ben.camel.spareparts.model.StockReportProcessor"/> It takes a XML object, splits it by XML elements, and adds the elements to a queue. I'm unmarshalling into a POJO to extract just the element list, which then goes into the split component. My problem is that I can't seem to get the POJO into ActiveMQ without being XML. Even if I try marshalling it into a POJO again before submitting, it still arrives in the MQ as XML. I'm wondering, if I have JAXB annotations on an object which gets put into ActiveMQ, does it automatically convert to XML? If so, how do I stop this?
type: Question

http://stackoverflow.com/comment/39941868
type: AnswerComment
comment on: http://stackoverflow.com/a/25574446
score: 0
type: Comment
has text: why convert string to uri, then back?

method-parameters
tags question: http://stackoverflow.com/q/25631591
tag name: method-parameters
type: Tag

http://stackoverflow.com/q/25637432
type: AnsweredQuestion
has title: How to put result from Async class to mainActivity EditText
has comment: http://stackoverflow.com/comment/40057367
answer count: 3
linked to: http://stackoverflow.com/q/25619809
upvote count: 0
has comment: http://stackoverflow.com/comment/40057523
accepted answer: http://stackoverflow.com/a/25638138
has body: how do i access protected void onPostExecute(String result) { //result } from mainActivity? i wan to set EditText to result final MainActivity mContext=new MainActivity(); EditText showresult=(EditText)mContext.findViewById(R.id.xx); above codes does not show the control from mainActivity. updated code protected void onPostExecute(String result) { EditText ed=(EditText)findViewById(R.id.displayQue); ed.setText(result); } 09-03 15:31:19.882: D/AndroidRuntime(17146): Shutting down VM 09-03 15:31:19.882: W/dalvikvm(17146): threadid=1: thread exiting with uncaught exception (group=0x40d45930) 09-03 15:31:19.992: E/AndroidRuntime(17146): FATAL EXCEPTION: main 09-03 15:31:19.992: E/AndroidRuntime(17146): java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText 09-03 15:31:19.992: E/AndroidRuntime(17146): at com.example.digiqueue.MainActivity$ftpfunctions.onPostExecute(MainActivity.java:106) 09-03 15:31:19.992: E/AndroidRuntime(17146): at com.example.digiqueue.MainActivity$ftpfunctions.onPostExecute(MainActivity.java:1) 09-03 15:31:19.992: E/AndroidRuntime(17146): at android.os.AsyncTask.finish(AsyncTask.java:631) 09-03 15:31:19.992: E/AndroidRuntime(17146): at android.os.AsyncTask.access$600(AsyncTask.java:177) 09-03 15:31:19.992: E/AndroidRuntime(17146): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644) 09-03 15:31:19.992: E/AndroidRuntime(17146): at android.os.Handler.dispatchMessage(Handler.java:99) 09-03 15:31:19.992: E/AndroidRuntime(17146): at android.os.Looper.loop(Looper.java:176) 09-03 15:31:19.992: E/AndroidRuntime(17146): at android.app.ActivityThread.main(ActivityThread.java:5365) 09-03 15:31:19.992: E/AndroidRuntime(17146): at java.lang.reflect.Method.invokeNative(Native Method) 09-03 15:31:19.992: E/AndroidRuntime(17146): at java.lang.reflect.Method.invoke(Method.java:511) 09-03 15:31:19.992: E/AndroidRuntime(17146): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:11…
possible better answer: http://stackoverflow.com/a/25637478
downvote count: 1
has comment: http://stackoverflow.com/comment/40056971
favorite count: 0
has comment: http://stackoverflow.com/comment/40056980
type: Question
has answer: http://stackoverflow.com/a/25638138
has answer: http://stackoverflow.com/a/25637478
has comment: http://stackoverflow.com/comment/40057915
tagged with: android
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40057753
has answer: http://stackoverflow.com/a/25637537

http://stackoverflow.com/a/25690859
has comment: http://stackoverflow.com/comment/40154159
answers question: http://stackoverflow.com/q/25690775
has comment: http://stackoverflow.com/comment/40153868
type: Answer
has body: you put the annotation @MappedSuperClass above class A. The field id has to be annotated in clas A not B.
score: 0
has comment: http://stackoverflow.com/comment/40154030

http://stackoverflow.com/q/25703996
score: 0
has answer: http://stackoverflow.com/a/25704117
linked to: http://stackoverflow.com/q/9082407
answer count: 1
tagged with: maven
has title: Using an XSD from dependency
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/25704117
has body: I have a webservice that will be referring to an XSD file that is in another project (imported as a dependency). I am able to pull the XSD in using the plugin in the following post. However, this pulls it directly into the source. I would rather have it added to the build directory to avoid committing the file. If I extract the xsd to my existing project structure: schema It shows up in the .jar. However, if I extract it to the build directory: ${project.build.directory}/generated/schema It does not show up in the .jar (even if I add it to the build path). I think I am missing some fundamental understanding of the maven lifecycle. What do I need to do in order to get a file into the .jar while keeping the file in the build directory?
type: AnsweredQuestion

http://stackoverflow.com/comment/40128219
has text: @Takendarkk This seems to be more of a conceptional question: Why does this algorithm solve the problem at hand? To me it's not immediately obvious what the idea behind it is even though I understand exactly what each line does individually
type: Comment
comment on: http://stackoverflow.com/q/25676463
score: 2
type: QuestionComment

http://stackoverflow.com/comment/40190868
comment on: http://stackoverflow.com/q/25711035
type: Comment
type: QuestionComment
has text: @fgb : yes tomcat 7.0
score: 0

http://stackoverflow.com/comment/39984884
type: QuestionComment
comment on: http://stackoverflow.com/q/25597821
type: Comment
has text: also, casting a float to an int does _not_ do rounding, it does truncation.
score: 0

http://stackoverflow.com/comment/39918860
type: Comment
has text: @user20432 questin is getting misunderstood here, please ass more details as what value you want to show in dropdown and in which all scenarios, like when u open a popup, or after adding one, now what.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25562114

http://stackoverflow.com/comment/46907610
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25626189
has text: I am also having the same problem but grouping does not solve my problem as there are authors with the same name exist and also authors have to be listed in a particular sequence in the report. Any solution for this? kindly help me.

http://stackoverflow.com/a/25685506
answers question: http://stackoverflow.com/q/25684902
type: Answer
has body: Some observations from me (actually 3 years in Java EE): Advantages: you can add some extra validation or logic in setters methods you can avoid to use reflection in junit testing for some special cases setters can be overridden so you can inject something else Disadvantages: in most cases this validation is not necessary because you are injecting another services you have to have a lot of useless setters and getters in your code. For example in my code I am using normally about 5 DAO classes per service so this is 10 extra methods to write which gives me about 60 extra lines. mostly you do not need to inject another DAO or Service after the application is initialized. setters/ getters can not be used later because in spring you are working on interfaces rather than concrete implementations. It is a bad practice to have setters and getters on interfaces. Personally I prefer instance variable or constructor injections. But this is service dependent. I would not say that using setters is better. It has just different purposes.
accepted answer of: http://stackoverflow.com/q/25684902
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/39909275
type: AnswerComment
has text: @NikDesai: See my edit - you're not printing the current contents of the array... you're printing the same string you printed earlier.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25557167

http://stackoverflow.com/comment/40081336
type: AnswerComment
has text: Unfortunately this does not work. Putting `slf4j` and `log4j.properties` does not change anything. What is loaded by Hibernate 4.3.6 is `jboss-logging-3.1.3.GA.jar` which contains the default logger for this Hibernate's version.
comment on: http://stackoverflow.com/a/25650792
score: 0
type: Comment

http://stackoverflow.com/q/25598406
possible better answer: http://stackoverflow.com/a/44937647
has title: Spring annotation @Autowired inside methods
accepted answer: http://stackoverflow.com/a/25599009
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25599009
answer count: 2
downvote count: 0
tagged with: spring
has answer: http://stackoverflow.com/a/44937647
type: AnsweredQuestion
has body: @Autowired can be used with constructors, setter and class variables. How can I use the @Autowired annotation inside a method or any other scope.? I tried the following, but it produces compilation errors. For example public classs TestSpring { public void method(String param){ @Autowired MyCustomObjct obj; obj.method(param); } } If this is impossible, is there any other way to achieve ? (I used Spring 4.)
tagged with: dependency-injection
score: 21
tagged with: java
upvote count: 21

http://stackoverflow.com/comment/40109350
comment on: http://stackoverflow.com/a/25666547
type: AnswerComment
has text: If you set it and the main module all the children will inherit that.
score: 1
type: Comment

javafx-8
tags question: http://stackoverflow.com/q/25704312
tags question: http://stackoverflow.com/q/25705847
tags question: http://stackoverflow.com/q/25595120
tags question: http://stackoverflow.com/q/25673115
tags question: http://stackoverflow.com/q/25561119
tags question: http://stackoverflow.com/q/25572470
tags question: http://stackoverflow.com/q/25578720
tags question: http://stackoverflow.com/q/25657890
tag name: javafx-8
tags question: http://stackoverflow.com/q/25603773
type: Tag
tags question: http://stackoverflow.com/q/25622515
tags question: http://stackoverflow.com/q/25663983
tags question: http://stackoverflow.com/q/25591991
tags question: http://stackoverflow.com/q/25689845
tags question: http://stackoverflow.com/q/25595677
tags question: http://stackoverflow.com/q/25623893
tags question: http://stackoverflow.com/q/25601266
tags question: http://stackoverflow.com/q/25656094
tags question: http://stackoverflow.com/q/25650726
tags question: http://stackoverflow.com/q/25678242

http://stackoverflow.com/q/25641118
tagged with: executable-jar
type: Question
has body: I have created some Java applications to extend Rhapsody using Java API and I have deployed them successfully to the Rhapsody environment (Right click on the project -> Apps). I can see the exported .jar files under the directory RhapsodyApps/apps. My question is, How can I run them from the command line (Under windows 7)??? Thank you in advance
has title: Run a jar Rhapsody app file
type: UnansweredQuestion
tagged with: rhapsody
score: 0
has answer: http://stackoverflow.com/a/25664872
tagged with: java
answer count: 1

http://stackoverflow.com/a/25628573
score: 0
answers question: http://stackoverflow.com/q/25628161
has body: As Jigar already mentioned your package name is testpkg you need to create a folder by the name of testpkg and save the class inside it. Now suppose your .java file is saved in D:/testpkg for compiling the program open the terminal at D:/ then compile it using javac testpkg/simple.java and execute it like this java testpkg.simple
type: Answer

http://stackoverflow.com/comment/40056176
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25630589
has text: Consuming memory could be from blinking caret. Each blink calls repaint and asks for current caret rectaangle. After repaint the rectangle (and some more objects) are freed. I don't see any memory leaks in your code. Try to call multiple System.gc() and check used memory after the calls.

http://stackoverflow.com/q/25683126
has comment: http://stackoverflow.com/comment/40139891
answer count: 0
has title: Struts 2 Autocompleter tag
score: 1
tagged with: java
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40141245
type: UnansweredQuestion
tagged with: autocomplete
has comment: http://stackoverflow.com/comment/40139999
upvote count: 1
has comment: http://stackoverflow.com/comment/40143671
has body: I use struts 2 Autocompleter for my web application, but it limit only 30 option list which return from my ajax method. I want to use resultsLimit to change the limitation and it doesn't work at all. here is my struts tag for Autocompleter: &lt;s:autocompleter theme="qajax" id="payerBox" name="payerProfileName" keyName="selectPayerCatProfileTypeId" formId="confirm" autoComplete="false" forceValidOption="true" listenTopics="/payerCategoryTypeChanged" required="true" href="%{#loadPayerCategory}" resultsLimit="-1" &gt; &lt;/s:autocompleter&gt; Please help guiding me with this.
tagged with: struts2

http://stackoverflow.com/q/25688061
type: UnansweredQuestion
tagged with: android
tagged with: web-services
has body: I'm creating an Android app and I have to connect with the web service from my company to do the login system, I'm using 3.3.0 KSOAP2 lib. The path of my WS is such as: http://www.dominio.com/servicos/ws.asmx My problem happens: 09-04 10:57:52.835: W/System.err(19717): SoapFault - faultcode: 'soap:Client' faultstring: 'Server did not recognize the value of HTTP Header SOAPAction: http://www.dominio.com/servicos/ObterIdentificadorLoja.' faultactor: 'null' detail: org.kxml2.kdom.Node@428e60d0 Variables stored for the connection: private final String NAMESPACE = "http://tempuri.org/"; private final String URL = "http://www.dominio.com/servicos/ws.asmx"; private final String SOAP_ACTION = "http://tempuri.org/ObterIdentificadorLoja"; private final String METHOD_NAME = "ObterIdentificadorLoja"; private String TAG = "LOGAR"; My WSDL is: &lt;wsdl:operation name="ObterIdentificadorLoja"&gt; &lt;soap:operation soapAction="http://tempuri.org/ObterIdentificadorLoja" style="document"/&gt; Source .Java code full: package com.testes.infovendas; //Imports import android.support.v7.app.ActionBarActivity; import android.os.AsyncTask; import android.os.Bundle; //KSOAP2 -- Lib de conexão Webservice SOAP import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapPrimitive; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; //Adicionais import com.testes.infovendas.R; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class InfoVendas extends ActionBarActivity { //Variáveis private final String NAMESPACE = "http://tempuri.org/"; private final String URL = "http://www.dominio.com/servicos/ws.asmx"; private final String SOAP_ACTION = "http://tempuri.org/ObterIdentificadorLoja"; private final String M…
score: 0
tagged with: java
answer count: 1
type: Question
has title: Accessing Webservice by Android - KSOAP2
has answer: http://stackoverflow.com/a/25688441

http://stackoverflow.com/comment/40131042
type: QuestionComment
has text: I was thinking along the lines of having a url.get() method that includes: URLConnection conn = url.openConnection(); conn.setDoInput(true); conn.connect();
comment on: http://stackoverflow.com/q/25678348
score: 0
type: Comment

http://stackoverflow.com/q/25602206
score: 0
answer count: 2
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/25602536
has comment: http://stackoverflow.com/comment/39994118
type: Question
has title: How can I obtain some order in and multi-thread reading queue
has answer: http://stackoverflow.com/a/25602550
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39992860
has body: In my app, I would receive some user data, putting them into an ArrayBlockingQueue, and then put them into a database. Here several threads are used for 'getting the data from the queue and putting it into database'. Then an issue came up. The database is used to store each user's current status, thus the data's time sequence is very important. But when using multi threads to 'get and put', the order can not be ensured. So I came up with an idea, it's like 'field grouping': for different users' data, multi-threads is fine, the order between them can be ignored; but each user's data must be retrieved by the same thread. Now the question is, how can I do that?

http://stackoverflow.com/comment/39974653
type: Comment
type: QuestionComment
score: 5
has text: You've posted way too much code, no one will read that all. Try to get a more precise question and only link the relevant parts of the code that you are unsure of.
comment on: http://stackoverflow.com/q/25592312

http://stackoverflow.com/q/25656445
has title: Linked List from scratch. Trouble with header and footer
has body: So I just started coding a Double Linked List in Java. For some reason, the header is not pointing to the footer when I create the linked list (or at least I don't think it is). When I create the linked list, I just want to create a header and a footer, with the header pointing to the footer, and the footer pointing to the header: public class ListNode //inner class { T data; ListNode prev; ListNode next; public ListNode(T data, ListNode prev, ListNode next) { this.data = data; this.prev = prev; this.next = next; } } ListNode header; ListNode footer; public LinkedList() { header = new ListNode(null, null, footer); footer = new ListNode(null, header, null); } I ran a simple test, just to see if this worked (this is all in the LinkedList class still): public void test() { if(header.next == footer) { System.out.println("reached"); } if(footer.prev == header) { System.out.println("reached2"); } } public static void main(String args[]) { LinkedList&lt;Integer&gt; list = new LinkedList&lt;Integer&gt;(); list.test(); } Output: reached2 So its saying that the footer's previous pointer is pointing to the header, but the header is not pointing to the footer. Am I missing something really stupid here?
type: AnsweredQuestion
tagged with: java
downvote count: 0
accepted answer: http://stackoverflow.com/a/25656514
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25656514
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40091912
type: Question
tagged with: doubly-linked-list

http://stackoverflow.com/q/25579825
has comment: http://stackoverflow.com/comment/39952329
has answer: http://stackoverflow.com/a/27569375
has comment: http://stackoverflow.com/comment/39952658
type: Question
has comment: http://stackoverflow.com/comment/39953321
has comment: http://stackoverflow.com/comment/39952552
has title: Adding all the rows from jTable to MS SQL server DB using Hibernate
has comment: http://stackoverflow.com/comment/39952520
has body: I need to insert all the rows in the jTable to MS SQL server DB. I am using hibernate for the same. Here is the code which I had tried. If I am trying to print the spname, vreq, vcol, cnname, and sta, it is printing but I am unable to load these values into the DB because the loop is working only once, so it is inserting only once. I need to load several values of spname, vreq, vcol, cnname, and sta to the same Labitemcode. It will be helpful if anyone help me in this issue. try { queries(); Login.session = Login.sessionfactory.openSession(); Login.session.beginTransaction(); for (int row = 0; row &amp;lt; jTable3.getRowCount(); row++) { TstSpecimenPojo tsp = new TstSpecimenPojo(); String spname = (String) jTable3.getModel().getValueAt(row, 0); String vreq = (String) jTable3.getModel().getValueAt(row, 1); String vcol = (String) jTable3.getModel().getValueAt(row, 2); String cnname = (String) jTable3.getModel().getValueAt(row, 3); int sta = (int) jTable3.getModel().getValueAt(row, 4); tsp.setLabitemcode(Labitemcode); tsp.setSpecimenid(spname); tsp.setVolreq(vreq); tsp.setVolcol(vcol); tsp.setContid(cnname); tsp.setTststatus(sta); Login.session.save(tsp); } Login.session.getTransaction().commit(); } catch (HibernateException e) { System.out.println(e.getMessage()); } Result of printStackTrace() org.hibernate.exception.DataException: could not insert: [POJO.TstSpecimenPojo] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:40) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48) at org.hibernate.engine.ActionQueue.execute(Ac…
has comment: http://stackoverflow.com/comment/39954740
tagged with: swing
accepted answer: http://stackoverflow.com/a/27569375
tagged with: sql-server
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39952641
has comment: http://stackoverflow.com/comment/39952483
tagged with: sql
tagged with: java
tagged with: hibernate
answer count: 1
has comment: http://stackoverflow.com/comment/39952619
has comment: http://stackoverflow.com/comment/39952505

http://stackoverflow.com/comment/63221443
type: QuestionComment
has text: Found any solution?
comment on: http://stackoverflow.com/q/25580065
score: 0
type: Comment

http://stackoverflow.com/comment/39960533
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25572364
type: AnswerComment
has text: Hi, I have followed the steps provided. I have create a one.war file from my own jar files. Now I have edited the other web applications manifest file and I have added the reference to the jars of my one.war file. Now when run this web application I got the error saying Class Not found.

http://stackoverflow.com/q/25696069
answer count: 1
has comment: http://stackoverflow.com/comment/40174117
tagged with: jaxb
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/40172774
score: 5
has answer: http://stackoverflow.com/a/25698521
has body: I want to translate a complicated set of xsd files into Java/Hibernate entities. Towards that end, I downloaded version 2.2.7 of JAXB from this link. I unzipped the file, opened cmd.exe, navigated to the directory of the create-marshal sample, ran ant compile to confirm everything works, then ran ant clean to eliminate the results to return everything to starting conditions. The problem came when I tried to use a different xsd file as the input for the create-marshal sample. Specifically, I am getting an error when the xsd file distinguishes between data structures by changing the value of an attribute of the same tag type. The create-marshal sample gives the following error in that case: [ERROR] 'POCD_MT000040.InfrastructureRoot.typeId' is already defined [xjc] line 54 of file:/C:/Temp/jaxb/apps/create-marshal/POCD_MT000040_SDTC.xsd The error repeats again and again, once for every time that the value of the attribute is re-assigned for a different data structure definition. How can I resolve this error? Here are the first few iterations of the data structure in the xsd file: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <xs:schema targetNamespace="urn:the-publisher:v3" xmlns:mif="urn:the-publisher:v3/mif" xmlns="urn:the-publisher:v3" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:sdtc="urn:the-publisher:sdtc"> <xs:annotation> <xs:documentation>Manually edited to add Schema Extensions, July 2012</xs:documentation> <xs:documentation>Generated using schema builder version 2.0. Stylesheets: RoseTreeToMIFStaticModel.xsl version: 1.1 StaticMifToXsd.xsl version 2.0</xs:documentation> </xs:annotation> <xs:complexType name="POCD_MT000040.InfrastructureRoot.typeId"> <xs:complexContent> <xs:restriction base="II"> <xs:attribute name="root" type="uid" use="required" fixed="2.16.840.1.113883.1.3"/> <xs:attribute name="extension" type="st" use="required"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="PO…
upvote count: 5
tagged with: ant
downvote count: 0
has comment: http://stackoverflow.com/comment/40174214
tagged with: xsd
has comment: http://stackoverflow.com/comment/40175115
accepted answer: http://stackoverflow.com/a/25698521
type: AnsweredQuestion
has title: already defined error when converting xsd to java
tagged with: java

http://stackoverflow.com/comment/40188168
type: Comment
has text: For insertion we first need to free the location and for that we have to move every element after insertion point to its next location.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25705561

http://stackoverflow.com/comment/40000697
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25606355
has text: Ok, thanks, I'll check how that cursor adapter works.

http://stackoverflow.com/comment/40100687
type: Comment
has text: In the dialog (from the project menu) you can choose between all and selected projects to clean. (I don't have clean in the context menu.)
type: AnswerComment
comment on: http://stackoverflow.com/a/25661438
score: 0

http://stackoverflow.com/comment/39932150
has text: From your description, isn't it enough to just firstly check if there is a conflicting entry on any level?
type: Comment
comment on: http://stackoverflow.com/q/25569437
type: QuestionComment
score: 2

http://stackoverflow.com/a/62968029
has body: use this switch.setChecked(true); // first set value (from pref or server or anywhere) and than switch.setOnCheckedChangeListener (this); add listener.
answers question: http://stackoverflow.com/q/25642052
type: Answer
score: -1
upvote count: 0
downvote count: 1

http://stackoverflow.com/comment/40282394
type: Comment
score: 0
has text: If you add the files somewhere so I can have a look at them I will probably find the error :D
type: QuestionComment
comment on: http://stackoverflow.com/q/25676779

http://stackoverflow.com/comment/40065706
score: 0
type: Comment
type: QuestionComment
has text: @greg-449 I added my content provider code
comment on: http://stackoverflow.com/q/25640336

http://stackoverflow.com/a/25592056
score: 0
has comment: http://stackoverflow.com/comment/39974235
type: Answer
answers question: http://stackoverflow.com/q/25591762
has comment: http://stackoverflow.com/comment/39974221
has body: Use Jenkins with testng set after test to close the browser @AfterSuite(alwaysRun = true) public void closeBrowser(WebDriver driver) { if (driver != null) { driver.close(); driver.quit(); driver = null; } }
has comment: http://stackoverflow.com/comment/39974248

http://stackoverflow.com/q/25625867
type: Question
has comment: http://stackoverflow.com/comment/40036021
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40036096
has title: Is it inefficient to use nested Maps to sort and group data?
has answer: http://stackoverflow.com/a/25626040
tagged with: performance
has body: I have a bunch of objects that I want to group (by category) and sort (by label). Would it be a bad idea to do something like this? Map&lt;String,Map&lt;String,MyObject&gt;&gt; objMap = new HashMap(); for (MyObject o : getMyObjects()) { if (!objMap.containsKey(o.getCategory())) { objMap.put(o.getCategory(), new TreeMap()); } objMap.get(o.getCategory()).put(o.getLabel(), o); } I like this because it is simple, but is there a better way? EDIT: changed HashMap to TreeMap.
has comment: http://stackoverflow.com/comment/40036102
accepted answer: http://stackoverflow.com/a/25626074
tagged with: sorting
tagged with: dictionary
answer count: 4
linked to: http://stackoverflow.com/q/10804825
has answer: http://stackoverflow.com/a/25626007
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25626099
has answer: http://stackoverflow.com/a/25626074
has comment: http://stackoverflow.com/comment/40036218
has comment: http://stackoverflow.com/comment/40036025
possible better answer: http://stackoverflow.com/a/25626007

http://stackoverflow.com/q/25646290
score: 0
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/40072692
type: UnansweredQuestion
answer count: 1
has title: Running a Java application from my desktop generates a "Could not find main class" error
has body: I currently use Eclipse to maintain my java application. I can run the application from Eclipse without any problems. I can also run the Ant build successfully. However, after I install the java application on my desktop, I receive the "Java Virtual Machine Launcher: Could not find main class..." error. What could cause this error at run time? Any help is much appreciated.
has answer: http://stackoverflow.com/a/25646379

http://stackoverflow.com/comment/40106053
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25664752
has text: Googling the question title gives a great answer in the very first link. This should get downvoted into oblivion for "Lack of research effort"
score: 0

http://stackoverflow.com/a/25701769
upvote count: 3
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25701601
has body: For a starter this should help Ship s=new Ship(); int i=s.getCounter(); String value=String.valueOf(i); counterText.setText(value);
type: Answer

http://stackoverflow.com/comment/40118949
type: Comment
type: QuestionComment
has text: Why can't your friend install Java 7? Can't you just use an older version of eclipse?
score: 0
comment on: http://stackoverflow.com/q/25671774

http://stackoverflow.com/comment/40140042
type: AnswerComment
has text: I've also run a tracert command on both storage.googleapis.com and the googserv_hostnames from the gsutil perfdiag log file. For storage.googleapis.com there are 17jumps, 10 of which have over 100ms. For the ip from googserv_hostnames there are 14 jumps, 9 of which have over 30-40ms.
score: 0
comment on: http://stackoverflow.com/a/25648169
type: Comment

http://stackoverflow.com/comment/40169187
comment on: http://stackoverflow.com/a/25699099
type: Comment
type: AnswerComment
score: 0
has text: Yeah I will do that.. but how to i remove that error/

http://stackoverflow.com/q/25666769
answer count: 0
has title: RmiProxyFactoryBean afterPropertiesSet() throwing exception
type: Question
has body: I have a question about this method &amp; I was hoping someone here could help. I have looked up the API &amp; various posts about this but there is still something I am not sure of. RmiProxyFactoryBean API When this method throws an exception due to a misconfiguration, is it a misconfiguration of the RmiProxyFactoryBean object that I have created, or a misconfiguration of the service I am trying to connect to? Any help would be appreciated. Thanks!
has comment: http://stackoverflow.com/comment/40110166
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40109990
tagged with: rmi
tagged with: java
tagged with: spring
score: 0

http://stackoverflow.com/comment/39926158
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25564880
has text: org.ibex.classgen.CGConst is related to sqlite as far as I can say. You might be missing something in your classpath that is required for what you're trying to use.
score: 0

http://stackoverflow.com/q/25695083
score: -4
has answer: http://stackoverflow.com/a/25695272
has comment: http://stackoverflow.com/comment/40162038
tagged with: adapter
downvote count: 5
has answer: http://stackoverflow.com/a/25695151
accepted answer: http://stackoverflow.com/a/25695151
tagged with: arraylist
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/40161966
answer count: 3
has comment: http://stackoverflow.com/comment/40161973
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40174186
has answer: http://stackoverflow.com/a/25695162
possible better answer: http://stackoverflow.com/a/25695162
has body: I don't understand why it is always null at one place in the code. Furthermore I don't have a solution for adding Strings from the Database to a List public List&lt;String&gt; dbToString() { // list where all Strings should be saved for an adapter List&lt;String&gt; allNamesTodos = null; // getting List von database with all Items List&lt;DB_Item&gt; allItems = dbHelper.getAllItems(); for (int j = 0; j &lt; allItems.size(); j++) { // here says the code, that allNamesTodos is null... // Null pointer access: The variable allNamesTodos can only be null at this location allNamesTodos.add(allItems.get(j).getName()); } return allNamesTodos; and here is the one with the adapter: SortItems sortTodos = new SortItems(this); List&lt;String&gt; todos = sortTodos.dbToString(); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.items, R.id.label, todos); hope, you can help me, thank you :)
favorite count: 0
type: Question
has title: List is Null and adding Strings to that List does not work
upvote count: 1

http://stackoverflow.com/comment/40100364
has text: Nopes.. Please run your code. It returns the error code which is 2. I have attached the answer. Please find it.
type: Comment
comment on: http://stackoverflow.com/a/25639971
score: 0
type: AnswerComment

http://stackoverflow.com/q/25593631
type: AnsweredQuestion
upvote count: 2
tagged with: android-ion
accepted answer: http://stackoverflow.com/a/25593724
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25593724
favorite count: 0
type: Question
has title: Iterate over HTML tags
tagged with: android
has body: I am developing some kind of RSS application: the app downloads the content provided by a RSS feed and shows it to the user. The post's content has tags like p, img and h2, I want to iterate (in order) over them and create TextView's and ImageView's depending of the tag. For example, I want to show this HTML code: Some text A lot of text as <TextView /> <ImageView /> <TextView /> I think Jsoup is an option, but I am not sure how to use it or if Android includes a native solution. I also want to incorporate lacy download for images, and I've found the Ion library, but maybe for my use there are more simple solutions EDIT: As @Vogabe suggested, I am iterating over the tags using Jsoup. This is the code, maybe someone can find it useful Document document = Jsoup.parse(htmlContent); Elements elements = document.getAllElements(); for (Element element:elements) { Tag tag = element.tag(); if (tag.getName().equalsIgnoreCase("p")) { // ... } }
tagged with: java
score: 2

http://stackoverflow.com/a/25604448
upvote count: 28
has comment: http://stackoverflow.com/comment/39999668
has comment: http://stackoverflow.com/comment/39999618
has comment: http://stackoverflow.com/comment/40000992
has comment: http://stackoverflow.com/comment/39998670
type: Answer
has comment: http://stackoverflow.com/comment/39998150
answers question: http://stackoverflow.com/q/25604215
has body: In order for the full Spring MVC configuration to get activated, you need to use MockMvcBuilders.webAppContextSetup instead of MockMvcBuilders.standaloneSetup. Check out this part of the Spring documentation for more details. Your code would look like: @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration("test-config.xml") public class ClientQueriesControllerTest { private MockMvc mockMvc; @Autowired private WebApplicationContext webApplicationContext; @Autowired private AuthenticationService authenticationService; @Before public void setup() { MockitoAnnotations.initMocks(this); mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); } @Test public void findAllAccountRelatedClientsUnauthorized() throws Exception { when(authenticationService.validateAuthorization(anyString())).thenThrow(AuthenticationException.class); mockMvc.perform(get("/rest/clients").header("Authorization", UUID.randomUUID().toString())) .andExpect(status().isUnauthorized()); } } Then inside test-config.xml you would add a Spring bean for AuthenticationService that is a mock. &lt;bean id="authenticationService" class="org.mockito.Mockito" factory-method="mock"&gt; &lt;constructor-arg value="your.package.structure.AuthenticationService"/&gt; &lt;/bean&gt; You could of course use profiles to inject the mock AuthenticationService in the tests if want to reuse your regular Spring configuration file instead of creating test-config.xml. UPDATE After digging around a bit, I found that StandaloneMockMvcBuilder returned by (MockMvcBuilders.standaloneSetup) is totally customizable. That means that you can plug in whatever exception resolver you prefer. However since you are using @ControllerAdvice, the code below will not work. If however your @ExceptionHandler method was inside the same controller the code all you would have to change is the following: mockMvc = MockMvcBuilders.standaloneSetup(controller).setHandlerExceptionResolvers(new ExceptionHandler…
has comment: http://stackoverflow.com/comment/39998444
has comment: http://stackoverflow.com/comment/49810140
has comment: http://stackoverflow.com/comment/40001228
has comment: http://stackoverflow.com/comment/39999961
downvote count: 1
score: 27

http://stackoverflow.com/comment/40128863
has text: 2nd problem is when I enter the correct animal and enter either the right or wrong number of legs, after the program says "You lose" or "You win", it says **I don't know that animal. Do you want to try again? (y/n) Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(Unknown Source) at AnimalGame.main(AnimalGame.java:64)"**
score: 0
comment on: http://stackoverflow.com/a/25657454
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25637521
has body: I Have a Json which may come from other application and i need to check it whether is is in particular format. The JSON template i have is as follows, { "Types": { "Type1": { "attribute1": "value1", "attribute2": "value2", "attribute3": "value3", "recordList": { "record1": [ { "field": "value" }, { "field": { "subrecord1": [ { "subfield1": "subvalue1", "subfield2": "subvalue2" } ] } } ] }, "date": "2010-08-21 03:05:03" } } } Is there any way to validate the JSON based on particular template or format.
favorite count: 0
has answer: http://stackoverflow.com/a/25637559
has title: Validate JSON to a Particular Format
type: Question
upvote count: 1
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 0
score: 1
answer count: 1

http://stackoverflow.com/comment/39917792
has text: @NoobEditor why is this not the correct portal? He has a programming error which he does not know how to fix.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25561755

http://stackoverflow.com/a/25709989
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25573227
answers question: http://stackoverflow.com/q/25573227
type: Answer
has body: There is no way to do that. It is the Java compiler (rather than Maven) that is complaining about the missing symbols. It simply cannot compile the classes that refer to the missing packages. The Java language does not allow this. The missing symbols have to be available when you compile your code. You have three choices: Create a new maven artifact to contain the "missing" packages, and add dependencies to the other modules that require them. Move the "missing" packages into an existing module. Don't attempt to build the classes with the missing dependencies.

http://stackoverflow.com/comment/40093370
comment on: http://stackoverflow.com/a/25653202
has text: Thanks! But is this more or less normal way to convert BufferedImage?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25690473
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/40154096
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40154110
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/40153222
has comment: http://stackoverflow.com/comment/40153162
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40153064
tagged with: java
has answer: http://stackoverflow.com/a/25690680
has body: There are a lot questions on this, but they weren't able to help me or I didn't understand it.. Basically I want user to press the button before system goes back to main method. In this case if system goes back to main method, system will quit. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class test123 implements ActionListener{ JTable table; JButton button; JFrame frame; public test123 (){ frame = new JFrame(); frame.setLayout(null); button = new JButton("Finish"); button.setBounds(200, 10, 70, 40); button.addActionListener(this); frame.add(button); frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE); frame.setSize(600, 200); frame.setVisible(true); frame.setTitle("TEst123"); } public void actionPerformed(ActionEvent e){ if(e.getSource() == button){ System.out.println("message...."); } } public static void main(String arg[]){ test123 gui = new test123(); System.exit(0); } } Sorry if it was just me lacking the understanding and thank you for help. EDIT: Maybe I explained this incorrectly or displayed it incorrectly. Lets say if the system goes back to main system it will do something I don't want, therefor I want the user to press the button to go back to the main system or do "the thing". Sorry for bad explanation, including this one. This class is separate from my work and I just used it to test stuff... In my project, user can choose from several buttons (lets say main method is the menu in this case). The user presses a button goes to a new window/frame, if the program doesn't pause or waits for button to be pressed, it will go back to main method.
has comment: http://stackoverflow.com/comment/40153001
linked to: http://stackoverflow.com/q/9554636
has title: Waiting till button is pressed
score: 1
has comment: http://stackoverflow.com/comment/40152967
downvote count: 0
answer count: 1
tagged with: button
has comment: http://stackoverflow.com/comment/40154439

http://stackoverflow.com/comment/39964758
score: 0
has text: I'm confused... The slowest result I posted was 11ms. The much longer times below each result are the running times of the original code.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25585937

http://stackoverflow.com/comment/40071976
comment on: http://stackoverflow.com/a/25645772
type: Comment
type: AnswerComment
has text: Yes, But its Choice of OP. And by above code we can't say anything for creating new listener, for that we need complete code.
score: 0

http://stackoverflow.com/comment/40054407
type: Comment
type: QuestionComment
has text: you wanna have a return type to be used later within a servlet, like putting those resulting strings in an arraylist of object..ect
score: 0
comment on: http://stackoverflow.com/q/25635696

http://stackoverflow.com/q/25620303
linked to: http://stackoverflow.com/q/4448520
has answer: http://stackoverflow.com/a/25643596
linked to: http://stackoverflow.com/q/6810158
has comment: http://stackoverflow.com/comment/40027202
tagged with: spring
score: 4
linked to: http://stackoverflow.com/q/13259677
has title: How can I globally set FlushMode for Hibernate 4.3.5.Final with Spring 4.0.6?
upvote count: 4
tagged with: spring-4
tagged with: hibernate-4.x
has body: I'm trying to upgrade our application with Hibernate 4.3.5.Final and Spring 4.0.6. Any where in my app with database write operation gets an error as below: Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition. at org.springframework.orm.hibernate4.HibernateTemplate.checkWriteOperationAllowed(HibernateTemplate.java:1135) at org.springframework.orm.hibernate4.HibernateTemplate$26.doInHibernate(HibernateTemplate.java:826) at org.springframework.orm.hibernate4.HibernateTemplate.doExecute(HibernateTemplate.java:340) at org.springframework.orm.hibernate4.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:308) at org.springframework.orm.hibernate4.HibernateTemplate.deleteAll(HibernateTemplate.java:823) ... The follwing is my spring configuration for sessionFactory and transactionManager: com/mycompany/Person.hbm.xml org.hibernate.dialect.HSQLDialect 1: In order to globally set the flushMode so that the app works the same way as before, I need to set flushMode to AUTO globally, so I don't want to use the @Transactional(readOnly = false) approach. 2: In the post below, someone suggests setting singleSession to false, Java / Hibernate - Write operations are not allowed in read-only mode The Spring documentations suggests that specifying "singleSession"="false" has side effect: http://docs.spring.io/spring/docs/4.0.6.RELEASE/javadoc-api/org/springframework/orm/hibernate3/support/OpenSessionInViewInterceptor.html 3: I have seen quite a few suggestions like the below in web.xml, which allows you to intercept the hibernate3 session and provide a version of the session with e.g. flushMode.AUTO. However, this doesn't work in hibernate 4 when you use org.springframework.orm.hibernate4.support.OpenSessionInViewFilter. openSessionInViewFilter org.springframework.orm.hibernate3.suppo…
linked to: http://stackoverflow.com/q/23888237
tagged with: java
tagged with: hibernate
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40067792
favorite count: 0
type: Question
type: UnansweredQuestion

http://stackoverflow.com/q/25695376
has answer: http://stackoverflow.com/a/25695925
tagged with: java
has body: I have an ArrayList method that accepts an ArrayList and needs to return the words in reverse order. I know i need to use toCharArray and once i print them backwords i need to add it back to the ArrayList. Code is below. Sample output should be cat dog should be tac god public static ArrayList&lt;String&gt; reverseWordLetters(ArrayList&lt;String&gt; textArray) { ArrayList&lt;String&gt; results = new ArrayList&lt;String&gt;(textArray.size()); char [] c = new char[textArray.size()]; for(int i = 0; i &lt; textArray.size(); i ++) { c = textArray.get(i).toCharArray(); } return results; }
type: Question
has answer: http://stackoverflow.com/a/25695429
type: UnansweredQuestion
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/25733223
answer count: 3
has title: How to convert ArrayList<String> to char Array and then print each word backwards?

http://stackoverflow.com/comment/40116061
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25670126
has text: @MohammadFarahi Try what Sagar posted. "To create the dialog..."
score: 0

http://stackoverflow.com/q/25656231
tagged with: sql
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40091439
has comment: http://stackoverflow.com/comment/40091391
type: Question
answer count: 0
type: UnansweredQuestion
has body: Is there way to include the date as part of the table name in android? Right now this is how I am creating the table: public class DBHelper extends SQLiteOpenHelper { // TABLE INFORMATTION public static final String TABLE_DATE = "date"; public static final String SD_ID = "_id"; public static final String DATE_SHOTS = "shots"; // DATABASE INFORMATION static final String DB_NAME = ".DB"; static final int DB_VERSION = 1; // TABLE CREATION STATEMENT private static final String CREATE_TABLE = "create table " + TABLE_DATE + "(" + SD_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + DATE_SHOTS + " TEXT NOT NULL);"; public DBHelper(Context context) { super(context, DB_NAME, null,DB_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(CREATE_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub db.execSQL("DROP TABLE IF EXISTS " + TABLE_DATE); onCreate(db); } Obviusly where it says static final String DB_NAME = ".DB"; I would like to have the name before the .db. This was the function I was goign to use to get the date: private String getDateTime() { SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.getDefault()); Date date = new Date(); return dateFormat.format(date); } but it says that it cannot be referenced from static content. I know what that means but I can't do `getDateTime gDT = new getDateTime(); Any help would be awesome thanks!
tagged with: android-sqlite
has title: Create SQL table name with date included
score: 0

http://stackoverflow.com/q/25601032
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25601105
type: Question
has answer: http://stackoverflow.com/a/25602675
accepted answer: http://stackoverflow.com/a/25602675
has answer: http://stackoverflow.com/a/25601105
has body: Hi I am trying to open multiple pdf files on a click , I am trying in this way. Considering user will select multiple options to get pdf files by selecting multiple radio buttons. sendRedirect Program using Servlet Select PDF: PDF 1 PDF 2 PDF 3 So consider uer will select all 3 radio buttons and I want to open all these pdf files in different tabs. I am trying in this way. import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class SendRedirectProg extends HttpServlet { public void method(ActionRequest req, ActionResponse res) throws { PrintWriter p=res.getWriter(); res.setContentType("text/plain"); String s=req.getParameter("pdf"); if(s.equals("PDF 1") && s.equals("PDF 2") && s.equals("PDF 3")) { res.sendRedirect("http://localhost:8080/SendRedirectProg/DemoPDF1.pdf"); res.sendRedirect("http://localhost:8080/SendRedirectProg/DemoPDF2.pdf"); res.sendRedirect("http://localhost:8080/SendRedirectProg/DemoMCA 3.pdf"); } } but it only displays last one, I am understanding use of res.sendRedirect, but still how we can achieve this ? Any suggestions?
tagged with: java
tagged with: liferay-6
type: AnsweredQuestion
has title: Open mutiple pdf files in separate tabs

http://stackoverflow.com/q/25621013
has comment: http://stackoverflow.com/comment/40050451
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40026866
answer count: 1
tagged with: mysql
has answer: http://stackoverflow.com/a/25621192
has title: Hibernate insert default datetime to a not null column
type: Question
type: UnansweredQuestion
has body: In my table I have a column with following definition. createdat DATETIME NOT NULL DEFAULT NOW(), I'm trying to insert data in to this table using hibernate. I want this column to have default value. But it gives me exception com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'createdat' cannot be null Any suggestions?
tagged with: datetime

http://stackoverflow.com/comment/113367295
score: 0
type: AnswerComment
has text: What is the value of the zkPath variable?
comment on: http://stackoverflow.com/a/28284330
type: Comment

http://stackoverflow.com/a/25585044
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39962695
has comment: http://stackoverflow.com/comment/39961447
has body: In Spring, you can catch your exceptions and map them to meaningful HTTP status codes. Following code might work for you (maps YourException to HTTP 500): @ControllerAdvice public class ExceptionProcessor { @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) @ExceptionHandler({YourException.class}) public void serverError(HttpServletRequest req, Exception exception) { // ... // Print exception to server log exception.printStackTrace(); } }
type: Answer
answers question: http://stackoverflow.com/q/25584335
score: 1

http://stackoverflow.com/comment/40215337
comment on: http://stackoverflow.com/q/25680418
has text: Can you post the code you've got? I am guessing you're calling the 7 argument version of #create since that's the one it can't find - but the Tools 22+ version takes 8 arguments, which means your classpath at build time might have something errant about it.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/25689192
has answer: http://stackoverflow.com/a/25689217
has answer: http://stackoverflow.com/a/25690712
type: Question
has comment: http://stackoverflow.com/comment/40150694
has body: What is the programming implementation of NullPointerException in java. Having a book which describe NullPointerException ,and done using first throw it using throw statement. But how to implement this exception in simple try catch block without using throw. like we can throw ArithmetcException by doing throw new ArithmetricException() or to generate the exception we do in try { a=b/0; } catch(ArithmeticException x); Like the above, how to generate NullPointerException without explicitly throwing it?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40150596
score: 0
has answer: http://stackoverflow.com/a/25689216
has title: Exception in java with NullPointerException how to do it without throw?
answer count: 3
tagged with: exception
has comment: http://stackoverflow.com/comment/40150459
tagged with: java

http://stackoverflow.com/comment/39928446
score: 2
has text: I can only imagine that this is possible if the servlet itself measures the execution and sends the info back to the client. Note that when measuring the execution of your servlet via the client, you will always measure the network's latency as well
type: Comment
comment on: http://stackoverflow.com/q/25567639
type: QuestionComment

http://stackoverflow.com/comment/40171391
has text: Even though you have seriously made an effort, your answer comes out somewhat passive-aggressive, I think. There is no harm in being kind while also being right.
type: Comment
score: 4
comment on: http://stackoverflow.com/a/25700484
type: AnswerComment

http://stackoverflow.com/comment/39912098
has text: No regexes, don't even try. Eclipse uses ANTLR but what I'd do is get the Eclipse source code, find the refactoring tools in there and see if you can build a plugin that calls them automatically. Writing an Eclipse plugin is relatively easy, so it shouldn't take long.
type: Comment
comment on: http://stackoverflow.com/q/25558699
type: QuestionComment
score: 2

http://stackoverflow.com/a/25654955
downvote count: 0
has body: Not clear from your question whether your background is ASP or Java. Here's some Java code which does roughly the same thing as the code above ... which is not much, it's just a fragment. public class ConCurrencySdo { public String ConnectionString,RuntimeUser,RuntimePassword; public Connection con; public ResultSet GetBase; public void CreateRecordset() throws Exception { con = Drivermanager.getConnection(ConnectionString,RuntimeUser,RuntimePassword); PreparedStatement cmdTemp = con.prepareStatement("SELECT BLMBG_CURR_CODE,BLMBG_CURR_NAME" + " FROM AON_CURRENCY_SDO" + " ORDER BY BLMBG_CURR_NAME"); GetBase = cmdTemp.executeQuery(); } }
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40224220
answers question: http://stackoverflow.com/q/25652855
accepted answer of: http://stackoverflow.com/q/25652855
type: Answer

http://stackoverflow.com/q/25660804
has answer: http://stackoverflow.com/a/25661031
upvote count: 1
has answer: http://stackoverflow.com/a/25660861
linked to: http://stackoverflow.com/q/363681
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/7815196
accepted answer: http://stackoverflow.com/a/25660850
type: Question
has answer: http://stackoverflow.com/a/25660921
has answer: http://stackoverflow.com/a/25660850
answer count: 5
has answer: http://stackoverflow.com/a/25660974
has title: how can I generate a random number of any particular number of digits (say 5) in java?
type: AnsweredQuestion
score: 0
has body: I want to generate a random number of any particular digit (say 5, i.e., 10000 to 99999) in java. How can I do that?
tagged with: java
possible better answer: http://stackoverflow.com/a/25660861

bit
tag name: bit
type: Tag
tags question: http://stackoverflow.com/q/25565452

http://stackoverflow.com/comment/40176299
type: QuestionComment
has text: You are totally misusing the `@Background` annotation. It is for creating background tasks, worker threads, for example some processing, or networking, etc. You are executing GUI related operations, these operations [must performed on the main (UI thread)](http://developer.android.com/guide/components/processes-and-threads.html)! If you start a new `Activity`, everything for the previous will disappear. If you want to show the dialog in the second, you have to open it again. But i suggest to redesign your UI, because this is not a good practice...
comment on: http://stackoverflow.com/q/25694261
score: 1
type: Comment

http://stackoverflow.com/comment/39950677
type: Comment
comment on: http://stackoverflow.com/q/25578660
type: QuestionComment
has text: I'd be amazed if someone wrote and published a library for printer request interception. It is too specialized a use-case. And besides, that would only work for programs that *used* the library to talk to the printer. Your Question is asking for something that works for all print requests ... not just requests from applications that you've modified to use a different printer library.
score: 0

http://stackoverflow.com/q/25616337
has comment: http://stackoverflow.com/comment/40018478
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40018845
has answer: http://stackoverflow.com/a/25616544
has comment: http://stackoverflow.com/comment/40018516
score: 4
has comment: http://stackoverflow.com/comment/43426439
type: Question
upvote count: 4
linked to: http://stackoverflow.com/q/27467745
has comment: http://stackoverflow.com/comment/40018602
answer count: 1
tagged with: jpa
downvote count: 0
accepted answer: http://stackoverflow.com/a/25616544
favorite count: 0
has body: I have a enum of few status value NEW, REVIEWD, PUBLISHED, PENDING, UPDATED, SPAM, DUPLICATE, IRRELEVANT, UNPUBLISHED I don't want to use them as enumerated so created one entity for that. For convenient I want to keep a column in entity to initialize status from enum and convert that enumerated value to a Object of status entity. for this.. I have two entity. I want to refer a column with value from another entity. Basically I want to initialize a object with formula. Entities are @Entity @Table(name = "event_status") public class EventStatus { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="eventStatusId") private Integer eventStatusId; @Enumerated(EnumType.STRING) @Column(unique = true,name="eventStatusType") private EventStatusType eventStatusType; public EventStatus() { this(EventStatusType.NEW); } public EventStatus(EventStatusType eventStatusType) { super(); this.eventStatusType = eventStatusType; } public Integer getEventStatusId() { return eventStatusId; } public EventStatusType getEventStatusType() { return eventStatusType; } public void setEventStatusId(Integer eventStatusId) { this.eventStatusId = eventStatusId; } public void setEventStatusType(EventStatusType eventStatusType) { this.eventStatusType = eventStatusType; } } I have another entity in which I am referring object of this entity @Entity @Table(name = "event_") @Inheritance(strategy = InheritanceType.JOINED) public abstract class Event implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "id_") @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Transient public EventStatusType eventStatusType = EventStatusType.NEW; @ManyToOne(fetch = FetchType.EAGER, targetEntity = EventStatus.class) @Formula("select * from event_status where eventStatusId= 1") private EventStatus status; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public EventStatus getStatus() { System.out.println("Event.getStatus() " …
has comment: http://stackoverflow.com/comment/40018527
type: AnsweredQuestion
has title: @Formula not working in hibernate with object

http://stackoverflow.com/comment/40144395
has text: I used this but I'm not able to put the lists as inputs to fill the columns of the table.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25685971
type: AnswerComment

http://stackoverflow.com/comment/40086682
type: Comment
has text: ok i already posted it now can u help me
type: QuestionComment
comment on: http://stackoverflow.com/q/25653407
score: 0

http://stackoverflow.com/comment/40162495
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25695011
has text: Because the compiler (and the class verifier in the JVM) expect a REAL object class there. If you think you can do it better, take the source and try to create (and compile and run) your own version.
type: Comment

http://stackoverflow.com/a/25665931
type: Answer
has body: Teaser: You may perform this computation easily in less than one millisecond. Details follow... Which one is "better"? The question of which algorithm is "better" may refer to the execution time, but also to other things, like the implementation style. The Staircase implementation is shorter, more concise and IMHO more readable. And more importantly: It does not involve a state. The c2 variable that you introduced there destroys the advantages (and beauty) of a purely functional recursive implementation. This may easily be fixed, although the implementation then already becomes more similar to the Staircase one. Measuring performance Regarding the question about execution time: Properly measuring execution time in Java is tricky. Related reading: How do I write a correct micro-benchmark in Java? Java theory and practice: Anatomy of a flawed microbenchmark HotSpot Internals In order to properly and reliably measure execution times, there exist several options. Apart from a profiler, like VisualVM, there are frameworks like JMH or Caliper, but admittedly, using them may be some effort. For the simplest form of a very basic, manual Java Microbenchmark you have to consider the following: Run the algorithms multiple times, to give the JIT a chance to kick in Run the algorithms alternatingly and not only one after the other Run the algorithms with increasing input size Somehow save and print the results of the computation, to prevent the computation from being optimized away Don't print anything to the console during the benchmark Consider that timings may be distorted by the garbage collector (GC) Again: These are only rules of thumb, and there may still be unexpected results (refer to the links above for more details). But with this strategy, you usually obtain a good indication about the performance, and at least can see whether it's likely that there really are significant differences between the algorithms. The differences between the approaches The Staircase impleme…
answers question: http://stackoverflow.com/q/25635713
downvote count: 0
type: AcceptedAnswer
score: 6
has comment: http://stackoverflow.com/comment/40172457
accepted answer of: http://stackoverflow.com/q/25635713
upvote count: 6

http://stackoverflow.com/a/25563304
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25562575
has body: What you do is posting to an HTTP server. I presume you are using Apache Commons HTTPClient. There is nothing in the getResponseBodyAsString()-method that would escape quotes to HTML entities. Probably you tried to send a double-JSON-encoded object (thus it was first encoded to the usual representation, and then to a JSON string, which would explain the entities) on the server side. The correct solution would be to get rid of the double encoding. If you don't control the server side, you can just use .replaceAll("&amp;quot;", "\"")or use Apache Commons StringEscapeUtils as explained elsewhere on StackOverflow.
has comment: http://stackoverflow.com/comment/39920572
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39921645
has comment: http://stackoverflow.com/comment/39930545
has comment: http://stackoverflow.com/comment/39921280

http://stackoverflow.com/a/25621848
has comment: http://stackoverflow.com/comment/40032383
has comment: http://stackoverflow.com/comment/40032592
has body: I think it's about List. You can use ArrayList for make JSON from List. Try this code i am not sure but when you clear red marks it will work. public class App { public static void main(String[] args) { SessionFactory sf = HibernateUtil.getSessionFactory(); Session session = sf.openSession(); List names = session.createCriteria(Child.class).list(); GsonBuilder b = new GsonBuilder(); b.registerTypeAdapterFactory(HibernateProxyTypeAdapter.FACTORY); Gson gson = new Gson(); //seperate adding gson.toJson("propertyName" , List.get(0).getter...()); gson.toJson("propertyName" , List.get(1).getter...()); session.close(); } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25621633

http://stackoverflow.com/comment/40107950
has text: Code seems correct, can you check (by debugging) if the byte array you're passing to the new String(..) actually is truncated or if it has the right length?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25665759
score: 0

http://stackoverflow.com/comment/40076889
comment on: http://stackoverflow.com/q/25648492
type: Comment
has text: In servlet, you use `request.setAttribute`. In view (JSP, Facelets), you **NEVER** use scriptlets, instead use Expression Language that will call `request.getAttribute` for you.
type: QuestionComment
score: 0

http://stackoverflow.com/q/25558195
favorite count: 0
type: Question
tagged with: search
score: 9
accepted answer: http://stackoverflow.com/a/25559331
upvote count: 9
has answer: http://stackoverflow.com/a/25559331
downvote count: 0
tagged with: proximity
tagged with: lucene
has title: Lucene Proximity Search for phrase with more than two words
type: AnsweredQuestion
tagged with: java
answer count: 1
has body: Lucene's manual has explained the meaning of proximity search for a phrase with two words clearly, such as the "jakarta apache"~10 example in http://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Proximity Searches However, I am wondering what does a search like "jakarta apache lucene"~10 exactly do? Does it allow neighboring words to be at most 10 words apart, or all pairs of words to be that? Thanks!

http://stackoverflow.com/comment/40100430
comment on: http://stackoverflow.com/q/25630440
score: 0
type: Comment
type: QuestionComment
has text: spring-aop,spring-aspects,spring-beans,spring-build-src,spring-context,spring-context-support,spring-core,spring-expression,spring-framework-bom,spring-instrument,spring-instrument-tomcat,spring-jdbc,spring-jms,spring-messaging,spring-orm,spring-oxm,spring-tx,spring-test,spring-web,spring-wbmvc,spring-webmvc-portlet,spring-websocket. Above are the jars listed in my folders. spring version is 4.0.1.

http://stackoverflow.com/comment/40038296
type: Comment
comment on: http://stackoverflow.com/a/25551952
has text: One option would be to just register an HTTPMessageConverter to take a DOM document and transform it to the result stream. It would preserve the 'ResponseBody' annotation and would not necessarily interfere with the default converters - if you require an example let me know I can whip one up.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25671565
answers question: http://stackoverflow.com/q/25671527
score: 4
downvote count: 0
has body: In general, we recommend using Swing timers rather than general-purpose timers for GUI-related tasks because Swing timers all share the same, pre-existing timer thread and the GUI-related task automatically executes on the event-dispatch thread. However, you might use a general-purpose timer if you don't plan on touching the GUI from the timer, or need to perform lengthy processing. Documentation: http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html I should recommend using the util.Timer.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25671527
type: Answer
upvote count: 4

http://stackoverflow.com/comment/39977775
comment on: http://stackoverflow.com/a/25588835
type: Comment
score: 0
type: AnswerComment
has text: Thanks for the answer. I did include a condition flag at first but then removed it based on the reason that the condition checking can also happen before the action is performed and the flag is set to true. But, I see that there is some safety value in it.

http://stackoverflow.com/a/25702934
answers question: http://stackoverflow.com/q/25662864
has body: It is solved with three Java Stack, and own stack implementation to make push and pop operations synhronized. Implementation is ; class OwnStack{ private final Stack&lt;String&gt; file = new Stack&lt;String&gt;() private final Stack&lt;String&gt; date = new Stack&lt;String&gt;() private final Stack&lt;String&gt; numberOfElementsPushedAtTheSamTime = new Stack&lt;String&gt;() public void push(String []files, String []date{ /* Algorithm * Iterate over files * if file is in stack * donot push anything to stack * else * push file to stack * push category to stack * push number of entries pushed at the same time to stack (files.length()) */ } public void pop(){ /* * Algorithm * If size is zero in file stack * do nothing * else * get top number from numberOfElementsPushedAtTheSamTime stack * iterate over stacks returned number times * pop files stack * pop date stack */ // I donot need return values } }
type: Answer
score: 0

http://stackoverflow.com/comment/39993987
type: AnswerComment
comment on: http://stackoverflow.com/a/25602302
score: 0
type: Comment
has text: Are you using a C/C++ dll ?

http://stackoverflow.com/a/25585680
answers question: http://stackoverflow.com/q/25584656
has comment: http://stackoverflow.com/comment/40091162
has body: "Is there a way to have the window closing in class 1 trigger an action in class 2? If not, what would be the best way to solve this problem?" As Boris the Spider pointed out, you should be using a model dialog. You're probably using a frame. You should read up on Modality to learn its behavior and features. Also take some time to look at How to make Dialogs. In short, turning the dialog's modality on (which is defaulted on JOptionPane static showXxx methods and can be set on JDialog either through setModalityType or passed through the constructor), the flow will "block" until the dialog is closed. Below is an example. It may be overcomplicated for such a simple task (as it could easily be accomplished with a JOptionPane), but it shows how to use a JDialog. Look as the ShowDialogActionListener class. The dialog is set visible and flow is not continued in the actionPerformed until the dialog is closed, which is when the Input is obtained from the dialog. import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class DialogDemo { private JFrame frame = new JFrame(); public DialogDemo() { JButton button = new JButton("Open Dialog"); button.addActionListener(new ShowDialogActionListener()); frame.setLayout(new GridBagLayout()); frame.add(button); frame.setSize(300, 300); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } class ShowDialogActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { InputDialog dialog = new InputDialog(frame, true); System.out.println("Opened dialog....."); long start = System.currentTimeMillis(); dialog.setVisible(true); System.out.println("Dialog closed after " + (System.currentTimeMil…
has comment: http://stackoverflow.com/comment/40174360
has comment: http://stackoverflow.com/comment/40089229
score: 5
upvote count: 5
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39984910
type: QuestionComment
score: 0
has text: Ultimately, all I want to do with this program is create a standalone EXE file that doesn't rely on an external fold to get images from...
comment on: http://stackoverflow.com/q/25596619
type: Comment

http://stackoverflow.com/q/25576647
has body: I have a big component that consists of many small components, so what will be used to determine the tab order for those small component? also, is there a way to set FocusTraversalPolicy for JComponent?
favorite count: 0
has answer: http://stackoverflow.com/a/25578705
type: Question
has title: Changing the tab traversal order for a Jcomponent?
downvote count: 0
upvote count: 1
tagged with: swing
tagged with: tab-ordering
type: AnsweredQuestion
tagged with: focus
score: 1
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25578705

http://stackoverflow.com/comment/40132824
score: 0
comment on: http://stackoverflow.com/q/25676682
has text: Seems like a reasonable question to me. Vote to reopen. I suppose it could be a bit more specific though.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25688161
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25687824
has comment: http://stackoverflow.com/comment/40150464
has body: Do this. if (isChecked) { etPersonTitle.setText("asd"); etFirstname.setText("asd"); etSurname.setText("asd"); etPersonTitle.setEnabled(!isChecked); etPersonTitle.setFocusable(!isChecked); etFirstname.setEnabled(!isChecked); etFirstname.setFocusable(!isChecked); etSurname.setEnabled(!isChecked); etSurname.setFocusable(!isChecked); } else { etPersonTitle.setText(""); etFirstname.setText(""); etSurname.setText(""); etPersonTitle.setEnabled(true); etPersonTitle.setFocusableInTouchMode(true); etFirstname.setEnabled(true); etFirstname.setFocusableInTouchMode(true); etSurname.setEnabled(true); etSurname.setFocusableInTouchMode(true); }
score: 1
answers question: http://stackoverflow.com/q/25687824
type: Answer
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25689980
accepted answer of: http://stackoverflow.com/q/25689871
has comment: http://stackoverflow.com/comment/40158547
upvote count: 8
has comment: http://stackoverflow.com/comment/40155319
has body: The flush() method instructs the stream to actually send the output down the stream pipe. Various stream implementation can, for various performance reasons, cache the output and not write to the underlying stream right away. For example to save IO operations on disk which are expensive from a performance point of view. There is no problem in flushing a stream, if not for performances, which in this case is what you want : the stream seems to be stuck until you flush it, so you want it to actually send stuff to the client. Maybe you can play with the size of your buffer, with something bigger than 1024, to see what fits better. EDIT : The problem of flushing in a loop or not in a loop is relatively not relevant. You can call flush whenever you want, as said it will call the underlying OS stream, whether this is a performance hit or no depends on the situation. For example, you could value the 200MB of ram in which the stream is buffering the file more important, also performance-wise, than the IO operation. Or much more simply value the user experience of seeing the file actually downloading more important than the eventual performance hit you might maybe experience, if you manage to measure it. As said, the larger is your buffer, the less the problem of the loop is. Suppose, as an extreme example, your buffer is 100 megabyte, then an 80 megabyte file will get only one flush, which it would get anyway at the end of the request. Having 1k of buffer is probably too small, 4k better, 16k fine, it's a tradeoff between IO calls and RAM consumption. The stream should do it's proper work itself, if however you're seeing that a 200MB file get's fully cached unless you call flush, then obviously the stream is probably optimizing performances but giving a bad user experience, so obviously you need it in the loop.
has comment: http://stackoverflow.com/comment/40152177
has comment: http://stackoverflow.com/comment/40155712
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40152749
type: Answer
has comment: http://stackoverflow.com/comment/40152318
answers question: http://stackoverflow.com/q/25689871
has comment: http://stackoverflow.com/comment/40158653
has comment: http://stackoverflow.com/comment/40158784
has comment: http://stackoverflow.com/comment/40158602
score: 7
has comment: http://stackoverflow.com/comment/40152713
downvote count: 1

http://stackoverflow.com/q/25611753
tagged with: servlets
linked to: http://stackoverflow.com/q/4015579
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
tagged with: java
has body: This is the first time for me to work with Struts1. I want to redirect from a jsp to another jsp. For example: if the user not in session then redirect it to login.jsp; else go to menu.jsp. I tried to make a tile: isLogged.jsp that contains: &lt;logic:present name="user"&gt; &lt;jsp:forward page="menu.do"/&gt; &lt;/logic:present&gt; &lt;logic:notPresent name="user"&gt; &lt;jsp:forward page="login.do"/&gt; &lt;/logic:notPresent&gt; But it don´t redirect and the page is in blank (all empty in the code). I do call the tile in all the pages of the site inside of the . What am I doing wrong?
answer count: 1
has comment: http://stackoverflow.com/comment/40011086
has answer: http://stackoverflow.com/a/25612564
tagged with: jsp
tagged with: struts-1
favorite count: 0
type: Question
has title: Redirect jsp to another jsp (Struts1)
has comment: http://stackoverflow.com/comment/40048687
tagged with: http-redirect
accepted answer: http://stackoverflow.com/a/25612564

http://stackoverflow.com/a/32495312
answers question: http://stackoverflow.com/q/25693526
downvote count: 0
upvote count: 1
score: 1
has body: Thanks It works. Adding Shared Libraries For axix2 in WAS 8.5 Login into WAS admin console. Go to the Environment Link Click on Shared libraries Click on new; Select the scope of this variable. Provide the name and class path value as per the library location of jars. Press apply and then save button. Now click on Servers &gt; webSphere Appliacatio servers. With in the list of servers select your server. Click on Java and Process Management &gt; Class Loader Go new and select “Class loader order” and choose “Classes loaded with local class loader first (parent last)”. Apply and save. Now Click on Shared library references under “Additional Properties” section and include your added shared library variable name. Now restart server instance to see the effect of whole task.
type: Answer

http://stackoverflow.com/a/25703841
score: 1
has comment: http://stackoverflow.com/comment/40177963
has body: I think you're confusing buildtime and runtime. During buildtime you have your src/main/java, src/main/resources and src/main/webapp, but during runtime these are all bundled in a war-file. This means there's no such thing as src/main/resources anymore. The easiest way is to write to a [tempFile][1] and write to that file. The best way is to configure your outputFile, for instance in the wqeb.xml. [1]: http://docs.oracle.com/javase/6/docs/api/java/io/File.html#createTempFile(java.lang.String, java.lang.String)
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25703706
has comment: http://stackoverflow.com/comment/40178007

http://stackoverflow.com/comment/59594252
type: AnswerComment
comment on: http://stackoverflow.com/a/25560190
has text: I've been having the same issue. A button works on some devices, not on others. When it doesn't work, I see a `Sending WAIT chunk` in the log. I just added a line to print to the logcat at the beginning of the activity, and things seem to work. This is quite baffling.
type: Comment
score: 0

http://stackoverflow.com/comment/39975410
has text: Try editing your code as I suggest to you on the edited answer, please :)
type: AnswerComment
comment on: http://stackoverflow.com/a/25588447
score: 0
type: Comment

http://stackoverflow.com/q/25612117
has title: How do you include JAX-RS with Jersey in Maven?
accepted answer: http://stackoverflow.com/a/25620376
has answer: http://stackoverflow.com/a/34102314
tagged with: maven
has answer: http://stackoverflow.com/a/25612364
answer count: 4
type: AnsweredQuestion
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/8476820
has answer: http://stackoverflow.com/a/25612338
possible better answer: http://stackoverflow.com/a/25612338
has answer: http://stackoverflow.com/a/25620376
linked to: http://stackoverflow.com/q/18139029
tagged with: eclipse
has body: I'm following a tutorial on Vogella on how to work with JAX-RS to create RESTful web applications. The trouble for me is that I am not able to import the dependencies through Maven. Is it possible? When I try finding jsr311 or javax.ws.rs as suggested here, Maven doesn't seem to know it exists.
type: Question
linked to: http://stackoverflow.com/q/14890438
tagged with: jersey

http://stackoverflow.com/comment/40162990
type: QuestionComment
comment on: http://stackoverflow.com/q/25695621
has text: change this line class Program1 to public class Program1 and save the file as Program1.java . it should work fine. The problem was that your class is inside a java file , but it is not visible to java , hence I just changed the visibility by adding public keyword
type: Comment
score: 1

http://stackoverflow.com/q/25627192
accepted answer: http://stackoverflow.com/a/25628454
tagged with: java
has answer: http://stackoverflow.com/a/25628454
tagged with: date
has body: I always had this doubt and always had problems with this. The thing is that, for example, I have a form that requests the user to enter a date and the it is posted via ajax to the server and it receives the date field as a Date type. Some times, what I did was to send the different values in different params, like this: { day: 18, month: 05, year: 2014, hour: 10, min: 30 } And then in the server, make the Date type from the values received. But then, of course, I thought this was not a good practice and I started to make a string like this: { date: "2014-09-16T12:00:00Z" } but this of course, does not take in account the location of the user in order to keep the corresponding GMT+-.. I also thought about posting the milliseconds, but here again, there is the problem with the GMT.. I am using spring, just for the record. So, how should it be done? What is the best practice to do this?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40038508
has answer: http://stackoverflow.com/a/25627383
has title: How should dates be posted to java?
has comment: http://stackoverflow.com/comment/40038548
tagged with: javascript
tagged with: ajax
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25627383

http://stackoverflow.com/comment/40392985
comment on: http://stackoverflow.com/a/25702116
score: 0
type: AnswerComment
has text: Thanks for that. but the problem is, I want to pass a URL to servlet and get the JSON result instead, without add anything to controller or any server side classes.
type: Comment

http://stackoverflow.com/comment/40196622
comment on: http://stackoverflow.com/a/25713814
score: 0
type: AnswerComment
has text: Yes, I did. Is that all it takes? I have annotated it provider, and I extended the ContainerResponseFilter interface, but it never gets called.
type: Comment

http://stackoverflow.com/comment/40045541
type: Comment
comment on: http://stackoverflow.com/q/25630916
type: QuestionComment
has text: Is it throwing an exception? Do you have file system permissions in your manifest?
score: 0

http://stackoverflow.com/a/31654409
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25609641
has body: while(m!=n) { if(m &gt;= n-1) m = m-n; else n = n - m; } return m; A non-recursive solution for finding gcd of two numbers.
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25671977
answers question: http://stackoverflow.com/q/25671774
score: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/25671774
downvote count: 0
has body: The decision to require Java 1.7 is described in great detail in Eclipse bug 423734 The primary reason initially was that Java 1.6 is now end of life and is no longer being maintained. Since the decision was taken some packages are using Java 1.7 code, there is a list here although this may have expanded since.
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/a/25615723
has comment: http://stackoverflow.com/comment/40017464
has comment: http://stackoverflow.com/comment/40018324
type: Answer
has comment: http://stackoverflow.com/comment/40017373
has comment: http://stackoverflow.com/comment/40017428
score: 0
has comment: http://stackoverflow.com/comment/40017557
has comment: http://stackoverflow.com/comment/40017396
has body: First of all, it is best to use prepared statement while using queries as suggested in this answer by Elliot. If you still want to use statements, then you better change the approach as below to avoid confusion and for better code maintenance. String selectQuery = "select e.env_id,s.* from env_mast e inner join" + " db_server_mast s on e.dc_id=s.dc_id join cust_mast c on " + "e.cust_id=c.cust_id where cust_name='" + env + "' "; if (dc != null) { selectQuery += " and " + "e.dc_id='" + dc + "' "; } rs = st.executeQuery (selectQuery); if (rs.next()) { .... } For your question, Probably, there is no record in the table env_mast when dc = 1. The table env_mast has records if dc = 2 Check your table data.
has comment: http://stackoverflow.com/comment/40017610
answers question: http://stackoverflow.com/q/25615583

http://stackoverflow.com/comment/40188657
has text: I know that the default constructor for the ActiveList object is useless, I was trying that out of desperation. My problem is that when I call genRandomRectangle() on currentActiveList, after it has finished making the random rectangle it assigns the random rectangle to activeList of the current object using addToList. However when I return to GraphicsGen and if(currentActiveList.getFromList(i) != null) { is executed, .getFromList(i) will always return null.
type: AnswerComment
comment on: http://stackoverflow.com/a/25709844
score: 0
type: Comment

http://stackoverflow.com/a/25591274
answers question: http://stackoverflow.com/q/25590777
has body: The 'map' array, was not actually the array that the data was being rendered from there was a previous array which corrupted and led to duplication of data.
type: Answer
score: 0

http://stackoverflow.com/q/25678416
answer count: 1
accepted answer: http://stackoverflow.com/a/25678431
downvote count: 0
linked to: http://stackoverflow.com/q/40480
tagged with: loops
has answer: http://stackoverflow.com/a/25678431
favorite count: 0
type: Question
score: 5
has comment: http://stackoverflow.com/comment/40131100
upvote count: 5
tagged with: arrays
has title: Java Array loop behaviour
type: AnsweredQuestion
has body: I have been testing some different ways to multiply array items with a constant. I have produced different results depending on how I loop through the array and I'm having trouble understanding this (I'm fairly new to Java and still getting my head around how things are passed or referenced). Test 1 int[] array = {1, 2, 3, 4}; for (int number : array) { number *= 2; } Resulting in array items unmodified: {1, 2, 3, 4} It seems like number is not the actual array item, but a new int that is initialised with it's value. Is that correct? Test 2 I thought that by using an array of Objects might work, assuming number is then a reference to the actual array item. Here is my test of that using Integer instead of int: Integer[] array = {1, 2, 3, 4}; for (Integer number : array) { number *= 2; } Again, resulting in array items unmodified: {1, 2, 3, 4} Test 3 After some head scratching I tried a different loop method, like this: int[] array = {1, 2, 3, 4}; for (int i = 0; i &lt; array.length; i ++) { array[i] *= 2; } Resulting in array items multiplied: {2, 4, 6, 8} This final result makes sense to me, but I don't understand the results from the second test (or first for that matter). Until now, I've always assumed the loop used in test 1 and 2 was just a shorthand version of the loop used in test 3, but they are clearly different. Why isn't this working as I expected? Why are these loops different?
has comment: http://stackoverflow.com/comment/40131538
tagged with: java

http://stackoverflow.com/a/25602404
accepted answer of: http://stackoverflow.com/q/25602336
type: AcceptedAnswer
downvote count: 0
score: 13
upvote count: 13
answers question: http://stackoverflow.com/q/25602336
has body: It seems that input.getClass() returns ModelConvertersFacadeTests That is not true. Your stacktrace says this is the class: com.example-company.test.unit.util.converters.ModelConvertersFacadeTests$1 Note the $1 at the end. This means that your class is an anonymous (it does not have a name of its own) inner class. The this$0 that we see in your screenshot is just a reference to the outer class. Everytime you do new SomeClass() { ... } you are creating an anonymous inner class. The double brace initialization itself has nothing to do with this. Every time you are using double brace initialization though, you are also creating an anonymous inner class. Solving by looking up in map differently Your Map has a mapping for Right.class and Location.class, but it does not have a mapping for subclasses of these two classes. static { modelConverterBacking.put(Right.class, new RightConverter()); modelConverterBacking.put(Location.class, new LocationConverter()); }; What you could do (not saying it is the best approach), is to loop through the keys of your map and check: mapKey.isAssignableFrom(input.getClass()) When that returns true, you know that you either have a class of mapKey or you have a subclass of it. Instead of looping through the map keys, you can also loop through the superclasses and implemented interfaces of the object you pass in, and do a modelConverterBacking.get lookup for each of those. The effect will be the same. Solving without using an anonymous inner class Your current code is: final Location stub = new Location() { { setLocationName(&quot;&quot;); } }; If you instead would do: final Location stub = new Location(); stub.setLocationName(&quot;&quot;); Then you don't create any anonymous inner class and therefore would not be having this problem. However, even if you simply do this: final Location stub = new Location() {}; stub.setLocationName(&quot;&quot;); Then you have an anonymous inner class, which will cause problems for you. It is very important t…
type: Answer

http://stackoverflow.com/q/25619487
tagged with: mongodb
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33958843
tagged with: pagination
has title: spring data paging with start and end counts
has answer: http://stackoverflow.com/a/25638519
score: 2
answer count: 2
has body: I'm using spring data with mongodb and have issue which is described below. Pageable pageRequest = new PageRequest(page, count); return projectRepository.findAllByUserId(userId, pageRequest); from the frontend part i'm getting start and end values for returning a page result but unfortunately i can't get the page number because i use scrollable loading not a pager. and seems spring data allows only make a pageRequest with these 2 parameters, page number and data count. Is there a way to pass only start and end of the data and return a page result instead with spring data?
upvote count: 2
tagged with: scroll-paging
tagged with: java
tagged with: spring-data
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/comment/61317156
type: QuestionComment
has text: Which version bitronix you use? Have problems with bitronix/sprng/hibernate4/5?
comment on: http://stackoverflow.com/q/25692873
score: 0
type: Comment

http://stackoverflow.com/q/25595250
has comment: http://stackoverflow.com/comment/39979899
type: Question
has comment: http://stackoverflow.com/comment/39979998
tagged with: for-loop
has comment: http://stackoverflow.com/comment/39979954
has comment: http://stackoverflow.com/comment/39979967
has comment: http://stackoverflow.com/comment/39980085
has answer: http://stackoverflow.com/a/25595533
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39980173
answer count: 1
has comment: http://stackoverflow.com/comment/39979984
has comment: http://stackoverflow.com/comment/39980100
score: 0
tagged with: abstract
has title: For loop not calling methods
tagged with: java
has body: I have never been so confused about something so basic. In this instance, I have a for loop that is using an ArrayList for an abstract class. This class contains a few different update methods, all of which are being used for different classes that extend the abstract class and overwrite the methods. (I didn't include all of the update methods because I didn't think it was necessary, you should be able to guess what they are) public abstract class Objs extends JComponent{ private int xpos; private int ypos; private int size; private boolean ai; public void update(){ } public boolean getAI(){ return ai; } public void update(int y, Container p){ } public void update(int p, int x){ } So, in the for loop I have: for(int i = 0; i &lt; objs.size() - 1; i++){ objs.get(i).update(getParent()); objs.get(i).update(getHeight(),(int)(objs.get(0).getYpos() - (.5 * objs.get(0).getS()))); if(!(objs.get(i).getAI())){ if(m[0]) objs.get(i).update(1, getParent()); if(m[1]) objs.get(i).update(-1, getParent()); } } I have three different update methods. The first one works perfectly fine with my first class that is extending the abstract class. However, I have a second class using the second update method, and for some reason it seems like the method is not being called for that class. I honestly have no idea why not! What I have done for testing is outside of the for loop, called the method manually using the correct index and it works. So my only assumption left is that the For loop isn't calling the method for some reason. Any ideas?
has comment: http://stackoverflow.com/comment/39980316
has comment: http://stackoverflow.com/comment/39980193

http://stackoverflow.com/comment/39904523
score: 0
type: Comment
type: QuestionComment
has text: Also @Martin, your comments appreciated and duly noted.
comment on: http://stackoverflow.com/q/25553668

http://stackoverflow.com/comment/40113961
has text: Thanks, I did'nt know that.
type: Comment
comment on: http://stackoverflow.com/a/25668890
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39935954
score: 0
comment on: http://stackoverflow.com/q/25571309
type: Comment
type: QuestionComment
has text: sir the code is (pref = findPreference("pref_gps_updates"); // gps updated pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { ) but i cant find where the problem occures. thank you

http://stackoverflow.com/comment/40010296
type: AnswerComment
has text: Then I would, again, need to know that error to help you
type: Comment
comment on: http://stackoverflow.com/a/25610480
score: 0

http://stackoverflow.com/q/25589961
has answer: http://stackoverflow.com/a/25589976
score: 0
answer count: 2
tagged with: java
type: Question
tagged with: static
tagged with: constructor
has body: I have this constructor with a function however when i compile my main method i non-static method area cannot be referenced from a static context. I know its a simple fix i just cant quite get there. Thanks public class Rect{ private double x, y, width, height; public Rect (double x1, double newY, double newWIDTH, double newHEIGHT){ x = x1; y = newY; width = newWIDTH; height = newHEIGHT; } public double area(){ return (double) (height * width); } and this main method public class TestRect{ public static void main(String[] args){ double x = Double.parseDouble(args[0]); double y = Double.parseDouble(args[1]); double height = Double.parseDouble(args[2]); double width = Double.parseDouble(args[3]); Rect rect = new Rect (x, y, height, width); double area = Rect.area(); } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25589988
has title: How do I refrence a non- static method from a static context

http://stackoverflow.com/comment/39966476
has text: No. The code that you say is equivalent will compile (being a valid block), whereas the original code will not compile because it's not a valid statement. Therefore they can't be equivalent. I.e. java will *not* assume you meant that.
type: AnswerComment
comment on: http://stackoverflow.com/a/25587786
score: 0
type: Comment

http://stackoverflow.com/q/25573532
favorite count: 0
has comment: http://stackoverflow.com/comment/39940203
score: 2
tagged with: android
tagged with: java
answer count: 1
tagged with: authentication
linked to: http://stackoverflow.com/q/23546003
type: Question
upvote count: 4
tagged with: oauth
has answer: http://stackoverflow.com/a/28541217
has title: Using OAuth2 token to authenticate to an API hosted on Google App Engine?
type: UnansweredQuestion
tagged with: google-app-engine
downvote count: 2
has comment: http://stackoverflow.com/comment/39987102
has comment: http://stackoverflow.com/comment/39987034
has body: I'm building a backend for my Android app using GAE, and I'd like to authenticate users with their Google accounts, sent from the Android app. Before OAuth2, you were able to use a Cookie retrieved from the _ah/login endpoint to authenticate users into your web app, but that method is deprecated and I'd like to be able to use the updated OAuth2 method. In my Android app I've been able to generate a JSON Web Token using the following line: String jwt = GoogleAuthUtil.getToken(FamiliarActivity.this, Plus.AccountApi.getAccountName(mGoogleApiClient), "audience:server:client_id:1234567.apps.googleusercontent.com"); or an OAuth token: String oauth2 = GoogleAuthUtil.getToken(FamiliarActivity.this, Plus.AccountApi.getAccountName(mGoogleApiClient), "oauth2:server:client_id:1234567.apps.googleusercontent.com:api_scope:https://www.googleapis.com/auth/plus.login"); Either, manually, I can pass to my API and validate against Google. But I haven't been able to figure out a way to use a token like this to trigger authentication in GAE like the Cookie used to. The documentation seems to indicate passing it as a header: Authorization: Bearer &lt;TOKEN&gt; but that doesn't seem to work. What is the correct way to retrieve and pass a token to my GAE endpoint so that it authenticates the user?

http://stackoverflow.com/comment/40124175
comment on: http://stackoverflow.com/a/25674592
type: Comment
has text: @gstackoverflow In that case, yes.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40111364
type: AnswerComment
comment on: http://stackoverflow.com/a/25641498
type: Comment
has text: Ok. If I type in this way: 'Multiple markers at this line - The method addColumn(Column<String,?>, String) in the type AbstractCellTable<String> is not applicable for the arguments (TextColumn<Example>, String) - The method addColumn(Column<Example,?>, String) in the type AbstractCellTable<Example> is not applicable for the arguments (TextColumn<String>, String)'.
score: 0

http://stackoverflow.com/comment/40164219
comment on: http://stackoverflow.com/q/25696205
type: QuestionComment
has text: Do you want 10 to be the minimum damage, and have a chance to get higher?
type: Comment
score: 1

http://stackoverflow.com/comment/39979176
type: AnswerComment
comment on: http://stackoverflow.com/a/25594484
has text: Imported project as maven and it worked. Works perfectly! Woot woot! Thanks :)
type: Comment
score: 0

http://stackoverflow.com/comment/40000355
score: 0
type: QuestionComment
type: Comment
has text: Okay I will try to make a simple program and upload later. Thanks @Jens
comment on: http://stackoverflow.com/q/25570731

http://stackoverflow.com/comment/39937946
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25572301
has text: is the bullet point in the same line? do you want to write other lines as well?

http://stackoverflow.com/comment/40047107
comment on: http://stackoverflow.com/a/25618424
score: 0
type: AnswerComment
has text: @user2856759 Well, that got you one step closer. I suggest you to this opportunity to learn how to use the debugger, add a break point at the first line of the delete method and step through the logic. I can tell you that you can simplify the method by taking out the first loop, because you ignoring the result fro. The find method. Remember, we're not your debugging service, you'll have to do some work yourself ;)
type: Comment

http://stackoverflow.com/q/25656562
tagged with: java
downvote count: 2
has body: I made a project in eclipse. It would receive a string either Left, Right or Center through local socket. It successfully receives one of these strings but I don't know how to instruct the program what to do next. I intend to compare the content of the received string and automatically run cmd.exe while (true) { try { socket = serverSocket.accept(); dataInputStream = new DataInputStream(socket.getInputStream()); dataOutputStream = new DataOutputStream( socket.getOutputStream()); System.out.println("ip: " + socket.getInetAddress()); System.out.println("message: " + dataInputStream.readUTF()); //receives the string /*if (dataInputStream.readUTF()=="Center") * { * //open cmd.exe * } */ dataOutputStream.writeUTF("Hello!"); A copy of my project can be found at https://www.dropbox.com/sh/xswz5qzcewee4ko/AACo8VZ_Iu0kFhn63kepOXlta?dl=0 I would really appreciate for any suggestion that you may want to give.
answer count: 1
tagged with: eclipse
score: -1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25656629
upvote count: 1
has answer: http://stackoverflow.com/a/25656629
has comment: http://stackoverflow.com/comment/40113602
has title: How to automatically run cmd.exe in eclipse
has comment: http://stackoverflow.com/comment/40092125
type: AnsweredQuestion

http://stackoverflow.com/q/25644798
type: UnansweredQuestion
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/40070493
has comment: http://stackoverflow.com/comment/40070238
type: Question
has comment: http://stackoverflow.com/comment/40070851
has comment: http://stackoverflow.com/comment/40071033
has title: My JAR File Won,t Run On Other PCs
has body: So I just compiled my application in Netbeans. It works fine if I copy the JAR to my desktop and doubleclick (A small GUI is displayed). But when I run the JAR on another PC, it won't work. Both PCs are running the latest JRE. The Error Code I get is:"A Java Exception has occured" I have also tried ziping up the dist folder where the JAR is in, but this did't make sense to me as only the JAR file was inside the dist folder. The third method I tried was zipping up the whole project folder, copying it to the other PC and running the JAR from inside the (unzipped) folder. The Manifest file reads: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.2 Created-By: 1.8.0_11-b12 (Oracle Corporation) Class-Path: lib/javaee-api-7.0.jar lib/swing-layout-1.0.4.jar X-COMMENT: Main-Class will be added automatically by build Main-Class: gui.gui
has answer: http://stackoverflow.com/a/25892810
tagged with: java
has comment: http://stackoverflow.com/comment/40072301
has comment: http://stackoverflow.com/comment/40069890
tagged with: netbeans
has comment: http://stackoverflow.com/comment/40072795
score: 0

http://stackoverflow.com/a/25562984
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39920702
has comment: http://stackoverflow.com/comment/39920777
has comment: http://stackoverflow.com/comment/39920532
score: 3
accepted answer of: http://stackoverflow.com/q/25562784
has comment: http://stackoverflow.com/comment/39920654
type: Answer
answers question: http://stackoverflow.com/q/25562784
has comment: http://stackoverflow.com/comment/39920679
has comment: http://stackoverflow.com/comment/39920631
has comment: http://stackoverflow.com/comment/39920389
has body: I think I would go for something like this: public class MySingleton implements IConfigurationObserver { // Member(s) private static volatile MySingleton instance; private final Configuration configuration; private volatile ParsedConfiguration currentConfig; // Constructor(s) private MySingleton(Configuration configuration) { this.configuration = configuration; parseConfiguration(); configuration.addObserver(this); } public static MySingleton getInstance(Configuration configuration) { // Perform synchronized creation if applicable (double locking technique) MySingleton syncInstance = instance; if (syncInstance == null) { synchronized(MySingleton.class) { syncInstance = instance; // Verify once again after synchronizing if(syncInstance == null) { syncInstance = new MySingleton(configuration); instance = syncInstance; } } } return syncInstance; } // Private Method(s) private void parseConfiguration() { // Import values from the configuration currentConfig = configuration.getNewParsedConfiguration(); } // Public Method(s) public String buildSentence() { // Build a new string based on values pulled from the current configuration ParsedConfiguration configInUse = currentConfig; StringBuilder strBuilder = new StringBuilder(); strBuilder.append(configInUse.getFirstParam()); strBuilder.append(" - "); strBuilder.append(configInUse.getSecondParam()); return strBuilder.toString(); } // Observer Method(s) @Override public void onConfigurationUpdated() { // The configuration has changed. Parse it again. parseConfiguration(); } } Take note of the safeguard to move currentConfig to a local variable at the beginning of buildSentence so the reference to the used ParsedConfig can't change mid-method.
upvote count: 3

http://stackoverflow.com/comment/40164724
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25696270
type: Comment
has text: @bscouth Please accept this if it has worked for you. Many questions are missing "best answers" due to people forgetting/not caring for choose one. This is NOT how stackoverflow is meant to wrom (you got your answer, screw everyone else). Let the community know you found an answer and that it was helpful

http://stackoverflow.com/comment/40165009
type: QuestionComment
comment on: http://stackoverflow.com/q/25696612
has text: Because the type of your **reference variable** is `ParentClass` and Parent Class is clueless about the functionality of its children.
score: 1
type: Comment

http://stackoverflow.com/a/25610870
accepted answer of: http://stackoverflow.com/q/25610562
type: Answer
score: 0
has body: i would recommend using a Hashmap. HashMap&lt;String, String&gt; myMap = new HashMap&lt;String, String&gt;(); and using put to assign name to the key set and a message to the value set. myMap.put("john","This person is never in"); etc Set set = myMap.entrySet(); // check set values System.out.println("Set values: " + set); to print out name and status
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40008633
answers question: http://stackoverflow.com/q/25610562

http://stackoverflow.com/comment/40472239
type: AnswerComment
comment on: http://stackoverflow.com/a/25705838
has text: This is little bit constraining as we don't own the hbase table so we cannot mess with it's structure. Adding dynamically colums directly to the query looks interesting, but will be more awesome if there is no need to define the schema previously :)
type: Comment
score: 0

http://stackoverflow.com/comment/40175379
has text: True. I was focusing on the intent (doubling the length of the byte array) rather than the implementation, since that's what the question seemed to be about.
type: Comment
comment on: http://stackoverflow.com/a/25697512
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39978126
has text: @SotiriosDelimanolis ok I added the console output
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25594066
type: Comment

http://stackoverflow.com/q/25698681
has title: "A derived-class constructor cannot catch exceptions thrown by its base-class constructor." But able to catch it
has body: The below statement is from thinking in java, "A derived-class constructor cannot catch exceptions thrown by its base-class constructor." But I am able to catch it. Can Anyone explain where I went wrong? class Base { Base() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } } class Derived extends Base { Derived() throws CloneNotSupportedException, RuntimeException {} public static void main(String[] args) { try { Derived d = new Derived(); } catch(CloneNotSupportedException e) { e.printStackTrace(); } catch(RuntimeException re){} } } output: java.lang.CloneNotSupportedException at Base.&lt;init&gt;(Coffee.java:4) at Derived.&lt;init&gt;(Coffee.java:9) at Derived.main(Coffee.java:14)
type: Question
has answer: http://stackoverflow.com/a/25698693
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25698721
score: 0
tagged with: exception
tagged with: java

http://stackoverflow.com/q/25711426
tagged with: elasticsearch
tagged with: shingles
has title: How to use synonym filter and shingle filter together?
score: 5
answer count: 0
type: UnansweredQuestion
downvote count: 0
has body: I'm trying to use a shingle filter with synonym filter (see code below). This gives me the output: enforced implemented implemented for for examination examination testing The words enforced and implemented are occurring together same as testing and examination. Is it possible to get the following output? enforced for implemented for for examination for testing JSON Definition String json = jsonBuilder() .startObject() .field("number_of_shards", 1) .startObject("analysis") .startObject("filter") .startObject("my_shingle_filter") .field("type","shingle") .field("min_shingle_size",2) .field("max_shingle_size",2) .field("output_unigrams",false) .endObject() .startObject("my_syn_filter") .field("type", "synonym") .field("format","wordnet") .field("synonyms_path","prolog/wn_s.pl") .endObject() .endObject() .startObject("analyzer") .startObject("my_shingle_analyzer") .field("type", "custom") .field("tokenizer","standard") .field("filter",new String[]{"lowercase","my_syn_filter","my_shingle_filter"}) .endObject() .endObject() .endObject() .endObject().string(); client.admin().indices().prepareCreate("testshingle").setSettings(ImmutableSettings.settingsBuilder() .loadFromSource(json)) .execute().actionGet(); AnalyzeResponse resp= client.admin().indices().prepareAnalyze("testshingle", "implemented for testing").setAnalyzer("my_shingle_analyzer").execute().get(); for(AnalyzeToken token:resp.getTokens()){ System.out.println(token.getTerm()); }
favorite count: 0
type: Question
tagged with: synonym
upvote count: 5
tagged with: java

http://stackoverflow.com/a/25667554
score: 3
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40115522
accepted answer of: http://stackoverflow.com/q/25666182
type: Answer
answers question: http://stackoverflow.com/q/25666182
has body: You can use the exec-maven-plugin to execute the final step what you have implemented into Groovy furthermore you need to added build-helper-maven-plugin to add the supplemental artifact to Maven to get it deployed with the rest of your artifacts. org.codehaus.mojo exec-maven-plugin 1.3.2 package java org.trifort.rootbeer.entry.Main ${project.build.directory}/${project.artifactId}.jar ${project.build.directory}/${project.artifactId}.jar -nodoubles
upvote count: 3

http://stackoverflow.com/comment/40182310
type: AnswerComment
comment on: http://stackoverflow.com/a/25650479
score: 0
type: Comment
has text: That updated code will try to extract subclasses from the class IRI and not from the label. If you run the code with an owl file with class IRI 'US(America)' for example, it will fail with message: `Exception in thread "main" org.semanticweb.owlapi.expression.ParserException: Encountered untitled-ontology-24 at line 1 column 1. Expected one of: Class name Object property name Data property name not inverse ( {`. I think my real issue is, how to I extract subclasses with support for reserved IRI characters like parenthesis? I thought the answer was using 'labels' somehow.

http://stackoverflow.com/q/25600202
has title: Java : Implicit cast of Object at compile-time doesn't work but work with reflection
downvote count: 0
tagged with: casting
has body: Given the following code : import java.lang.reflect.Array; import java.lang.reflect.Method; public class Test { public static void test_function(int[] values) { System.out.println("Class of values : " + values.getClass()); System.out.println(values[0]); } public static void main(String[] args) { Object a = Array.newInstance(int.class, 3); Array.set(a, 0, 5); Class a_class = a.getClass(); Class int_array_class = int[].class; System.out.println("Class of int[] : " + int[].class); System.out.println("Class of a : " + a.getClass()); System.out.println("int_array_class : " + int_array_class); System.out.println("a_class : " + a_class); // These instructions will provoke a compile-time error // test_function(a); // test_function(a_class.cast(a)); // test_function(int_array_class.cast(a)); // The following call won't cause any problem test_function((int[]) a); Method testf = null; try { testf = Test.class.getMethod("test_function", int[].class); testf.invoke(null, a); // Does not provoke exception at run-time either testf.invoke(null, a_class.cast(a)); testf.invoke(null, int_array_class.cast(a)); } catch(Exception e) { e.printStackTrace(); } } } I noticed that passing explicitly an Object to a method doesn't work. The three commented instructions will provoke the following error if uncommented : Test.java:25: error: method test_function in class Test cannot be applied to given types; test_function(a); ^ required: int[] found: Object reason: actual argument Object cannot be converted to int[] by method invocation conversion Test.java:26: error: method test_function in class Test cannot be applied to given types; test_function(a_class.cast(a)); ^ required: int[] found: Object reason: actual argument Object cannot be converted to int[] by method invocation conversion Test.java:27: error: method test_function in class Test cannot be applied to given types; test_function(int_array_class.cast(a)); ^ required: int[] found: Object reason: actual argument Object cannot be converted…
has answer: http://stackoverflow.com/a/25600268
favorite count: 0
tagged with: object
type: AnsweredQuestion
score: 3
upvote count: 3
answer count: 3
tagged with: reflection
has answer: http://stackoverflow.com/a/25600264
tagged with: java
possible better answer: http://stackoverflow.com/a/25600264
has answer: http://stackoverflow.com/a/25600482
accepted answer: http://stackoverflow.com/a/25600482
type: Question
tagged with: compiler-errors

http://stackoverflow.com/a/25624476
type: Answer
has comment: http://stackoverflow.com/comment/40037392
has comment: http://stackoverflow.com/comment/40033789
accepted answer of: http://stackoverflow.com/q/25624458
has comment: http://stackoverflow.com/comment/40034281
has comment: http://stackoverflow.com/comment/40034067
answers question: http://stackoverflow.com/q/25624458
has comment: http://stackoverflow.com/comment/40034157
has comment: http://stackoverflow.com/comment/40033960
has comment: http://stackoverflow.com/comment/40034216
has comment: http://stackoverflow.com/comment/40034746
has comment: http://stackoverflow.com/comment/40033425
has comment: http://stackoverflow.com/comment/40034220
has comment: http://stackoverflow.com/comment/40034491
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40033491
has comment: http://stackoverflow.com/comment/40033407
has comment: http://stackoverflow.com/comment/40034380
has comment: http://stackoverflow.com/comment/40033336
has comment: http://stackoverflow.com/comment/40033897
has body: Your both assumptions are wrong. 1) No one can disable browser back button (of course excluding the vendors :)). 2) Java plays on server side. Javascript plays on client side. You might want browser onunload function to prompt user. @Derek did a demo for what I mean : http://jsfiddle.net/DerekL/LZCj7/show/
has comment: http://stackoverflow.com/comment/40035730
upvote count: 8
has comment: http://stackoverflow.com/comment/40034480
downvote count: 2
score: 6
has comment: http://stackoverflow.com/comment/40034123

http://stackoverflow.com/comment/40125335
comment on: http://stackoverflow.com/q/25675043
score: 0
has text: @ShairyarShafqat - please do provide the code you used for getting largest/smallest number for two inputs. Then we can lead you to the solution.
type: Comment
type: QuestionComment

keystore
tags question: http://stackoverflow.com/q/25577933
tag name: keystore
tags question: http://stackoverflow.com/q/25644681
type: Tag
tags question: http://stackoverflow.com/q/25562494

http://stackoverflow.com/comment/39942135
comment on: http://stackoverflow.com/q/25574038
type: QuestionComment
has text: There really isn't a method to accomplish this. Access to system resources (like applications that run locally) is the attack vector that a virus would use. Possibly by running an applet where you request system access from the user but here the browser would present a stern warning to not grant this access
score: 0
type: Comment

http://stackoverflow.com/q/25690611
answer count: 0
has comment: http://stackoverflow.com/comment/40153423
has title: Socket Issue on Unix, but the same code works on Windows
type: Question
tagged with: linux
has comment: http://stackoverflow.com/comment/40153229
type: UnansweredQuestion
tagged with: sockets
tagged with: windows
tagged with: java
has comment: http://stackoverflow.com/comment/40157002
has comment: http://stackoverflow.com/comment/40153805
tagged with: unix
has comment: http://stackoverflow.com/comment/40162130
score: 0
has body: I have the java program below that works when executed on windows 8, but when I publish the program to a unix server, it does not work and throws a timeout on din.read() method. socket2 = new Socket (ip, porta); socket2.setSoTimeout(3000); PrintStream pout = new PrintStream ( socket2.getOutputStream() ); DataInputStream din = new DataInputStream( socket2.getInputStream() ); pout.println("GST"); //I am not sure if the other side is receiving this command pout.flush(); int retint = din.read(); //here is the timeout System.out.println( retint ); fechaSocket(socket2); return ""+ retint;

http://stackoverflow.com/q/25597690
has comment: http://stackoverflow.com/comment/39986224
has comment: http://stackoverflow.com/comment/39984585
score: 0
has answer: http://stackoverflow.com/a/25597886
has title: I'm trying to write a simple switch statement
answer count: 3
has answer: http://stackoverflow.com/a/25597739
has comment: http://stackoverflow.com/comment/39984574
type: Question
has answer: http://stackoverflow.com/a/25597711
has body: I know this not going to compile and run at this point. However is the switch statement right? I did get a compiler error of: class, interface, or enum expected public class Fruit { public static void main(String[] args) { String choice = " "; switch(choice) { case " A ": System.out.print(" Apple"); break; case " K ": System.out.println("Kiwi"); break; case " P ": System.out.println("Pear"); break; default: System.out.println("incorrect choice"); } } }
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/338206
tagged with: java

http://stackoverflow.com/a/44551533
score: 0
answers question: http://stackoverflow.com/q/25701521
type: Answer
has body: Best way: Not just for this pattern, for any kind of sequence input recognition, modify delimiter of Scanner object to get required sequence recognized. Here, in this case, change chopper delimiter to whitespace character (Spaces). i.e "\\s". You can also use "\\s*" for specifying zero or more occurrence of whitespace characters This makes Scanner to check for spaces rather than waiting for Enter key stroke. public static void main (String args[]) { Scanner chopper = new Scanner(System.in).useDelimiter("\\s"); \\ Delimiter changed to whitespace. System.out.println("Enter a list of number: "); int[] numCount = new int[10]; int number; while (chopper.hasNextInt()) { number = chopper.nextInt(); numCount[number]++; } for (int i = 0; i &lt; 10; i++) { System.out.println(i + " - " + numCount[i]); } }

http://stackoverflow.com/comment/40133290
type: AnswerComment
comment on: http://stackoverflow.com/a/25665052
type: Comment
score: 0
has text: Seems like all build of the vfs sandbox point to old classes. And the download of the sandbox on the apache commons vfs page is not available. I'm really stuck here - just save a file to a Windows Share...

http://stackoverflow.com/a/25743199
has body: I have no idea about this kind of library, but you can always do: try { ... } catch (IOException) { if (e instanceof GoogleJsonResponseException){ GoogleJsonResponseException ex = e; switch (ex.getStatusCode()){ case 400: ... case 404: ... /*and the rest of codes available through endpoints*/ } } else { /*Manage other exceptions, maybe connection issues?*/ } }
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25694769
downvote count: 0
has comment: http://stackoverflow.com/comment/40255485
upvote count: 1

rtmp
tag name: rtmp
tags question: http://stackoverflow.com/q/25683361
type: Tag

http://stackoverflow.com/q/25704182
tagged with: jdbc
upvote count: 1
score: -1
type: AnsweredQuestion
tagged with: java
downvote count: 2
answer count: 1
tagged with: mysql
has answer: http://stackoverflow.com/a/25704244
accepted answer: http://stackoverflow.com/a/25704244
has title: java.lang.ClassNotFoundException: con.mysql.jdbc.Driver
favorite count: 0
type: Question
has body: I am trying to access a MySql database through servlet but it shows java.lang.ClassNotFoundException: con.mysql.jdbc.Driver and java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/aptitude I am using xampp for implementation of program, and I already set the classpath of mysql connector,and also put the mysql-connector to web-inf\lib but I m still facing the same problem. Suggestions? import java.sql.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class aptservlet1 extends HttpServlet { public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String correct=2+""; res.setContentType("text/html"); PrintWriter out=res.getWriter(); String user,pass; user=req.getParameter("user"); pass=req.getParameter("pass"); //apt1 o1=new apt1(); user=user.trim(); pass=pass.trim(); try { Class.forName("con.mysql.jdbc.Driver"); } catch(ClassNotFoundException ce) { out.println(ce+"&lt;br&gt;"); } try { String url="jdbc:mysql://localhost:3306/" + "aptitude"; Connection con=DriverManager.getConnection(url,"root",""); Statement s=con.createStatement(); ResultSet rs=s.executeQuery("select a_pass from admin_database where a_user='"+user+"'"); rs.next(); String s1=rs.getString(1); if(s1.equals(pass)) { correct=1+""; } else { correct=0+""; } rs.close(); s.close(); con.close(); } catch(SQLException se) { out.println(se+"&lt;br&gt;"); } out.println("value of correct="+correct); ServletContext sc=this.getServletContext(); } }
has comment: http://stackoverflow.com/comment/40178282

http://stackoverflow.com/a/25713099
has comment: http://stackoverflow.com/comment/40195159
answers question: http://stackoverflow.com/q/25712830
downvote count: 1
has comment: http://stackoverflow.com/comment/40195116
type: Answer
has body: There are multiple questions. What is the commandName specified in the controller. is it info and does info has chapter attribute. try using this if info is the commandName &lt;form:form method="post" action="/insertChapter" commandName="info"&gt;
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25712830
score: 1
type: AcceptedAnswer

puppet
tags question: http://stackoverflow.com/q/25570750
tag name: puppet
tags question: http://stackoverflow.com/q/25661784
type: Tag

http://stackoverflow.com/q/25610378
score: 3
upvote count: 3
accepted answer: http://stackoverflow.com/a/25673066
tagged with: java
tagged with: javadoc
has body: Doxygen can generate class diagrams with graphiz. For example: class A {...}; class B extends A {...}; From this code I can generate a picture where doxygen can show that one class it the parent of an other. But is there a way to generate a picture from code with manual references between classes? For example when I describe DB scheme and use contract classes (http://developer.android.com/training/basics/data-storage/databases.html#DefineContract) I want to perform smth like this: class MainClass { class A { String COLUMN_ID = "id_a"; } /** * {@dotlinkto MainClass.A} **/ @OrAnotationToDrawLink(A.class) class B { String COLUMN_ID = "id_b"; String COLUMN_FOREIGN_KEY_TO_A = "id_a_key"; } } And generate a picture of 2 classes A and B with reference between them. I've tried to search through documentation but can't find any suitable examples or explanation about custom drawing in javadoc+doxygen+graphviz.
tagged with: graphviz
has answer: http://stackoverflow.com/a/25673066
tagged with: doxygen
has title: Doxygen dot. Draw link between classes by annotation
tagged with: dot
type: AnsweredQuestion
answer count: 1
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/comment/40054471
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25635583
has text: @Kerppag Thank you. that worked. If you post it as an answer i can set it as the right answer and everybody can see it.

http://stackoverflow.com/q/25638462
has comment: http://stackoverflow.com/comment/40059630
tagged with: web-services
tagged with: servlet-filters
has comment: http://stackoverflow.com/comment/40059204
has comment: http://stackoverflow.com/comment/40061143
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25640232
has comment: http://stackoverflow.com/comment/40060360
has comment: http://stackoverflow.com/comment/40062957
has comment: http://stackoverflow.com/comment/40058772
tagged with: java
linked to: http://stackoverflow.com/q/1413129
tagged with: spring
has comment: http://stackoverflow.com/comment/40061020
has title: How can i get request in Filter
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/25641044
accepted answer: http://stackoverflow.com/a/25640232
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25641044
has answer: http://stackoverflow.com/a/25638725
downvote count: 0
answer count: 3
has body: I want to log all requests and messages of request body in My REST Web Service Project. I use Spring and json message conveter. But I face with java.lang.IllegalStateException: getReader() has already been called for this request. How can I solve? Or Is there another way? web.xml <?xml version="1.0" encoding="UTF-8"?> index.jsp contextConfigLocation /WEB-INF/spring/root-context.xml org.springframework.web.context.ContextLoaderListener appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/appServlet/servlet-context.xml 1 appServlet / LogFilter com.cmpolaris.system.LogFilter LogFilter /* spring-beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <annotation-driven /> <resources mapping="/resources/**" location="/resources/" /> <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <beans:property name="prefix" value="/WEB-INF/views/" /> <beans:property name="suffix" value=".jsp" /> </beans:bean> <beans:bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"> <beans:property name="messageConverters"> <beans:list> <beans:ref bean="jsonMessageConverter"/> </beans:list> </beans:property> </beans:bean> <beans:bean id="jsonMessageConverter"…
has comment: http://stackoverflow.com/comment/40061536
has comment: http://stackoverflow.com/comment/40060858

http://stackoverflow.com/a/25710042
answers question: http://stackoverflow.com/q/25709948
has body: you can refer to this basically inner class keep the object oriented programming more intact. Also sometime when you have to implement an interface which has only one unimplemented method inner class comes handy. specially anonymous inner class. also instead of writing complicated if-else structure or switch case we can use this inner classes for callbacks
has comment: http://stackoverflow.com/comment/40189670
type: Answer
score: 0

http://stackoverflow.com/comment/40132637
type: QuestionComment
has text: Have you tried clicking on it and pressing Ctrl+E?
comment on: http://stackoverflow.com/q/25679284
score: 0
type: Comment

http://stackoverflow.com/comment/40200625
score: 0
comment on: http://stackoverflow.com/a/25715956
type: Comment
has text: Wow, thats a hell of a lot to wrap my head around. Luckily I have time to figure this all out though, thanks
type: AnswerComment

http://stackoverflow.com/comment/40029574
comment on: http://stackoverflow.com/a/25621257
type: Comment
has text: Using serializer-2.7.0 instead of serializer-2.7.1 the issue is fixed. Thank you @BatScream.
type: AnswerComment
score: 0

http://stackoverflow.com/q/25566658
has comment: http://stackoverflow.com/comment/39928401
type: AnsweredQuestion
score: 4
has body: I am trying to implement a failover system. So I have created a monitoring server which is suppose to route the request to different application server which is alive. So far I have designed a small monitoring server and trying to route the request using HTTP/1.1 302 Found\r\n status code. But I am not able to redirect to my virtual machine although I can access that directly on my browser by typing the url. Routing code - class Connection extends Thread{ Socket clientSocket; BufferedReader din; OutputStreamWriter outWriter; public Connection(Socket clientSocket){ try{ this.clientSocket = clientSocket; din = new BufferedReader(new InputStreamReader(clientSocket.getInputStream(), "ASCII")); outWriter = new OutputStreamWriter(clientSocket.getOutputStream()); this.start(); }catch(IOException e){ System.out.println("Connection: " + e.getMessage()); } } public void run(){ try{ String line = null; while((line = din.readLine())!=null){ System.out.println("Read" + line); if(line.length()==0) break; } //here write the content type etc details: System.out.println("Someone connected: " + clientSocket); }catch(EOFException e){ System.out.println("EOF: " + e.getMessage()); } catch(IOException e){ System.out.println("IO at run: " + e.getMessage()); }finally{ try{ routeRequest(outWriter); outWriter.close(); clientSocket.close(); }catch(IOException e){ System.out.println("Unable to close the socket"); } } } public void routeRequest(OutputStreamWriter outWriter){ try { outWriter.write("HTTP/1.1 302 Found\r\n"); outWriter.write("Date: Tue, 11 Jan 2011 13:09:20 GMT\r\n"); outWriter.write("Content-type: text/plain\r\n"); outWriter.write("Server: vinit\r\n"); outWriter.write("Location: http://192.168.74.128:8080/Stateless/index.html"); outWriter.write("Connection: Close"); outWriter.write("\r\n\r\n"); // String responseStr = " Hello Hello world from my server \r\n"; // outWriter.write(responseStr); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } B…
has comment: http://stackoverflow.com/comment/39927264
has comment: http://stackoverflow.com/comment/39926613
tagged with: java
has comment: http://stackoverflow.com/comment/39928147
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25567701
has title: Redirecting HTTP request to different server
has comment: http://stackoverflow.com/comment/39926508
tagged with: http
favorite count: 0
has answer: http://stackoverflow.com/a/25567701
type: Question
tagged with: network-programming
has comment: http://stackoverflow.com/comment/39927933
has comment: http://stackoverflow.com/comment/39926691
tagged with: sockets
has comment: http://stackoverflow.com/comment/39927994
upvote count: 4

http://stackoverflow.com/q/25560315
answer count: 1
downvote count: 3
has comment: http://stackoverflow.com/comment/39915132
favorite count: 0
has answer: http://stackoverflow.com/a/25560355
type: Question
linked to: http://stackoverflow.com/q/270197
tagged with: nullpointerexception
type: UnansweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/39915185
duplicate of: http://stackoverflow.com/q/15581687
has body: This is my first question, I hope it's not too poorly made. I'm definitely beginner level at java, probably lower. I'm taking most of my code from a tutorial in fact, hoping I'll learn what all the things do soon enough. Anyway, so far, I have 3 .java files in my program, and it shows the exception to be at all 3 of them, plus one I never made. Here's the full error: Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.&lt;init&gt;(ImageIcon.java:205) at Emilia.&lt;init&gt;(Emilia.java:17) at Board.&lt;init&gt;(Board.java:26) at TestGame.&lt;init&gt;(TestGame.java:7) at TestGame.main(TestGame.java:18) Here's all the code: TestGame.java import javax.swing.JFrame; public class TestGame extends JFrame { public TestGame() { add(new Board()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(400, 300); setLocationRelativeTo(null); setTitle("Project Obcasus"); setResizable(false); setVisible(true); } public static void main(String[] args) { new TestGame(); } } Board.java import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Board extends JPanel implements ActionListener { private Timer timer; private Emilia emilia; public Board() { addKeyListener(new TAdapter()); setFocusable(true); setBackground(Color.BLACK); setDoubleBuffered(true); emilia = new Emilia(); timer = new Timer(5, this); timer.start(); } public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D)g; g2d.drawImage(emilia.getImage(), emilia.getX(), emilia.getY(), this); Toolkit.getDefaultToolkit().sync(); g.dispose(); } public void actionPerformed(ActionEvent e) { emilia.move(); repaint(); } private class TAdapter extends KeyAdapter { public void keyReleased(KeyEvent e) { emilia.keyReleased(e); } public void keyPressed(KeyEvent e) { emilia.keyPressed(e); } } } Emilia.java import java.awt.Image; import java.awt.event.KeyEvent; import javax.swing.ImageIcon; public class Emilia { private String emilia = "emiliasprite.png"; private int d…
has comment: http://stackoverflow.com/comment/39915151
upvote count: 1
tagged with: java
has title: java.lang.NullPointerException Issue When Attempting to Run Program

jpanel
tags question: http://stackoverflow.com/q/25578334
tags question: http://stackoverflow.com/q/25671865
tags question: http://stackoverflow.com/q/25621964
tags question: http://stackoverflow.com/q/25579480
tags question: http://stackoverflow.com/q/25643167
tags question: http://stackoverflow.com/q/25698479
tags question: http://stackoverflow.com/q/25612316
tags question: http://stackoverflow.com/q/25684969
tags question: http://stackoverflow.com/q/25651445
tags question: http://stackoverflow.com/q/25657330
tag name: jpanel
type: Tag
tags question: http://stackoverflow.com/q/25674947
tags question: http://stackoverflow.com/q/25571162
tags question: http://stackoverflow.com/q/25710812
tags question: http://stackoverflow.com/q/25670736
tags question: http://stackoverflow.com/q/25600122
tags question: http://stackoverflow.com/q/25621312
tags question: http://stackoverflow.com/q/25626458
tags question: http://stackoverflow.com/q/25614241
tags question: http://stackoverflow.com/q/25646891
tags question: http://stackoverflow.com/q/25581631

http://stackoverflow.com/comment/40184775
type: AnswerComment
comment on: http://stackoverflow.com/a/25707656
has text: @cooldudsk-Thanks! I am happy that you wanted the same and you achieved it!
type: Comment
score: 0

http://stackoverflow.com/q/25571796
answer count: 1
tagged with: selenium-webdriver
has body: I'm trying to get the text of webelement through xpath. Attached are the html content of the page, I used the following code, String v = driver.findElement(By.xpath("//div[1]/div[contains(@class, 'ng-scope ngRow')]//div[contains(@class, 'ngCell ng-scope col7 colt7')//" + "div[contains(@class, 'ngCellText ng-scope ngCellElement col7 colt7')]")).getText(); This throws the error 'The expression is not a legal expression." code: "12" nsresult: "0x805b0033 (SyntaxError)" location: ""]'. When I downsized the search till String v = driver.findElement(By.xpath("//div[1]/div[contains(@class, 'ng-scope ngRow')]")).getText(); it works and I'm getting all the text in the particular row. However, when I extend it specific to a column as shown in the 1st code, I get error. html snippet, Closed
has comment: http://stackoverflow.com/comment/39937016
has answer: http://stackoverflow.com/a/25575183
tagged with: java
has title: Getting the text of a webelement through xpath
has comment: http://stackoverflow.com/comment/39938475
favorite count: 0
has comment: http://stackoverflow.com/comment/39937857
has comment: http://stackoverflow.com/comment/39937073
tagged with: xpath
type: Question
upvote count: 2
score: 2
tagged with: firefox
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/40076423
comment on: http://stackoverflow.com/q/25647845
type: Comment
type: QuestionComment
has text: @peeskillet There are many classes which read that files. I can't change code - to many changes needs to be done. Project runs perfectly from eclipse. Pictures are not a problem. Txt files and ser files are causing problem because they are not attached to the jar
score: 0

http://stackoverflow.com/a/25571208
has body: In an expression like statement, string constant would be constructed by compiler using StringBuilder. In an example of true ? "Must be a string" : new Object(), turns to true ? new StringBuilder ("Must be a string") : new Object(). Hence there was no match for StringBuilder, then it tries to typecast to parent default Object type.
answers question: http://stackoverflow.com/q/25570898
type: Answer
score: 0

http://stackoverflow.com/comment/40008871
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25610917
has text: `King` is a `Piece`. Why does it need to take a `Piece` argument?
score: 0

http://stackoverflow.com/q/25688339
has comment: http://stackoverflow.com/comment/40149252
has comment: http://stackoverflow.com/comment/40148868
type: Question
has comment: http://stackoverflow.com/comment/40149014
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25689362
has title: Java : Create Table in Database
linked to: http://stackoverflow.com/q/11962028
score: 0
has body: I have been trying to create a table in the database. The code shows no error and runs fine but in the end no table was created in the database. Help please. public void createTable(){ try { String host = "jdbc:derby://localhost:1537/fypDB"; String uname = "test"; String pword = "test"; Connection con = DriverManager.getConnection( host, uname, pword ); Statement stmt = con.createStatement(); //username is valid variable from main class String SQL = "CREATE TABLE "+username+" (classId VARCHAR(255), "+"PRIMARY KEY ( classId ))"; stmt.executeUpdate( SQL ); System.out.println(SQL); } catch (SQLException err){ System.out.println(err.getMessage()); } }
tagged with: java
answer count: 1
tagged with: mysql
has comment: http://stackoverflow.com/comment/40148720

http://stackoverflow.com/q/25584256
tagged with: scheduledexecutorservice
score: 0
has body: I have a background thread which runs every 5 minutes. I am using ScheduledExecutorService for this. Every five minutes, I am making a call to one of my service and parsing the response coming back from that service. public class ThreadScheduler { private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); public void startScheduleTask() { scheduler.scheduleAtFixedRate(new Runnable() { public void run() { try { callService(); } catch (Exception ex) { // log error } } }, 0, 5L, TimeUnit.MINUTES); } public void callService() throws Exception { // execute the service and parse the response } } Now the above code is running in 1000 machines and they all are started at the same time, so that means it will make all the 1000 calls every 5 minutes simultaneously to my service. I'm trying to spread the load more evenly over a 5 minute window. Is this possible to do by any chance with the above code? I am just trying to spread the load more evenly on my service over the 5 minute window so that it doesn't hit my service at the same time which will put more load once all the systems are started up simultaneously. I came up with the below code trying to spread the load more evenly over the five minute window: public class ThreadScheduler { private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); public void startScheduleTask() { scheduler.scheduleAtFixedRate(new Runnable() { public void run() { try { callService(); } catch (Exception ex) { // log error } } }, (int)(Math.random()*5*60), 5*60L, TimeUnit.SECONDS); } public void callService() throws Exception { // execute the service and parse the response } } Is this the right way to evenly spread out the load over the 5 minute window or not.
tagged with: java
has answer: http://stackoverflow.com/a/25584583
type: Question
type: UnansweredQuestion
tagged with: multithreading
answer count: 1
has title: Spreading the load more evenly from a background thread

http://stackoverflow.com/a/25698903
type: Answer
answers question: http://stackoverflow.com/q/25670893
score: 0
has body: If everyone understood my question correctly, this was the answer I was looking for.Finally did it myself as well sharing the answer. path=`grep -oE "LD_LIBRARY_PATH=\S*:" /etc/init.d/postgresql-9.1` echo "path:"$path path_array=($path) ld_lib_path=${path_array[0]} echo "ld_lib_path : "$ld_lib_path ld_lib_path1=${ld_lib_path#*=} ld_lib_path2=${ld_lib_path1%:*} echo "ld_lib_path2 : "$ld_lib_path2 cd $ld_lib_path2 cd ../bin Now we can use pg_dump,pg_dumpall to take backup of old DataBase.

http://stackoverflow.com/comment/40130182
type: QuestionComment
has text: I'm trying to run the page on start-up, I tried to change my controller class name into ProductsHomeController, so the contoller class name will match my mapping value `/productsHome` which I was expecting to be mapped by the servlet on startup, I even changed the method name still no luck :(,
comment on: http://stackoverflow.com/q/25656007
type: Comment
score: 0

http://stackoverflow.com/comment/40117949
has text: tried exact same thing but did not work.. same error. Can you tell me the list of all commands?
comment on: http://stackoverflow.com/a/25671278
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25696865
has body: My code is : public void runSomething(){ System.out.println(System.getProperty("1")); System.out.println(System.getProperty("2")); System.out.println(System.getProperty("3")); } I need to run it from command prompt. I am using: java -jar jarname.jar -D1=111 -D2=222 -D3=333 Is this wrong way of passing argument values from command prompt as I am not able to print the values? How to pass the values by key names from command prompt?
favorite count: 0
has answer: http://stackoverflow.com/a/25696876
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/25696875
score: 1
has answer: http://stackoverflow.com/a/25717371
tagged with: java
tagged with: jvm-arguments
type: UnansweredQuestion
downvote count: 0
has title: Running jar from command promt with multiple arguments windows
upvote count: 1

http://stackoverflow.com/comment/39991336
score: 0
type: Comment
type: QuestionComment
has text: do you mean importing?
comment on: http://stackoverflow.com/q/25601467

http://stackoverflow.com/a/25701917
has comment: http://stackoverflow.com/comment/40174224
downvote count: 0
has comment: http://stackoverflow.com/comment/40174169
has comment: http://stackoverflow.com/comment/40177324
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/40177846
answers question: http://stackoverflow.com/q/25701850
upvote count: 4
has body: Consider this code: synchronized(obj) { obj.notify(); threadWatingOnObj.interrupt(); } Before the thread executing the above code releases the lock, no notified thread will be able to proceed. Therefore, when control returns to such a thread from its obj.wait() call, it will have been both notified and interrupted.

http://stackoverflow.com/a/26549431
answers question: http://stackoverflow.com/q/25688663
has body: The solution should be to switch to a different Java version on your Linux machine: I had exactly the same problem (devloping on Windows 7 / execution on Linux, same error stack trace). On my Linux server I was using "JDK 1.6.0_22-b04" and I figured out that there seems to be a bug inside of the standard java library "rt.jar". After switching to "JDK 1.7.0_51-b03", it worked.
type: Answer
score: 0

http://stackoverflow.com/comment/40162992
has text: When programming you should change things one by one, if something breaks you know its the last thing you changed. The stack trace (the error) will also try and help you. Did it break when you renamed the class? I'm not sure you can have numbers in class names.
comment on: http://stackoverflow.com/q/25695621
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25689995
has comment: http://stackoverflow.com/comment/40206711
has comment: http://stackoverflow.com/comment/40153157
answer count: 1
has body: I am trying to upload a file but I get a NullPointerException along the way. The error I am getting is SEVERE: java.lang.NullPointerException at servlet.UploadServlet.doPost(UploadServlet.java:36) on this line: InputStream is = part.getInputStream(); Here is the code for servlet and jsp page. UploadServlet @MultipartConfig(fileSizeThreshold = 1024 * 1024 * 10, maxFileSize = 1024 * 1024 * 50, maxRequestSize = 1024 * 1024 * 50) public class UploadServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { Part part = request.getPart("file"); InputStream is = part.getInputStream(); String filename = getFileName(part); String relativeWebPath = "/WEB-INF/uploads"; String absoluteFilePath = getServletContext().getRealPath(relativeWebPath); File uploadedFile = new File(absoluteFilePath, filename); FileOutputStream os = new FileOutputStream(uploadedFile); int i = is.read(); while (i != -1) { os.write(i); i = is.read(); } os.close(); } catch (Exception ex) { ex.printStackTrace(); } finally { out.close(); } } private String getFileName(Part part) { for (String cd : part.getHeader("content-disposition").split(";")) { if (cd.trim().startsWith("filename")) { String filename = cd.substring(cd.indexOf('=') + 1).trim().replace("\"", ""); return filename.substring(filename.lastIndexOf('/') + 1).substring(filename.lastIndexOf('\\') + 1); } } return null; } } upload.jsp <%@page contentType="text/html" pageEncoding="UTF-8"%> MobMel::Upload File web.xml <?xml version="1.0" encoding="UTF-8"?> RegisterServlet servlet.RegisterServlet LoginServlet servlet.LoginServlet ProfileServlet servlet.ProfileServlet UploadServlet servlet.UploadServlet RegisterServlet /RegisterServlet LoginServlet /LoginServlet ProfileServlet /ProfileServlet UploadServlet /UploadServlet 30 I hope you guys can help me fix this. Thanks
has comment: http://stackoverflow.com/comment/40152109
favorite count: 0
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/45307610
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40152564
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40152512
duplicate of: http://stackoverflow.com/q/218384
has title: Part null pointer exception
has comment: http://stackoverflow.com/comment/40152510
score: 2
upvote count: 2
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/40153024

http://stackoverflow.com/comment/40108071
comment on: http://stackoverflow.com/q/25655437
score: 0
type: Comment
type: QuestionComment
has text: Okay, since I almost have the solution (I got the values for the x and y coords of the SPAWN tile to be recorded), do I post the solution here when I get the whole solution, or not?

storage
tag name: storage
type: Tag
tags question: http://stackoverflow.com/q/25610562

http://stackoverflow.com/comment/39906758
has text: Is the real device on the same Wifi as your laptop?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25552727
type: Comment

http://stackoverflow.com/a/25691394
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25656102
score: 3
has body: This is an encoding issue. Videos have keyframes (i-frames) that store more information than other frames. A non keyframe can be built only given the previous keyframe. Trying to display a non keyframe will show green spots and pixelated jittery screen. Now, on some android devices there's no workaround implemented for this so you get this weird behavior. On a Nexus S for example seekTo() doesn't necessarily go to the specified frame. I tried other devices with the same android version and they seek just fine.
type: Answer
answers question: http://stackoverflow.com/q/25656102
has comment: http://stackoverflow.com/comment/87141659
upvote count: 3

http://stackoverflow.com/q/25688659
has title: Determinate NAT type and port prediction on symmetric NAT
score: 3
upvote count: 3
tagged with: java
favorite count: 0
tagged with: network-programming
type: Question
tagged with: sockets
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: hole-punching
tagged with: nat
has comment: http://stackoverflow.com/comment/64117406
has body: first thing sorry for my bad English but it is not my first language. My question is this: I'm working for realize a simple software for desktop sharing, using Java. The first problem is how can communicate two client that are behind NAT. After some research on Internet, I found that one of the better solution is to use the technique of UDP hole punching. If I correctly understood, this function works in the following way: A = client1 NA = nat of client 1 B = client 2 NB = nat of client 2 S = public server 1 - A sends a UDP packet to S 2 - S receives the public IP and the public port of NA 3 - B sends a UDP packet to S 4 - S receives the public IP and the public port of NB 5 - S sends a UDP packet to A with the public ip and port of B through the binded socket that received the first packet from A 6 - S sends a UDP packet to B with the public ip and port of A through the binded socket that received the first packet from B 7 - A sends a UDP packet to B with the specifics received from S, NB drop this packet since it doesn't know who is A (it hasn't a route for this packet). But this open a hole in the NA that can accept and inoltrate to A a packet that arrives from B. 8 - B send a UDP packet to A, NA can inoltrate the packet. I understood that this method will work only with 3 of the 4 NAT types: full cone NAT, restricted cone NAT, restricted port NAT, but not with Symmetric NUT. Now, I realized a little software that should simulate the UDP hole punching, and this is the code (I know it is not elegant, but now I want just see if the procedure works): Client: import java.io.IOException; import java.net.*; public class JavaClient { public static void main(String[] args) throws UnknownHostException, SocketException, IOException { new JavaClient().sendHostInfoToS(); } private void sendHostInfoToS() { // TODO code application logic here byte[] buffer = { 99,99,99,99,99,99,99 } ; InetAddress address; try { //Client contacts server address = InetAddress.getByName("X.XXX.XX…
has comment: http://stackoverflow.com/comment/64127583

http://stackoverflow.com/a/25587890
accepted answer of: http://stackoverflow.com/q/25587858
upvote count: 8
has body: The parameters are 1-indexed. The index needs to run from 1 to 4, so 0 is out of range.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39966596
answers question: http://stackoverflow.com/q/25587858
score: 8

http://stackoverflow.com/comment/39908473
comment on: http://stackoverflow.com/q/25555837
score: 0
type: QuestionComment
has text: Does the server library you're using not have an equivalent client library? Have you considered writing one with Apache's HTTP Client?
type: Comment

http://stackoverflow.com/comment/39938878
has text: Thank you for the advice, I really appreciate it. That shortened way of saying my if statement does look a hell of a lot better, less clunky. About the if in my main() though. So is that, that statement always receiving a zero as the return value and that's why it never goes to the else?
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25572658

http://stackoverflow.com/q/25570803
answer count: 2
has title: Image in JavaFX ListView
tagged with: javafx
has answer: http://stackoverflow.com/a/25571041
downvote count: 0
has body: Is there anyway to add an image to a JavaFX ListView? This is how I am currently setting the list view items. private ListView&lt;String&gt; friends; private ObservableList&lt;String&gt; items; items = FXCollections.observableArrayList(getFriends); friends.setItems(items); I'm also using the list view value as an id to know which was selected.
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25571041
tagged with: java
possible better answer: http://stackoverflow.com/a/35735047
score: 4
has answer: http://stackoverflow.com/a/35735047
upvote count: 4
type: AnsweredQuestion

http://stackoverflow.com/a/25652826
accepted answer of: http://stackoverflow.com/q/25652483
type: AcceptedAnswer
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/25652483
upvote count: 6
has body: To address some confusion about "arrays of arrays" and 2D arrays: Java doesn't really have 2D arrays. At least, not in the way many people think of them, where they look like a matrix, and you have rows and columns and the same number of elements in each row. You can use an "array of arrays" as a 2D array. If you want an array of 5 x 8 integers, you can say int[][] arr = new int[5][8]; But Java does not enforce the "matrix-ness" or "2D-ness" of an array. What it gives you is an array of 5 references, each of which refers to another array of integers. Each reference starts out referring to an array of 8 integers, but this is not enforced; you could later say arr[2] = new int[113]; or arr[2] = null; and now your array is no longer really a 2D array (as we usually think of it), but Java will not stop you from doing that. So while you may often see something like byte[][] used in textbooks to create a 2D array, it's the same syntax as an array of arrays, and Java actually treats it as an array of arrays, not all of which have to be the same size. If you want to create an array whose elements will eventually be arrays, but that are null for now, you can do it like this: byte[][] bytesArray = new byte[10][]; which sets bytesArray to an array of 10 null references, any one of which could be set later: bytesArray[4] = new byte[17]; That would be the way to start, if you want a "ragged array" of arrays that aren't all the same length.
type: Answer

http://stackoverflow.com/comment/89788279
type: Comment
type: AnswerComment
has text: It worked, but add {bank.holiday} message in ValidationMessages.properties instead of messages.properties
comment on: http://stackoverflow.com/a/50822090
score: 0

http://stackoverflow.com/a/25696875
downvote count: 0
has comment: http://stackoverflow.com/comment/40165605
answers question: http://stackoverflow.com/q/25696865
has body: Just remove D1,D2 &amp; D3 and try to run run as: java -jar jarname.jar 111 222 333 run time arguments are passed to main method as a String array as mentioned here: public static void main(String commandLineArgs[]) You can fetch the passed arguments using commandLineArgs with appropriate index. So in your case: String D1 = commandLineArgs[0]; String D2 = commandLineArgs[1]; String D3 = commandLineArgs[2];
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/40165427
has comment: http://stackoverflow.com/comment/40165556
type: Answer
has comment: http://stackoverflow.com/comment/40165612

http://stackoverflow.com/a/25639405
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40060451
has body: Spring is not using your app instance it is creating its own. Note you pass spring the Application.class, it has no knowledge of your app instance. If you change your private MessageService messageService instance member to static you should get what you want.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25639160
accepted answer of: http://stackoverflow.com/q/25639160
score: 2

http://stackoverflow.com/comment/40087020
type: QuestionComment
has text: And is there anything wrong with my way of doing it?
comment on: http://stackoverflow.com/q/25653910
score: 0
type: Comment

http://stackoverflow.com/a/25798011
score: 0
has body: Reading the docs I found that I can use an empty transition to the second transition parameter to prevent the additional transition from playing. this.enterState(SPLASH, new FadeInTransition(Color.black), new EmptyTransition());
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25579834
answers question: http://stackoverflow.com/q/25579834
type: Answer

http://stackoverflow.com/q/25619281
answer count: 1
has comment: http://stackoverflow.com/comment/40024647
tagged with: file
has answer: http://stackoverflow.com/a/25619433
type: Question
has body: I have written a simple java code on Notepad public class Hello { public static void main(String[] args) { System.out.println("Hello"); } } I have compiled this using CMD and convert it into class file. I opened MATLAB command window and opened edit classpath.txt and put the complete path of Hello.class file and restarted MATLAB. I just want to know that now how will I execute this simple java program through MATLAB? am I doing write or wrong? Thanks in advance!!!
type: UnansweredQuestion
tagged with: matlab
tagged with: class
score: 0
has title: How to execute a simple Java Program through MATLAB?
tagged with: java

http://stackoverflow.com/comment/39938921
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25572740
has text: I'll have a look at lambdas now, I'm very new to programming. I'm using Java 7

http://stackoverflow.com/a/25660919
upvote count: 5
has comment: http://stackoverflow.com/comment/40269736
type: Answer
answers question: http://stackoverflow.com/q/25652892
accepted answer of: http://stackoverflow.com/q/25652892
type: AcceptedAnswer
downvote count: 0
score: 5
has body: Make your Table to be the only child of its parent and create a column with following: import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.jface.layout.TableColumnLayout; public class ColumnHelper { public static void createColumn(Table table) { TableColumnLayout layout = new TableColumnLayout(); table.getParent().setLayout(layout); TableColumn column = new TableColumn (table, SWT.NONE); layout.setColumnData(column, new ColumnWeightData(10)); } } If you experience a strange, growing resize behaviour of table, replace TableColumnLayout with: /** Forces table never to take more space than parent has*/ public class TableColumnLayout extends org.eclipse.jface.layout.TableColumnLayout { @Override protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { return new Point(wHint, hHint); } }

http://stackoverflow.com/comment/40154838
has text: While its generally a good idea to look at the source; you missed that ClassLoader is an abstract class and the method isn't final. Implementations may overwrite it (e.g. URLClassLoader) for various reasons.
comment on: http://stackoverflow.com/a/25690612
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/25609815
tagged with: graph
has answer: http://stackoverflow.com/a/39344179
tagged with: out-of-memory
type: UnansweredQuestion
tagged with: heap-dump
has body: I wanna analyze a complex data structure that is raising an OutOfMemory error in a java environment. I already used the MemoryAnalyzer application (http://www.eclipse.org/mat/) but since the data structure is complex, it's hard to understand the dominatior tree. I believe that if I create a visual representation of the heap as a graph (with nodes and vertices) it will be easier to analyze. Does anyone know any tool to generate a graph image from a java heap dump (hprof file)? thanks in advance.
has title: How to generate a graph image from java heap dump
score: 1
tagged with: java
downvote count: 0
answer count: 1
upvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/q/25585586
upvote count: 4
downvote count: 0
answer count: 1
score: 4
accepted answer: http://stackoverflow.com/a/25585613
has body: I need to extract only the first match of the following: Input (please ignore any possibility to treat it as XML, using XPath, etc. - it's just an example): NYC - New York PAR - Paris NYC - New York MIA - Miami RegEx: (?si).*?(?:NYC\s-\s)([^<]*) As you can see, I already made it lazy, however both New York are being captured. If I leave it greedy, only the last one is being captured. I need to limit, via regular expression (not via find method), to capture only the first one (in fact, the best would be to control which one I want, like the 8th occurrence). I'm afraid it will make the regular expression very messy. Any help? Thanks!
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25585613
type: AnsweredQuestion
tagged with: java
has title: Java RegEx to extract nth group
tagged with: regex

http://stackoverflow.com/comment/39976171
type: Comment
comment on: http://stackoverflow.com/a/25593158
has text: The default clone method will not do a deep copy, which means that they will share menu items.
type: AnswerComment
score: 0

http://stackoverflow.com/a/25645120
answers question: http://stackoverflow.com/q/25644837
downvote count: 0
upvote count: 1
has body: it uses the Manifest.mf inside, if you open the war, you would understand how it runs The Main class uses winstone http://winstone.sourceforge.net/ I would recommend to use glassfish, jetty or tomcat - for better control on configuration there is a bug open for that https://issues.jenkins-ci.org/browse/JENKINS-18366 Also see various container notes https://wiki.jenkins-ci.org/display/JENKINS/Containers
score: 1
type: Answer

http://stackoverflow.com/a/25643503
has body: If you look at the Consumer&lt;T&gt; interface, the accept method (which is what your method reference would effectively be using) isn't declared to throw any checked exceptions - therefore you can't use a method reference which is declared to throw a checked exception. The enhanced for loop is okay, because there you're always in a context where SomeException can be thrown. You could potentially create a wrapper which converts the checked exception to an unchecked exception, and throw that. Alternatively, you could declare your own functional interface with an accept() method which does throw a checked exception (probably parameterizing the interface with that exception), and then write your own forEach method that takes that functional interface as an input.
has comment: http://stackoverflow.com/comment/69723668
has comment: http://stackoverflow.com/comment/106938128
upvote count: 95
answers question: http://stackoverflow.com/q/25643348
has comment: http://stackoverflow.com/comment/106943947
accepted answer of: http://stackoverflow.com/q/25643348
has comment: http://stackoverflow.com/comment/69726315
score: 95
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/69726587

http://stackoverflow.com/comment/40103641
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25663165
has text: Thanks for your suggestion, but with `Font.canDisplay...` i cannot find out **which** font is used.
type: QuestionComment

http://stackoverflow.com/comment/40112720
type: QuestionComment
comment on: http://stackoverflow.com/q/25668345
score: 6
has text: The expression `new Thread()` resolves to a reference to a new `Thread` object. Store that in a variable and you'll have access to it later on.
type: Comment

http://stackoverflow.com/q/25685387
tagged with: selenium
tagged with: selenium-webdriver
score: 0
linked to: http://stackoverflow.com/q/25718133
has answer: http://stackoverflow.com/a/25694209
tagged with: java
has comment: http://stackoverflow.com/comment/40144311
has title: selenium webdriver behavior:does it hangs or something?
has body: I am writing selenium web driver automation test cases. sometimes i see this weird behavior in selenium. I run my tests(TESTNG) and it run successfully and i again run the same code nothing happens. Again the same problem came to me with the following code I am just writing one method here @BeforeTest public void method(){ driver.get("http://site.staging.snapdeal.com:7003/product/intex-aqua-n2-white/737345766"); driver.manage().window().maximize(); window = driver.getWindowHandle(); driver.switchTo().frame("loginIframe"); driver.findElement(By.id("close-pop")).click(); driver.switchTo().window(window); wait.until(ExpectedConditions.presenceOfElementLocated(By.id("BuyButton-2"))); productName=driver.findElement(By.xpath(".//div[@class='productTitle']//h1")).getText(); System.out.println("Product Name : "+productName); driver.findElement(By.id("BuyButton-2")).click(); wait.until(ExpectedConditions.presenceOfElementLocated(By.className("cart-scroll"))); System.out.println("button clicked"); } once this code will run fine and just on another run my program gets lost in some other world neither does it throws any exception nor times out.. just the browser comes to an idle state after the 4th last line driver.findElement(By.id("BuyButton-2")).click(); this button gets clicked the required action (opening of cart) occurs and then the browser is still. i do not see the "button clicked" output on my console I do have the driver.quit(); call in my @Aftertest method. but neither the driver quits nor does it throws any exception and nothing on the console either. is something wrong with my code?
tagged with: testng
type: Question
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25737290

http://stackoverflow.com/a/25591484
has body: He's using the int representation of colors. Each color is represented by 4 values of 8 bits each: Red value Green value Blue value Alpha value The int representation packs those 8-bit values into a single 32-bit int number so that the alpha value gets the highest bits, then the red value, then the green and finally, the blue value gets the lowest bits. Therefore, using bit-wise operations, you can create the int value out of the color component values as follows: public static int getColorIntRepresentationOutOfColorComponentByteValues(byte alpha, byte red, byte green, byte blue) { return ((int)alpha &lt;&lt; 24) | ((int)red &lt;&lt; 16) | ((int)green &lt;&lt; 8) | (int)blue; }
downvote count: 0
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25591295
has comment: http://stackoverflow.com/comment/39973524
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25591295

http://stackoverflow.com/comment/39970640
type: AnswerComment
comment on: http://stackoverflow.com/a/25590117
has text: @practice2perfect done. I missed that most important detail in my copy/paste. Thanks for pointing it out.
type: Comment
score: 0

http://stackoverflow.com/a/25570774
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25570213
has comment: http://stackoverflow.com/comment/40053751
has comment: http://stackoverflow.com/comment/39978548
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39959866
has body: Yes it does not necessarily read all. Like RandomAccessFile.read(byte[]) as opposed to RandomAccessFile.readFully(byte[]). Furthermore the code actually physically reads 0 bytes. It probably reads only the first block, if it were a slow device like a file system. The principle: The file is being read by the underlying system software, normally buffered, so you have a couple of blocks already in memory, and sometimes already reading further. The software reads asynchrone blocks, and blocks if trying to read more than the system has already read. So in general one has in the software a read loop of a block, and regularly at a read the read operation blocks till the physical read sufficiently buffers. To hope for a non-blocking you would need to do: InputStream is = res.openRawResource(resourceId); ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (;;) { // Read bytes until no longer available: for (;;) { int n = is.available(); if (n == 0) { break; } byte[] part = new byte[n]; int nread = is.read(part); assert nread == n; baos.write(part, 0, nread); } // Still a probably blocking read: byte[] part = new byte[128]; int nread = is.read(part); if (nread &lt;= 0) { break; // End of file } baos.write(part, 0, nread); } return baos.toByteArray(); Now, before you copy that code, simply do a blocking read loop immediately. I cannot see an advantage of using available() unless you can do something with partial data while reading the rest.
has comment: http://stackoverflow.com/comment/39961485

http://stackoverflow.com/comment/40068081
type: Comment
type: AnswerComment
score: 0
has text: I tried enabling debug logs, ffdc incident is written when the exception thrown, except for the stack trace i could not find no much information with respect to it.
comment on: http://stackoverflow.com/a/25640197

http://stackoverflow.com/q/25585873
has answer: http://stackoverflow.com/a/25585892
type: UnansweredQuestion
score: -2
answer count: 4
tagged with: arraylist
has title: 2 elements have the same index?
has answer: http://stackoverflow.com/a/25585891
has body: import java.util.ArrayList; public class TSTER { public static void main(String[] args) { ArrayList&lt;Integer&gt; test = new ArrayList&lt;Integer&gt;(7); test.add(1); test.add(1); test.add(1); test.add(1); test.add(1); test.add(1); test.add(1); for(int d:test) { System.out.println(d); int x = test.indexOf(d); System.out.println(x); } System.out.println(test.size()); } } The output is 10 and so on. The size i 7 but it seems like every time I print the index its 0
tagged with: java
downvote count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/25585900
has answer: http://stackoverflow.com/a/25585893
favorite count: 0
type: Question

http://stackoverflow.com/a/25684416
has body: You're not outputting data from the array in the following code: public void printOnScreen() { for(Employee e : emp) { e = new Employee(); // &lt;&lt;&lt; THIS IS WRONG, AS e IS ALREADY SET BY LOOP!! out.println("Name:\t" + e.getName() + "\t\tAge:\t" + e.getAge() + "\n"); } } This code creates a new e on every iteration of the loop => you're not outputting the entry from the array, but the freshly created one. The code should read public void printOnScreen() { for(Employee e : emp) { out.println("Name:\t" + e.getName() + "\t\tAge:\t" + e.getAge() + "\n"); } } Also, the following code doesn't make sense: public Operation(Employee[] emp,int n){ this.emp=emp; for(Employee e: this.emp) e = new Employee(); } Why do you iterate over all the employees in this.emp to create new instances of Employee that are stored nowhere? Also, the n parameter is not used. This code should read: public Operation(Employee[] emp) { this.emp=emp; }
type: Answer
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25684334
has comment: http://stackoverflow.com/comment/40141628
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40141783
answers question: http://stackoverflow.com/q/25684334

http://stackoverflow.com/comment/40183638
has text: Can you please show us your main method?
comment on: http://stackoverflow.com/q/25707035
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25708173
has comment: http://stackoverflow.com/comment/40185547
upvote count: 1
has answer: http://stackoverflow.com/a/25708417
has title: how to add user input into a vector and how to search that data
type: AnsweredQuestion
downvote count: 1
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40185524
linked to: http://stackoverflow.com/q/1386275
has body: i am new to java. i want to add user input into a vector and i want to search them .... Scanner input = new Scanner(System.in); String Name; String Address; Name = input.nextLine(); Address = input.nextLine(); how to put those 2 input into a vector and those Name and Address must work like a pair i mean if i store Name = john and Address = Canada(whatever) ... if i search John it will show ... John from Canada. sumthing like this. and if i add like 50 name and address into that vector i want to search them by name ... how to do it? as i dont know how vector works plz show me how to store user input and how to search them. it will be kind if you show me the same thing in Arraylist.
linked to: http://stackoverflow.com/q/858572
has comment: http://stackoverflow.com/comment/40185636
tagged with: user-input
favorite count: 0
tagged with: search
type: Question
linked to: http://stackoverflow.com/q/4460788
has comment: http://stackoverflow.com/comment/40185808
tagged with: vector
has comment: http://stackoverflow.com/comment/40185621
accepted answer: http://stackoverflow.com/a/25708417

http://stackoverflow.com/comment/40017498
type: QuestionComment
score: 5
has text: Instead of posting this to Stackoverflow it would be way more meaningful to create a pullrequest with the patch or create a feature request in the bugtracker. We don't search for requests on the net, what is not on github as an issue does not exists as a request :) Actually I'm not sure if it makes sense to add something like that, if you start this everyone comes with different ways, same as classloading. Getters / setters are defined by the bean spec, if you're not using them there is a very high chance no framework supports your way. PS: Why PP makes problems, no idea :)
comment on: http://stackoverflow.com/q/25570850
type: Comment

http://stackoverflow.com/q/25626918
has comment: http://stackoverflow.com/comment/40037971
type: Question
has title: How do file paths work in a Dynamic Web Application in Java and Eclipse?
tagged with: path
tagged with: eclipse
has body: I am building a Dynamic web application in Eclipse. In my Login.java servlet, I want the doGet() method to perform some logic (i.e. check if the user is already logged in) and open the page login.jsp located in the webapp folder, as seen in the image. I've tried variations of request.getRequestDispatcher("/src/main/webapp/login.jsp").forward(request, response); but I keep getting 404 errors that The requested resource is not available.. How do I determine the proper path that the system wants in order to display this page?
has comment: http://stackoverflow.com/comment/40037932
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40038016
answer count: 1
accepted answer: http://stackoverflow.com/a/25627059
tagged with: jsp
has answer: http://stackoverflow.com/a/25627059

http://stackoverflow.com/comment/39898074
type: QuestionComment
score: 0
has text: you have to escape them for the regex and escape them for java, so to match a `"` you do `\\\"`
comment on: http://stackoverflow.com/q/25551364
type: Comment

http://stackoverflow.com/a/56770348
type: Answer
has comment: http://stackoverflow.com/comment/100097808
answers question: http://stackoverflow.com/q/25661519
score: 2
upvote count: 2
has body: Here is my simple solution, with 100% https://app.codility.com/demo/results/trainingQ5XMG7-8UY/ public int solution(int A, int B, int K) { while (A % K != 0) { ++A; } while (B % K != 0) { --B; } return (B - A) / K + 1; }
has comment: http://stackoverflow.com/comment/100096916
downvote count: 0

http://stackoverflow.com/comment/39922929
score: 0
type: QuestionComment
has text: What version are you using of sel & firefox?
type: Comment
comment on: http://stackoverflow.com/q/25562702

http://stackoverflow.com/q/25693966
tagged with: maven
has comment: http://stackoverflow.com/comment/40159867
has title: Maven installing hue Could not find artifact tools.jar
tagged with: hue
type: UnansweredQuestion
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25703354
type: Question
has body: I'm trying to install hue through git centos 6.5 64 error Could not find artifact jdk.tools:jdk.tools:jar:1.7 at specified path /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/../lib/tools.jar I have dime910 ~/hue# ls /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/tools.jar -rw-r--r-- 1 root root 18M Sep 5 08:39 /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/tools.jar I ran mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/lib/tools.jar Searched my system have only 2 pom.files /root/hue/desktop/libs/hadoop/java/pom.xml /root/hue/maven/pom.xml /root/hue is the directory created by git to each of the pom files - still get the error seems the .. in the error message is messing up - I can't find why... more details... dime910 ~/hue # mvn -version Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 08:51:28-0500) Maven home: /usr/local/maven Java version: 1.7.0_65, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "2.6.32-431.20.5.el6.x86_64", arch: "amd64", family: "unix" dime910 ~/hue/maven :( # echo $JAVA_HOME /usr/lib/jvm/jre-1.7.0-openjdk.x86_64 alternatives --display java Current `best' version is /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java. I think I've done my homework and I'm reaching out for help - hopefully someone sees this.

http://stackoverflow.com/comment/39970846
comment on: http://stackoverflow.com/q/25585581
has text: Since I can't post a legitimate answer, I'll answer with a comment: I believe the difference is that in the first case the whole class is declared generic whereas in the second case only the method is generic.
type: Comment
type: QuestionComment
score: 6

http://stackoverflow.com/q/25662658
tagged with: jframe
answer count: 1
tagged with: applet
tagged with: swing
has comment: http://stackoverflow.com/comment/40113584
tagged with: jtable
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40113629
tagged with: java
has body: I am trying to programmatically set table in my Applet program. I tried the following code, it works fine. But, This is opening new window and then drawing the table. Can I have sample for drawing such table in the Applet view itself JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Object rowData[][] = { { "Row1-Column1", "Row1-Column2", "Row1-Column3" }, { "Row2-Column1", "Row2-Column2", "Row2-Column3" } }; Object columnNames[] = { "Column One", "Column Two", "Column Three" }; JTable table = new JTable(rowData, columnNames); JScrollPane scrollPane = new JScrollPane(table); frame.add(scrollPane, BorderLayout.CENTER); frame.setSize(300, 150); frame.setVisible(true);
accepted answer: http://stackoverflow.com/a/25672041
type: Question
has title: Drawing table in Applet
has answer: http://stackoverflow.com/a/25672041

http://stackoverflow.com/a/25720974
score: 2
downvote count: 0
has body: Using NIO you can write to the end of the file in more efficient way public static void writeToLog(String string) { String text = getTimestamp() + " " + string; try { java.nio.file.Files.write(java.nio.file.Paths.get("/file.txt"), text.getBytes(), java.nio.file.StandardOpenOptions.APPEND); } catch (IOException ignore) { } }
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25597215

http://stackoverflow.com/q/25661853
has answer: http://stackoverflow.com/a/25662501
possible better answer: http://stackoverflow.com/a/25662501
tagged with: listview
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/40102969
type: Question
has comment: http://stackoverflow.com/comment/40101232
upvote count: 0
answer count: 2
downvote count: 2
linked to: http://stackoverflow.com/q/23623060
has comment: http://stackoverflow.com/comment/40101374
score: -2
has title: I can not perform Button click in custom listview with my custom arrayadapter
has answer: http://stackoverflow.com/a/25662101
accepted answer: http://stackoverflow.com/a/25662101
favorite count: 0
type: AnsweredQuestion
has body: I have search a lot of questions here and already implemented every answer i get from here, but no one has solved this problem. I have 2 buttons in a row of my custom listview and i want to perform on click on them. Here is my custom adapter and xml code. EDIT CartAadpter.java public class CartAdapter extends ArrayAdapter&lt;CartItemListData&gt; { Context context; int layoutResourceId; ArrayList&lt;CartItemListData&gt; data = new ArrayList&lt;CartItemListData&gt;(); LayoutInflater mInflater; CartItemListData listData; CartDatabaseHelper db; int i; public CartAdapter(Context context, ArrayList&lt;CartItemListData&gt; data) { super(context, R.layout.cart_listitems, data); mInflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.context = context; this.data = data; notifyDataSetChanged(); } @Override public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (convertView == null) { mInflater = LayoutInflater.from(context); convertView = mInflater.inflate(R.layout.cart_listitems, parent, false); holder = new ViewHolder(); holder.text = (TextView) convertView .findViewById(R.id.cart_item_id); holder.text1 = (TextView) convertView .findViewById(R.id.cart_item_boxes); holder.edit = (Button) convertView.findViewById(R.id.editdata); holder.delete = (Button) convertView.findViewById(R.id.deletedata); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } listData = data.get(position); // Button's Tag holder.edit.setTag(data.get(position).getId()); holder.delete.setTag(data.get(position).getId()); // SetText to Textview holder.text.setText(data.get(position).getTilesId()); holder.text1.setText(String.valueOf(listData.getNumberOfBox())); Log.e("Database Data ID: ", listData.getId() + " " + position); holder.edit.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { i = data.get(position).getId(); AlertDialog.Builder builder = new Ale…
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40102937

http://stackoverflow.com/comment/40109272
type: AnswerComment
has text: For the setup phase, things will be much more simple if you read the server's answers in the sending thread until it says "user name is OK". That way, you can throw an exception inside of `client.register()`. If you can't do this, then you need to add the error handler in the receiver which means you need to pass the `data` instance around.
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25664995

http://stackoverflow.com/a/25589948
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/25589821
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25589821
type: AcceptedAnswer
has body: The lone fact that r1 read a value written by w doesn't even mean that hb(w, r1), let alone hb(w, r2). It is the other way around: if there is a happens-before relationship between w and r1, then the JMM guarantees what value will be observed; otherwise there is no guarantee. If r1 does observe the value from w, that's just a coincidence and does not post hoc induce a happens-before relationship. The best way to imagine a poignant example where this matters is the use case of safe publishing through a data race. A reference to a String is written to a non-volatile field, without synchronization, and that field is then dereferenced from another thread. If the thread happens to observe the String (there is no guarantee that it will), there is a guarantee that the thread will see the String in a consistent state. Without the special provision of the extra happens-before which is considered only in the precise case described by your quote, there would be no guarantee that the String will be observed intact. what do they want to say that this hb ordersing does not "transitively close" with other hb ordersings? Normally, hb(a,b) and hb(b,c) imply hb(a,c), but this transitivity does not apply to the special happens-before existing due to field freezes. These special happens-before's have their own "namespace".
has comment: http://stackoverflow.com/comment/48324612
type: Answer

http://stackoverflow.com/a/25596487
upvote count: 2
has comment: http://stackoverflow.com/comment/40006073
has comment: http://stackoverflow.com/comment/40009282
has body: I've looked into my own code (which is working) and only one difference is that you didn't invoke addNode() method, so I suggest to invoke it: cxt.disableDefaultConstraintViolation(); cxt.buildConstraintViolationWithTemplate("{NotNull}") .addNode("desiredBookingDate") .addConstraintViolation(); But, IMHO, you are going to wrong direction: validator should be responsible only for one type of validation. To mark field as mandatory it's better to use @NotNull annotation instead. You, probably, will face up with another issue: empty string will always pass such constraint. And to fix that, in Spring, you should use StringTrimmerEditor with emptyAsNull = true parameter which turns empty string to null value before validation.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25593796
downvote count: 0

http://stackoverflow.com/comment/39987958
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25599616
has text: @user1058860 I'm just saying that's what your code does right now.
type: Comment

http://stackoverflow.com/comment/40074069
score: 0
has text: a Minimal, Complete, and Verifiable example so we can compile and run it...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25646891

database
tags question: http://stackoverflow.com/q/25639260
tags question: http://stackoverflow.com/q/25581319
tags question: http://stackoverflow.com/q/25616249
tags question: http://stackoverflow.com/q/25696060
tags question: http://stackoverflow.com/q/25618042
tags question: http://stackoverflow.com/q/25636994
tags question: http://stackoverflow.com/q/25615641
tags question: http://stackoverflow.com/q/25567932
tags question: http://stackoverflow.com/q/25689162
tags question: http://stackoverflow.com/q/25634983
tags question: http://stackoverflow.com/q/25647835
tags question: http://stackoverflow.com/q/25699316
tags question: http://stackoverflow.com/q/25663569
type: Tag
tags question: http://stackoverflow.com/q/25593391
tags question: http://stackoverflow.com/q/25672984
tags question: http://stackoverflow.com/q/25612547
tags question: http://stackoverflow.com/q/25644882
tags question: http://stackoverflow.com/q/25554512
tags question: http://stackoverflow.com/q/25593788
tags question: http://stackoverflow.com/q/25616096
tags question: http://stackoverflow.com/q/25679274
tags question: http://stackoverflow.com/q/25566301
tags question: http://stackoverflow.com/q/25601766
tags question: http://stackoverflow.com/q/25568584
tags question: http://stackoverflow.com/q/25606027
tags question: http://stackoverflow.com/q/25680329
tags question: http://stackoverflow.com/q/25705278
tags question: http://stackoverflow.com/q/25654506
tags question: http://stackoverflow.com/q/25589031
tags question: http://stackoverflow.com/q/25689757
tags question: http://stackoverflow.com/q/25664009
tag name: database

http://stackoverflow.com/a/26010277
has body: Try running it as a different user before you doing anything else. Hold down shift and right-click on your installer, then choose "Run as a different user". Enter the administrator credentials; if it is disabled you will need to enable it manually or use the net use command. After entering the credentials, proceed with the installation and see how it goes.
type: Answer
answers question: http://stackoverflow.com/q/25682851
score: 0

http://stackoverflow.com/q/25699787
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25726859
tagged with: service
type: Question
has comment: http://stackoverflow.com/comment/40235531
has body: So i have come across a problem with installing my java application to startup on all Operating Systems. Firstly I know this is possible on Windows by adding a new key to registry (I think). I believe the command: 'reg add' works on windows. I'm not 100% sure about Mac but i believe you can use a service wrapper? And for Linux I have no clue. Basically i want my application to be installed to startup when a user ticks a box, no matter which operating system it is run on. Just some clarification on these and if possible an example for each would really assist me. Any help with this is greatly appreciated. Thanks.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40170454
has title: How to programmatically install a jar file to startup on all operating systems - Java
tagged with: registry
has comment: http://stackoverflow.com/comment/40219858
has comment: http://stackoverflow.com/comment/40170595

http://stackoverflow.com/comment/39906995
comment on: http://stackoverflow.com/q/25555488
has text: @WHDeveloper No, updated the setup to refer to that, that's a good tidbit to know.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/25708734
tagged with: jtable
type: AnsweredQuestion
has title: swing JTable with ScrollBar - color of square between headers and track
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40186861
has comment: http://stackoverflow.com/comment/40187328
tagged with: jscrollbar
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40188669
has body: I have a JTable with BasicScrollBarUI, I set the headers background color: table.getTableHeader().setBackground(GuiConstants.backgroundColor); and the scrolbar background color: public class ScrollBarUI extends BasicScrollBarUI { @Override protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { c.setBackground(GuiConstants.backgroundColor); } } I still have a square between them that its color won't change. does anybody knows how to change it also to their color? thanks
upvote count: 2
downvote count: 0
tagged with: swing
accepted answer: http://stackoverflow.com/a/25712331
has answer: http://stackoverflow.com/a/25712331
score: 2

http://stackoverflow.com/comment/39990316
has text: Classes are complex data types, thats true. But your statement `primitive types, like classes, have both state and behavior` is wrong. primitives are just named memory spaces, which are used to store data of a particular type. They do not have methods, you are confusing them with their respective wrapper types, which are used to represent primitives in form of objects eg:- `Integer` for int, they are used where pure primitives cannot be used, for example in collections.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25600335
type: Comment

http://stackoverflow.com/comment/39964826
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25585937
has text: By whole computation you a random number in 1 ... 10^10?

http://stackoverflow.com/comment/39993478
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25602485
has text: @Nadeem Ok so you are adding to the end of the ArrayList, this function will only ever add an object it explicitly allows for multiple copies of the same thing. If you wnat a single copy of each item you need a Set not a List you will also need to override both equals and hashcode on your OrderItems object

http://stackoverflow.com/comment/40020166
comment on: http://stackoverflow.com/q/25617152
has text: Question is not clear too much which dependency you are looking as ur Waring message saying missing dependency for com.oracle:ojdbc14:jar:11.2.0.3 and other are you looking for these ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/78826347
comment on: http://stackoverflow.com/a/45867910
type: Comment
type: AnswerComment
has text: Oracle is case sensitive and does not upper-case everything - the default behaviour is to convert all unquoted identifiers to upper case (so it appears to be case insensitive) but you can suppress that behaviour using double quotes around the identifiers and it will respect the case sensitivity of the identifiers.
score: 0

jboss6.x
tag name: jboss6.x
tags question: http://stackoverflow.com/q/25571668
type: Tag
tags question: http://stackoverflow.com/q/25617615

http://stackoverflow.com/a/46894229
answers question: http://stackoverflow.com/q/25616528
has body: I know this is 3 years late, but for future generations, here is what worked for me: // Don't use this: // objectMapper.disable(SerializationConfig.Feature.USE_ANNOTATIONS); // Use this instead: objectMapper.setAnnotationIntrospector(AnnotationIntrospector.nopInstance()); This worked for me in 1.9.13-atlassian-1.
type: Answer
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25621915
has body: Use JAXB.unmarshal() to simply create Java objects from XML. By default it is very liberal. Quoting from the javadoc: In addition, the unmarshal methods have the following characteristic: Schema validation is not performed on the input XML. The processing will try to continue even if there are errors in the XML, as much as possible. Only as the last resort, this method fails with DataBindingException. So what JAXB.unmarshal() does is it tries to "transfer" as much data from XML to Java as possible, and it doesn't care if there is no Java field for an XML element or attribute, and it also doesn't care if there is a Java field for which there is no XML element or attribute. Example Let's try to unmarshal the following XML to an instance of java.awt.Point: <y>123</y> weor The Java code: String s = " <y>123</y> weor "; Point p = JAXB.unmarshal(new StringReader(s), Point.class); System.out.println(p); // Prints "java.awt.Point[x=0,y=123]" We told JAXB.unmarshal() to parse a java.awt.Point instance. The input XML contains an element <y> which can be matched with Point.y so an int was parsed and set to Point.y. No XML data was found for Point.x so it was not touched. There were no match for the attribute hi and the XML element , so they were simply not used for anything. We got absolutely no Exception here, and the most that was possible was parsed and transferred from XML to Java.
type: Answer
upvote count: 22
score: 22
has comment: http://stackoverflow.com/comment/69472115
downvote count: 0
answers question: http://stackoverflow.com/q/25621655

http://stackoverflow.com/a/25614428
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25614256
has body: its not showing the step by step process, how can I show that? I would use a combination of Arrays.toString(int[]) and formatted output with printf(String, Object...). Something like, public static void main(String[] args) { int[] data = { 20, 5, 9, 8, 7 }; System.out.println("Before sort: " + Arrays.toString(data)); sort(data); System.out.println("After sort: " + Arrays.toString(data)); } public static void sort(int[] data) { int i; for (int j = 1, r = data.length; j &lt; r; j++) { int temp = data[j]; System.out.printf("Sorting %d from pos=%d%n", temp, j); for (i = j - 1; i &gt;= 0 &amp;&amp; temp &lt; data[i]; i--) { data[i + 1] = data[i]; System.out.printf("%d is less then %d, shifting up%n", tehmp, data[i]); } System.out.printf("%d moved from pos=%d to pos=%d%n", temp, j, i + 1); data[i + 1] = temp; System.out.printf("After iteration %d: %s%n", j, Arrays.toString(data)); } }
type: Answer

http://stackoverflow.com/a/25553369
has body: On Android, for long running timer tasks you are better off using the AlarmManager.Otherwise if your app is not in the foreground it may be 'killed' by the system.
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25553197
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25625998
has body: The problem is that FastRandomForest is not assignable to Classifier. You could create an adapter to make the FastRandomForest act like a Classifier. public class FastRandomForestAdapter : Classifier { private FastRandomForest frf; public FastRandomForestAdpter(FastRandomForest frf) { this.frf = frf; } @override public void MethodA() { frf.Method1(); } @override public ReturnType MethodB(object arg) { return frf.Method2(Transform(arg)); } private Transform(object a) { ... } }
upvote count: 5
type: Answer
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/25625508

http://stackoverflow.com/comment/39923442
comment on: http://stackoverflow.com/a/25564464
type: AnswerComment
has text: Making a new Admin() but not persisting it... I thought I was persisting it when I persist the User because of the cascade all strategy? I tried changing the main method to the above (editted the question) and I get the same exceptions. I'd prefer not to do this if I can though because I want it to automatically generate an ID. Also tried changing persist() to merge() and again, same exceptions. I think merge() is better because there will be times when I persist a User that the Role already exists.
score: 0
type: Comment

http://stackoverflow.com/a/25593270
has body: public static Map&lt;Integer,Integer&gt; bijectiveMap(int n) { List&lt;Integer&gt; values = new ArrayList&lt;&gt;(n); for (int i=0 ; i&lt;n ; i++) values.add(i); Collections.shuffle(values); Map&lt;Integer,Integer&gt; result = new HashMap&lt;&gt;(); for (int i=0 ; i&lt;n ; i++) result.put(i,values.get(i)); return result; } Output for n=10 : {0=7, 1=5, 2=3, 3=6, 4=1, 5=4, 6=2, 7=8, 8=9, 9=0}
accepted answer of: http://stackoverflow.com/q/25593219
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25593219
score: 2
type: Answer

http://stackoverflow.com/a/25588390
type: Answer
has body: Random.nextInt() needs a number that is positive, and in this for loop you are calling it with 0: for (int i = 0; i &lt;65536; i++){ test.pixels[i] = random.nextInt(i); // it will call random.nextInt(0) }
score: 0
answers question: http://stackoverflow.com/q/25588151

http://stackoverflow.com/comment/58968251
type: QuestionComment
has text: https://github.com/rrtigga/GetDisciplined
comment on: http://stackoverflow.com/q/25562899
score: 0
type: Comment

http://stackoverflow.com/q/25704291
favorite count: 0
type: Question
downvote count: 2
tagged with: android
tagged with: arrays
score: -2
has comment: http://stackoverflow.com/comment/40179424
answer count: 1
has body: I'm fairly new to android so please forgive my ignorance or incompetence. I am creating an app of sayings (quotes) that are stored in an array and displayed via a TextView using .setText. I currently have it working to select and display a random saying and play its corresponding audio. I'm now looking to use a "Next" and "Back" button to cycle through the array of sayings but have been struggling to do it for a while. I would imagine i need to find the index value of the currently displayed saying and increment or decrement it by one? Any help would be great. Thanks. This is what i have so far: public class Sayings extends Activity implements OnClickListener { HashMap&lt;String, Integer&gt; sayingsResIds = new HashMap&lt;String, Integer&gt;(); MediaPlayer mp; String[] sayings = {"Saying1", "Saying2", "Saying3", "Saying4", "Saying5"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sayings); Animation anim; anim = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_in); TextView sayingsTextView = (TextView) findViewById(R.id.displaySayings); sayingsTextView.startAnimation(anim); Button btnRandom = (Button) findViewById(R.id.random_button); Button btnNext = (Button) findViewById(R.id.next_button); Button btnBack = (Button) findViewById(R.id.back_button); btnRandom.setOnClickListener(this); btnNext.setOnClickListener(this); btnBack.setOnClickListener(this); sayingsResIds.put("Saying1",R.raw.saying1); sayingsResIds.put("Saying2",R.raw.saying2); sayingsResIds.put("Saying3",R.raw.saying3); sayingsResIds.put("Saying4",R.raw.saying4); sayingsResIds.put("Saying5",R.raw.saying5); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.sayings, menu); return true; } @Override public void onClick(View v) { Animation anim; TextView sayingsTextView = (TextView) findViewById(…
has comment: http://stackoverflow.com/comment/40179490
has answer: http://stackoverflow.com/a/25704581
accepted answer: http://stackoverflow.com/a/25704581
type: AnsweredQuestion
upvote count: 0
has title: Cycle through an array using buttons
tagged with: java
tagged with: button
has comment: http://stackoverflow.com/comment/40180276
has comment: http://stackoverflow.com/comment/40178813

http://stackoverflow.com/comment/40181969
score: 0
has text: what's the output that gets logged to the console? does your run() ever get entered?
type: QuestionComment
comment on: http://stackoverflow.com/q/25706044
type: Comment

http://stackoverflow.com/comment/40354667
type: AnswerComment
score: 1
has text: I changed the method I used for testing, I seem to be wrong, as I accidentally limited the result size to 200 before doing the final operation (forEach(System.out::println) on the resulting stream. Actually, Files.lines(Path) reads the given file as a sequential stream. Moreover, most of the time was actually spent reading the file and not on computations, plus I ran into some GC problems. I timed Files.lines(Path).toArray() vs a method using a MappedByteBuffer(readonly, 0, file.size). The results were actually the quite same, MappedByteBuffer a bit slower here and there.
type: Comment
comment on: http://stackoverflow.com/a/25712518

http://stackoverflow.com/comment/40095355
type: Comment
comment on: http://stackoverflow.com/a/25640526
type: AnswerComment
has text: OMG. I changed the "mysql-connector-java" version from 5.1.9 to 5.1.32, everything is ok now! Thank you so much!!
score: 1

http://stackoverflow.com/q/25694316
has comment: http://stackoverflow.com/comment/40160976
accepted answer: http://stackoverflow.com/a/25697451
tagged with: android
has answer: http://stackoverflow.com/a/25697451
has title: How to create a task that runs in the background in Android
score: -1
has body: I recently got into Android development and I'm currently working on an App that will alert the user if his/her game server goes down whether he/she has the app opened or not. To do this, I would need to have the app running the background with a task that would ping the server every x seconds/minutes/etc. How can I create a task that runs in the background until the user shuts off their phone?
possible better answer: http://stackoverflow.com/a/25694353
has answer: http://stackoverflow.com/a/25694353
type: AnsweredQuestion
answer count: 2
upvote count: 0
tagged with: java
downvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/40130880
has text: You need to learn how to pass parameters to a query (and avoid security problems). I've provided a [link](http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html) to such tutorial.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25677856

http://stackoverflow.com/q/25626743
type: Question
tagged with: xpath
has comment: http://stackoverflow.com/comment/40067917
tagged with: htmlunit
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40067898
has title: Why does my XPath not return anything?
score: 0
has body: I am trying to get an XPath of a number input text box as well as a submit button from the page http://vacancycollection.nic.in/cglmarks/. I created the XPath using Firebug's Copy XPath option. Here is my XPath for input text field: HtmlTextInput rollNum = (HtmlTextInput)index.getFirstByXPath("/html/body/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td[1]/table/tbody/tr/td/table/tbody/tr[2]/td/input"); The XPath for the button is: HtmlButton button = index.getFirstByXPath("/html/body/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td[1]/table/tbody/tr/td/table/tbody/tr[5]/td/button"); But when I try to access the text as well as the button field, it throws a java.lang.NullPointerException exception when I try to look at the code with System.out.println(rollNum.toString());. I am using HTMLUnit with Java to insert data into the input fields and click the submit button. It feels like there is some error in the XPaths themselves. What should be the correct XPaths for the elements and how to find them?
tagged with: java
has answer: http://stackoverflow.com/a/25647785
answer count: 1

http://stackoverflow.com/a/25671920
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25671859
type: Answer
has body: You should perform the search in a background thread, and notify the UI using for example invokeLater. You can find more informations and an example here http://www.javamex.com/tutorials/threads/invokelater.shtml

http://stackoverflow.com/comment/40211011
has text: its because your eclipse project was not created as a "Maven project".you can go a create a new Project in Eclipse: File -> New -> Other. then select in the Wizard "Maven Project". in then configure your maven as Webapp archetype. is it ok ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25719346
type: Comment

http://stackoverflow.com/a/25666751
has body: This sounds very trivial and I'm sure I'm missing something very simple, but I can't get it to work. Yes, an here is your mistake: @Root(strict = false) public class SecurityGroup { // ... } This will use SecurityGroup - the name of the class - as element name. Therefor the element is named &lt;SecurityGroup&gt;...&lt;/SecurityGroup&gt;. But your XML contains it as lower case: &lt;securitygroup&gt;...&lt;/securitygroup&gt;. Both don't match and simple throws an Exception to indicate that. Solution: You can set a custom name with annotation-argument: @Root(name = "securitygroup",strict = false) public class SecurityGroup { // ... } Now the correct name is used and the code should work.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25660361

http://stackoverflow.com/q/25632417
has answer: http://stackoverflow.com/a/25632506
has comment: http://stackoverflow.com/comment/40048593
type: AnsweredQuestion
score: 3
answer count: 3
has answer: http://stackoverflow.com/a/25633218
has comment: http://stackoverflow.com/comment/40048436
upvote count: 3
tagged with: java
downvote count: 0
possible better answer: http://stackoverflow.com/a/25632480
accepted answer: http://stackoverflow.com/a/25632506
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40048409
has comment: http://stackoverflow.com/comment/40048532
has body: Is it possible to duplicate a line or multiple lines of code in order to shorten the code a bit? I'm a bit new at Java so I'm attempting to learn how to make myself efficient. So, for a quick example, I would like to 'duplicate' this line of code to be able to be used in multiple if statements. Just by referencing say, a smaller line of code. Without having to copy paste, etc. System.out.println("Long paragraph here"); I'm not entirely even sure if this is possible without creating a new file to be referenced. Would this be able to be done easily? Thanks for helping out a newbie. I couldn't find anything in the search because I'm not sure what the term for this would be.
has comment: http://stackoverflow.com/comment/40048461
has title: 'Duplicating' code so it can be used multiple times in Java
has answer: http://stackoverflow.com/a/25632480

netbeans-plugins
tags question: http://stackoverflow.com/q/25555711
type: Tag
tags question: http://stackoverflow.com/q/25611609
tag name: netbeans-plugins
tags question: http://stackoverflow.com/q/25569604

google-play-games
tags question: http://stackoverflow.com/q/25585023
type: Tag
tag name: google-play-games

http://stackoverflow.com/a/25587356
answers question: http://stackoverflow.com/q/25587341
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
has body: It's a reserved keyword, see section 3.9 of the Java Language Specification.
accepted answer of: http://stackoverflow.com/q/25587341
score: 2

http://stackoverflow.com/q/25594207
type: Question
linked to: http://stackoverflow.com/q/23715057
answer count: 0
upvote count: 1
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/24873504
has body: I have a problem with JAVA GUI (I'm using eclipse) , the texts are not complete in the dialog window . look at the picture
has comment: http://stackoverflow.com/comment/39987782
tagged with: swing
has comment: http://stackoverflow.com/comment/39979556
has title: Why is javax.swing.JOptionPane display messed up?
has comment: http://stackoverflow.com/comment/39978088
favorite count: 0
has comment: http://stackoverflow.com/comment/39979638
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39978180

http://stackoverflow.com/a/25566930
type: Answer
has body: If you change your stars method signature as below, you should be able to work it out public static void stars(int size, int beg, int end, char symbol)
score: 0
has comment: http://stackoverflow.com/comment/39931795
answers question: http://stackoverflow.com/q/25566410
has comment: http://stackoverflow.com/comment/39927131
has comment: http://stackoverflow.com/comment/39927339
has comment: http://stackoverflow.com/comment/39931405
has comment: http://stackoverflow.com/comment/39928237
has comment: http://stackoverflow.com/comment/39928276

http://stackoverflow.com/q/25652405
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25653879
has comment: http://stackoverflow.com/comment/40085351
type: Question
has comment: http://stackoverflow.com/comment/40086758
has body: I am having problems with the components alignment added to JPanel. I am working on a chat application. Which layout should be used be used to get the intended aim. I tried all the layouts but I didn't get the wants. Mostly problems occur when window is resized. Moreover get the idea from the included image about what I want to be achieved. Thanks in advance. enter image description here
has comment: http://stackoverflow.com/comment/40084423
upvote count: 2
tagged with: layout
type: UnansweredQuestion
downvote count: 0
tagged with: alignment
tagged with: swing
favorite count: 0
has title: Adding components one after another to JPanel horizontally
score: 2

http://stackoverflow.com/q/25556312
has body: I am attempting to use createFile with a FileAttribute derived from "rw-rw-rw-". My file is being created as "rw-rw-r--" on Fedora. How can I set OTHERS_WRITE when creating a file? Example: (-&gt;&gt; "rw-rw-rw-" PosixFilePermissions/fromString PosixFilePermissions/asFileAttribute vector into-array (Files/createFile (Paths/get "temp" (into-array String [])))) ;;; temp is created as rw-rw-r--
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/6233541
has title: How can I set OTHERS_WRITE when creating a file?
score: 4
tagged with: clojure
tagged with: java.nio.file
upvote count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25557947
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25557947
downvote count: 0

http://stackoverflow.com/q/25691464
has comment: http://stackoverflow.com/comment/40155063
tagged with: java
accepted answer: http://stackoverflow.com/a/25698962
linked to: http://stackoverflow.com/q/19551984
score: 1
has answer: http://stackoverflow.com/a/25698962
type: Question
has body: I was explaining to a colleague the way of getting list data from a JSP page to back to the action class by using indices as explained here and here. He didn't quite understand and fumbled a bit on his own until he suddenly he made it work by not using indices at all! In his JSP page he had: &lt;input type="checkbox" name="contactNameList" value="someValue1"&gt; &lt;input type="checkbox" name="contactNameList" value="someValue2"&gt; &lt;input type="checkbox" name="contactNameList" value="someValue3"&gt; &lt;input type="checkbox" name="contactNameList" value="someValue4"&gt; In his action class he had the 'appropiate' setters: public List&lt;String&gt; getContactNameList() public void setContactNameList(List&lt;String&gt; list) I'm baffled as to why this work. I think this works because he is sending non-bean data (in this case strings) and there is an intelligence build into Struts2/OGNL to append values to lists rather than overwrite them. Can anybody explain with great detail what is going behind the hood in this "no indices" case? How is the list of strings instantiated and populated with the snippets above?
answer count: 2
tagged with: ognl
has title: Struts2 sending list data from JSP to Action class: alternative way
downvote count: 0
tagged with: jsp
upvote count: 1
linked to: http://stackoverflow.com/q/19045068
possible better answer: http://stackoverflow.com/a/25696723
has comment: http://stackoverflow.com/comment/40161211
favorite count: 0
tagged with: struts2
tagged with: type-conversion
has answer: http://stackoverflow.com/a/25696723
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40155494
has comment: http://stackoverflow.com/comment/40155594

http://stackoverflow.com/comment/40032902
type: Comment
has text: Is it? I thought it's because of the formatting causing my chart does not work properly.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25624186

http://stackoverflow.com/a/25562369
has body: $ javac whose/MyClassLoader.java whose/MyClassLoader.java:5: error: cannot reference this before supertype constructor has been called super(getClass().getClassLoader()); ^ 1 error I know it's late in the day.
type: Answer
has comment: http://stackoverflow.com/comment/39919322
has comment: http://stackoverflow.com/comment/39919031
downvote count: 0
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25561873
has comment: http://stackoverflow.com/comment/39919967

http://stackoverflow.com/q/25618859
tagged with: http-request
type: Question
has comment: http://stackoverflow.com/comment/40023415
has comment: http://stackoverflow.com/comment/40023297
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40023277
score: 0
answer count: 0
tagged with: http-post
has comment: http://stackoverflow.com/comment/40023064
has comment: http://stackoverflow.com/comment/40023190
has comment: http://stackoverflow.com/comment/40023191
has title: Java HTTP Request
has body: I' m trying to setup an httprequest using java. Let's say i want to have something like this: POST /TEST/PATH HTTP/1.1 [...] I want to get the /TEST/PATH behind "POST". I didn't find any setter to define that. When I execute the request, the request sending looks like this: POST / HTTP/1.1 [...] My Code looks like this: SOAPServerAddress = "http://example.com/TEST/PATH"; // setup HTTP POST HttpClient httpClient = HttpClients.custom().build(); HttpPost httpPost = new HttpPost(SOAPServerAddress); // execute http request HttpResponse response = httpClient.execute(httpPost);
has comment: http://stackoverflow.com/comment/40023149

http://stackoverflow.com/comment/40167587
has text: could you elaborate on your definition of recursion?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25698133

http://stackoverflow.com/comment/40185471
type: QuestionComment
score: 1
has text: @MichaelShrestha : Your question is ambiguous. As mentioned, *ALL* Android devices "support" Unicode as the `String` class is backed by an array of characters in UTF-16 format. Whether or not a device has the relevant character set able to display characters you need is another question. There are various other complications depending on how you are creating or obtain strings of text and how they're encoded. Look at the Android `Locale` class http://developer.android.com/reference/java/util/Locale.html and you'll see a method `getAvailableLocales()` maybe that's what you need.
comment on: http://stackoverflow.com/q/25707956
type: Comment

http://stackoverflow.com/q/25702593
tagged with: alt
answer count: 1
has title: ALT-Codes in Java
type: Question
has comment: http://stackoverflow.com/comment/40175625
has answer: http://stackoverflow.com/a/25703453
linked to: http://stackoverflow.com/q/10764920
tagged with: jcreator
has comment: http://stackoverflow.com/comment/40175554
has comment: http://stackoverflow.com/comment/40175522
type: AnsweredQuestion
score: 0
has body: Im making a small game which uses the print function for the GUI,With an ascii-like style. The problem is that some of the ALT-Codes such as ▲ come up in the program as a ? or as something else, Is there a possible fix to this? or which alt-codes can be used? Im using JCreator
has comment: http://stackoverflow.com/comment/40175685
accepted answer: http://stackoverflow.com/a/25703453
tagged with: java

http://stackoverflow.com/comment/40061638
has text: Still not solved with RETURNING, currently I'm using currval(serial) query after the INSERT query.
score: 0
comment on: http://stackoverflow.com/q/25592047
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40082280
type: Comment
type: QuestionComment
score: 0
has text: They are also examples. the range should be from 1-500
comment on: http://stackoverflow.com/q/25651092

http://stackoverflow.com/a/25679217
type: Answer
score: 0
has body: It seems like in this implementation, you can test the value of i? Something like if (i==NUM_DIGITS) carryFlag = false; ?
answers question: http://stackoverflow.com/q/25679188

http://stackoverflow.com/comment/40171110
score: 0
comment on: http://stackoverflow.com/q/25694602
type: QuestionComment
type: Comment
has text: what about the output images with "lining"?

http://stackoverflow.com/q/25704941
has body: Looking for verification on the following: In the implemented/overridden method, Java concerns itself ONLY with the checked exceptions declared to be thrown. Eg.: To the interface: interface INT { void mm() throws IOException, ArrayIndexOutOfBoundsException; } , class Some implements INT { void mm() {...} // ... } doesn't give a checked error. Neither does the following (since NullPointerException is a RunimeException): class Some implements INT { void mm() throws NullPointerException {...} // ... } while class Some implements INT { void mm() throws ActivationException {...} // ... } gives a compiler error since ActivationException is a checked exception and its super-class implementation isn't throwing it (or a sub-class of it). Note here: class Some implements INT { void mm() throws IndexOutOfBoundsException {...} // ... } doesn't give a compile-time error although IndexOutOfBoundsException is super to ArrayIndexOutOfBoundsException since they are runtime exceptions. Also note: class Some implements INT { void mm() throws Exception {...} // ... } gives a checked error since Exception can also be a checked exception and is super to those in the overridden one. In the overall, an exception declared to be thrown in the overriding method gets a compiler error ONLY IF it is a checked exception and it isn't (or a super-type of it isn't) thrown in the overridden method of its super class. This is exception handling in the implemented method more elaborate and extensive. Asking it again-- couldn't get an answer there to its narrower version. TIA.
linked to: http://stackoverflow.com/q/10913050
linked to: http://stackoverflow.com/q/25671800
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40180399
has comment: http://stackoverflow.com/comment/40180511
has comment: http://stackoverflow.com/comment/40180214
duplicate of: http://stackoverflow.com/q/25671800
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40180335
linked to: http://stackoverflow.com/q/5875414
has comment: http://stackoverflow.com/comment/40180381
tagged with: exception
has title: Java -- thrown exceptions in implemented/overridden methods
has comment: http://stackoverflow.com/comment/40180299
tagged with: java
tagged with: overriding
has comment: http://stackoverflow.com/comment/40180247
has comment: http://stackoverflow.com/comment/40180485

http://stackoverflow.com/comment/40051148
comment on: http://stackoverflow.com/q/25572667
type: Comment
score: 0
has text: Do some googling on 'persistent connections' if you're trying to keep it open, otherwise by default I believe the connection should be closed once all data has been transmitted by the server. For creating a persistent connection see http://stackoverflow.com/questions/3304006/persistent-httpurlconnection-in-java
type: QuestionComment

http://stackoverflow.com/q/25637241
score: 0
tagged with: weblogic
has answer: http://stackoverflow.com/a/26039185
tagged with: java
tagged with: jpos
has body: Hello I'm having hard time trying to configure jPOS to run in weblogic. jPOS version 1.9.8 weblogic 10.3.6.0 I got this error: 14:01:12 [[ACTIVE] ExecuteThread: '19' for queue: 'weblogic.kernel.Default (self-tuning)'] (T0100.java:31) org.jpos.iso.ISOException: java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory (java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory) at org.jpos.iso.packager.GenericPackager.readFile(GenericPackager.java:223) at org.jpos.iso.packager.GenericPackager.<init>(GenericPackager.java:130) at ums.expy.ulink.T0100.<clinit>(T0100.java:28) at ums.expy.ws.service.T0100Service.doJob(T0100Service.java:75) Code: private static ISOPackager T0100Packager; static { try { T0100Packager = new GenericPackager( T0100.class.getResourceAsStream("/ulink0100.xml")); } catch (ISOException e) { logger.error("", e); } } Somebody says it will be OK when remove xml-apis.jar, but jPOS needs xml-apis.jar. I have configed WEB-INF/weblogic.xml <?xml version="1.0" encoding="UTF-8"?> <prefer-web-inf-classes>true</prefer-web-inf-classes> My maven pom.xml org.jpos jpos 1.9.8 org.slf4j slf4j-log4j12 1.7.7 org.mybatis mybatis-spring 1.2.2 com.oracle ojdbc14 10.2.0.5.0 org.mybatis mybatis 3.2.3 org.springframework spring-jdbc 3.2.6.RELEASE org.springframework spring-context 3.2.6.RELEASE org.springframework spring-web 3.2.6.RELEASE commons-codec commons-codec 1.9 c3p0 c3p0 0.9.1.2 commons-beanutils commons-beanutils 1.9.1 commons-lang commons-lang 2.6 xalan xalan 2.7.1 Why it's not workig?
has title: Compatibility of jPOS and Weblogic
has answer: http://stackoverflow.com/a/25674618
type: Question
answer count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/25644778
has body: i have this class: public class TF extends JPanel implements ActionListener { private ButtonGroup buttonGroup = new ButtonGroup(); private JRadioButton rdbtnFilm; private JRadioButton rdbtnSerieTv; private JPanel pnlGeneral; private JPanel pnlRadioButton; private JLabel lblTitolo; private JTextField tfTitolo; public TF() { pnlGeneral = new JPanel(); pnlRadioButton = new JPanel(); rdbtnFilm = new JRadioButton("Film"); rdbtnFilm.addActionListener(this); pnlRadioButton.add(rdbtnFilm); buttonGroup.add(rdbtnFilm); rdbtnSerieTv = new JRadioButton("Serie Tv"); rdbtnSerieTv.addActionListener(this); pnlRadioButton.add(rdbtnSerieTv); buttonGroup.add(rdbtnSerieTv); pnlGeneral.add(pnlRadioButton, gbc_panel_1); this.add(pnlGeneral); } public void actionPerformed(ActionEvent e) { if(rdbtnFilm.isSelected()) { lblTitolo = new JLabel("Titolo"); pnlGeneral.add(lblTitolo, gbc_lblTitolo); tfTitolo = new JTextField(); tfTitolo.setColumns(10); tfTitolo.setText("1"); pnlGeneral.add(tfTitolo, gbc_tfTitolo); } if(rdbtnSerieTv.isSelected()) { lblTitolo = new JLabel("Titolo"); pnlGeneral.add(lblTitolo, gbc_lblTitolo); tfTitolo = new JTextField(); tfTitolo.setColumns(10); tfTitolo.setText("1"); pnlGeneral.add(tfTitolo, gbc_tfTitolo); } } } but when i select a radio button just sometimes JPanel show me JLabel and JTextfield. I don't know if i need use revalidate(), repaint() or something else to refresh JPanel. This happens because Swing isn't thread-safe? Update public class Main { public static void main(String[] args) throws IOException { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame gui=new GUI(); gui.setVisible(true); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setSize(800,720); } }); } } public class GUI extends JFrame implements MouseListener { private boolean selected=true; public GUI() { //Creazione del Menu JMenuBar menuBar = new JMenuBar(); this.setJMenuBar(menuBar); JMenu menu = new JMenu("Switcha"); menuBar.add(menu); menu.addMouseListener(this)…
score: 1
accepted answer: http://stackoverflow.com/a/25646576
has comment: http://stackoverflow.com/comment/40070102
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25646576
has comment: http://stackoverflow.com/comment/40073225
has title: How to refresh JPanel when JRadioButton is select?
favorite count: 0
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/40071028
has comment: http://stackoverflow.com/comment/40071476
downvote count: 0
tagged with: jradiobutton
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/40071156
type: AnsweredQuestion

http://stackoverflow.com/comment/40095657
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25658330
score: 0
has text: @icza Serialization invokes the default constructor of the nearest non-serializable base class, but this class is final and non-serializable, so Serialization doesn't apply at all.

http://stackoverflow.com/comment/40168828
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25698893
has text: Finally got the solution. Thanks @MohammadAliBaydoun int b = 60; for (int i=0; i < 30 ; i++ ) { System.out.println(b-2*i); }

http://stackoverflow.com/comment/40036825
score: 0
comment on: http://stackoverflow.com/q/25625962
has text: You can use StringEscapeUtils from commons-lang: http://commons.apache.org/proper/commons-lang/javadocs/api-release/org/apache/commons/lang3/StringEscapeUtils.html#escapeXml11(java.lang.String)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25643043
has answer: http://stackoverflow.com/a/25666992
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15594590
score: 0
has body: I am working on spring tool suite.I am unable to start STS aft regular intervals say in an interval of 0ne week.STS is not getting opened.can anyone please help me to resolve this? The log file looks like this.. org.eclipse.swt.SWTError: No more handles
has title: unable to open STS aft regular intervals
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/40068334
tagged with: java
tagged with: spring-tool-suite

http://stackoverflow.com/q/25681531
type: UnansweredQuestion
has body: Is there a letter for the milliseconds since 1970 in SimpleDateFormat? I know about the getTime() method but I want to define a date and time pattern containing the milliseconds.
tagged with: java
has answer: http://stackoverflow.com/a/25682204
score: 6
has comment: http://stackoverflow.com/comment/40136825
has comment: http://stackoverflow.com/comment/40136568
has title: Is there a letter for the milliseconds since 1970 in SimpleDateFormat?
upvote count: 7
linked to: http://stackoverflow.com/q/4142313
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40136595
favorite count: 0
tagged with: timestamp
type: Question
has comment: http://stackoverflow.com/comment/40137734

set
tags question: http://stackoverflow.com/q/25590580
tag name: set
tags question: http://stackoverflow.com/q/25605128
tags question: http://stackoverflow.com/q/25652451
type: Tag

http://stackoverflow.com/q/25623285
score: 0
has comment: http://stackoverflow.com/comment/40031191
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25624576
type: Question
accepted answer: http://stackoverflow.com/a/25624576
tagged with: apache-felix
tagged with: equinox
has comment: http://stackoverflow.com/comment/40031297
tagged with: osgi
has body: I am working on an embedded system that previously used Apache Felix as an OSGi framework. I've been tasked with removing Felix and replacing it with Equinox, because Equinox currently supports a more recent version of the OSGi specification. The software on the device has a sizeable amount of proprietary code that ties in directly with certain bundles that are usually shipped with Felix (things like the eventadmin and log bundle). The Equinox versions of these bundles are different enough that it would be a lot of work to re-write the code. Is there any reason to not keep using some of these Felix bundles, even after switching the underlying framework from Felix to Equinox? I want to clarify that I am still trying to wrap my head around what exactly OSGi does. What I'm concerned about is that by not using the Equinox bundles, we'll lose the advantage of switching to Equinox (I'm concerned that all the extra code that provides the newest specification comes from the bundles, and that the applications which are designed specifically for Equinox will expect these bundles to be used.).
has title: Is there any reason not to use Felix bundles with the Equinox framework?
type: AnsweredQuestion

http://stackoverflow.com/a/25588664
has body: The -Xmx option sets the maximum size of the heap. But the JVM typically starts with a smaller heap, and expands it as required. To tell the JVM the initial size of the heap, use the -Xms option as well; e.g. java -Xmx4g -Xms4g ... tells Java to us a 4g heap, and set that size from the start. Note that this doesn't necessarily cause all of that physical / virtual memory to be allocated to the process immediately. However the heap's space sizes should be set in proportion to the nominal initial size. (As others have noted, these are atomic options; i.e. don't put a space before 4g.) If you know that you will need a large part of the requested heap "pretty soon", then setting -Xms avoids (repeated) resizing of the heap during start-up. But if your -Xms value is significantly more than you are likely to need, then you may end up using system resources unnecessarily.
type: Answer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25587106
score: 1

http://stackoverflow.com/a/25617399
upvote count: 1
score: 1
has body: The solution with looping over a cursor with all documents has turned out reasonably well. I will post it here for reference if anybody runs into the same trouble. However, i consider it a rather ugly hack and i strongly suspect it will scale poorly if applied to large datasets, so use this with care. If anybody has a more elegant solution, i'd still be interested to see it (the accepted answer is still up for grabs ). ;-) % // get handle to event collection events = mongoConn.getCollection('events'); % // get cursor with all event documents cursor = events.find(); % // parse events n = 1; while cursor.hasNext() event(n).bolus_id = cursor.next().get('bolus_id'); event(n).timestamp = cursor.curr().get('timestamp'); event(n).typ = cursor.curr().get('type'); event(n).title = cursor.curr().get('title'); event(n).value = cursor.curr().get('value'); event(n).sta = cursor.curr().get('start'); event(n).end = cursor.curr().get('end'); n = n + 1; end cursor.close();
type: Answer
answers question: http://stackoverflow.com/q/25606877
downvote count: 0

http://stackoverflow.com/a/25607407
upvote count: 2
score: 0
downvote count: 2
has body: Static blocks/variables executes in the order they placed in the source code. i.e the order you are seeing with your eye. Top to Bottom.
has comment: http://stackoverflow.com/comment/40002465
type: Answer
answers question: http://stackoverflow.com/q/25607390

android-viewpager
tag name: android-viewpager
type: Tag
tags question: http://stackoverflow.com/q/25676406
tags question: http://stackoverflow.com/q/25578373
tags question: http://stackoverflow.com/q/25684285
tags question: http://stackoverflow.com/q/25579204
tags question: http://stackoverflow.com/q/25561870
tags question: http://stackoverflow.com/q/25682443

http://stackoverflow.com/a/25712844
has body: At these lines: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/auto_lube","root", "mehar") Note you're trying to connect to a MySQL database using JdbcOdbcDriver which is not correct but probably the exception's cause. You should use MysQL Connector instead. Besides JDBC-ODBC bridge is deprecated since JDK8. See Removal of JDBC ODBC bridge in java 8 There are some other JDBC tips you can follow in this answer. In a nutshell: Use PreparedStatement properly to avoid SQL Injection attaks. The use of DriverManager.getConnection() is discouraged and should be replaced by DataSource.getConnection(). How to do this? See linked answer. Since Java 7 you can use try-with-resources which is a more elegant way to deal with try-catch blocks and closeable resources. Off-topic Please note there are several conceptual errors in your code. For example this SQL query (note the proper way of using prepared statements): String query = "SELECT * FROM assistant WHERE pass = ?"; This query will return all records where password is equal to some parameter, so if two or more people have the same password it will return more than a single record. Unlikely, yes, but possible. Log-in systems are based on user names and passwords, so you should query for user name and then check if password is valid or not. Not to mention that password should not be stored as plain text but at least encrypted (better if hashed). On the other hand based on your code it is really hard to tell if you are using Swing standard components or some other API based on Swing. I mean, what is org.openide.*? Where are the imports for Swing components? Finally, if you still having problems, pelase post the exception's stack trace.
type: Answer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25707531
score: 1

spring-security
tags question: http://stackoverflow.com/q/25685484
tags question: http://stackoverflow.com/q/25622670
tags question: http://stackoverflow.com/q/25711970
tags question: http://stackoverflow.com/q/25568261
tags question: http://stackoverflow.com/q/25591320
tags question: http://stackoverflow.com/q/25580095
tags question: http://stackoverflow.com/q/25674582
tags question: http://stackoverflow.com/q/25690900
tags question: http://stackoverflow.com/q/25659838
tags question: http://stackoverflow.com/q/25659398
tags question: http://stackoverflow.com/q/25640872
tags question: http://stackoverflow.com/q/25647925
tags question: http://stackoverflow.com/q/25692735
tags question: http://stackoverflow.com/q/25631477
type: Tag
tags question: http://stackoverflow.com/q/25633477
tags question: http://stackoverflow.com/q/25710797
tags question: http://stackoverflow.com/q/25607154
tags question: http://stackoverflow.com/q/25616594
tags question: http://stackoverflow.com/q/25570237
tags question: http://stackoverflow.com/q/25673757
tags question: http://stackoverflow.com/q/25635434
tags question: http://stackoverflow.com/q/25641043
tags question: http://stackoverflow.com/q/25631791
tags question: http://stackoverflow.com/q/25640116
tags question: http://stackoverflow.com/q/25565809
tags question: http://stackoverflow.com/q/25612984
tags question: http://stackoverflow.com/q/25663348
tag name: spring-security
tags question: http://stackoverflow.com/q/25641379

http://stackoverflow.com/q/25695518
tagged with: java
answer count: 1
has title: In need to create method interceptors in plain java (ee, servlets and POJOs) to use in weblogic, what can I use to do so?
accepted answer: http://stackoverflow.com/a/25772562
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/40303931
has answer: http://stackoverflow.com/a/25772562
has body: I'm implementing an audit api to log any method invocation which has an @Auditable annotation in its declaration. The basic requirements are that it must be used by current applications and should be non-intrusive. I already have the auditing API by means of a Log4J2 wrapper, and also I successfully used it in some EJB Interceptors. However, I need to create an all-terrain interceptor I can use wherever the annotation is used, i.e., I'd like to annotate servlets, EJBs and POJOs methods with it and let the interceptor work its magic. I've tried Java EE Interceptors and they only work in EJB, I've tried GUICE but it doesn't work with servlet nor EJB methods, only guice injected POJOs. I'd like to know, if somebody knows how, what should I use and I'll be gratefull if an example can be pointed at to. Thank you very much.
tagged with: aop
has comment: http://stackoverflow.com/comment/40162867
tagged with: servlets
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40300769

http://stackoverflow.com/q/25551011
has body: I have a LocalDate and I would like to print the date with day and month as 2 digit and the year as 4 digit, based on Locale format pattern. Actually, I can use the DateTimeFormatter to set the short date, but unfortunately "I can't" change the default pattern...Is there a method to do this? Below, I explain this with an example: Locale l = Locale.ITALIAN; LocalDate localDate = new LocalDate( 2014, 8, 28); DateTimeFormatter formatterOutput1 = DateTimeFormat.shortDate().withLocale(l); System.out.println( "Output1: " + formatterOutput1.print(localDate)); l = Locale.ENGLISH; DateTimeFormatter formatterOutput2 = DateTimeFormat.shortDate().withLocale(l); System.out.println( "Output2: " + formatterOutput2.print(localDate)); This is the result: Output1: 28/08/14 Output2: 8/28/14 So, the output is correct, but I expect this: Output1: 28/08/2014 Output2: 08/28/2014 How can I change the default pattern? Thanks!
type: AnsweredQuestion
tagged with: jodatime
answer count: 2
has answer: http://stackoverflow.com/a/25551380
score: 5
accepted answer: http://stackoverflow.com/a/25551380
tagged with: locale
downvote count: 0
has answer: http://stackoverflow.com/a/25551371
possible better answer: http://stackoverflow.com/a/25551371
favorite count: 0
type: Question
upvote count: 5
tagged with: java
tagged with: datetime
has title: Change date pattern from shortDate() format in JodaTime
tagged with: date

http://stackoverflow.com/comment/40072141
type: QuestionComment
comment on: http://stackoverflow.com/q/25645812
has text: Try to use `cfg.configure(retrieve.class.getResource("hibernate.cfg.xml"))`
score: 0
type: Comment

http://stackoverflow.com/a/25595940
has comment: http://stackoverflow.com/comment/40001285
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39981884
upvote count: 1
answers question: http://stackoverflow.com/q/25595844
has comment: http://stackoverflow.com/comment/40097932
has comment: http://stackoverflow.com/comment/39981828
has comment: http://stackoverflow.com/comment/39981905
type: Answer
has comment: http://stackoverflow.com/comment/39981707
has body: Unless you've been explicitly told otherwise, you shouldn't assume that the total will fit in an int. Try changing the type of i to a long, or even a BigInteger, and see if that makes a difference to your score. You might try doing the same with k (and using Long.parseLong(line)). It will depend on the exact wording of the question, but perhaps the individual values could exceed the limits of an int too. One more thing... the question, as you've phrased it, just says that you should sum all the integers. That leaves open the possibility that there will be lines that aren't integers, in which case you should skip them, rather than throwing a NumberFormatException (which is what your code will do at the moment). (And presumably you've been told that it's one entry per line...) But if you want to squeeze every last bit of performance out, you need to read the file as binary rather than line by line: turning each line into a String is just too expensive. A detailed account of how to do it can be found in this question on summing integers from a text file.
accepted answer of: http://stackoverflow.com/q/25595844

http://stackoverflow.com/comment/39974566
type: Comment
comment on: http://stackoverflow.com/a/25592110
type: AnswerComment
score: 0
has text: @dumas You almost got it right, but you had several bugs, as mentioned in my answer.

http://stackoverflow.com/comment/58844821
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25559318
type: Comment
has text: I was able to run the [Google Calendar API sample Java code](https://github.com/google/google-api-java-client-samples/tree/master/calendar-cmdline-sample) only after configuring [servlet-api-2.5.jar](http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar) on the build path. See http://stackoverflow.com/questions/8521851/where-do-i-get-servlet-api-jar-from

http://stackoverflow.com/a/25689416
answers question: http://stackoverflow.com/q/25606833
has body: Based on this comment: "Simply summing up all the bytes is faster", I propose a variation of the accepted answer. The accepted answer proposes breaking the problem into chunks, calculating a sum for each chuck using multithreading, and adding them together at the end. This idea can be used to reduce the number of multiplications to O(1) in the backward scan, without any table lookups and without threading (or combine it with threading). Simply take advantage of the way multiplication distributes over addition and add all the ones digits into one accumulator, the tens into a separate one, hundreds and thousands into their own accumulators. This requires no multiplication whatsoever. The reduce step combining results from multiple threads can also be done using the per-place accumulators. The final step of calculating the totals will require multiplication (or take advantage of the fact that 10 has only two bits set and use bit shifts and add), but only 9 multiplications are sufficient.
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40156296
type: Answer
has comment: http://stackoverflow.com/comment/40156255

http://stackoverflow.com/comment/40055455
has text: `/background.png`, becomes `File("/background.png")`...can you see a problem here. Are the images stored within the application or are they separate, located on the file system somewhere?
comment on: http://stackoverflow.com/q/25636507
type: Comment
type: QuestionComment
score: 0

network-programming
tag name: network-programming
tags question: http://stackoverflow.com/q/25676656
tags question: http://stackoverflow.com/q/25648371
tags question: http://stackoverflow.com/q/25566658
tags question: http://stackoverflow.com/q/25629547
tags question: http://stackoverflow.com/q/25658814
tags question: http://stackoverflow.com/q/25638165
tags question: http://stackoverflow.com/q/25588201
tags question: http://stackoverflow.com/q/25665189
tags question: http://stackoverflow.com/q/25610710
tags question: http://stackoverflow.com/q/25688659
tags question: http://stackoverflow.com/q/25632491
type: Tag
tags question: http://stackoverflow.com/q/25621942

http://stackoverflow.com/q/25671325
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26214906
tagged with: openstreetmap
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40122381
has body: I am trying to export leaftlet map with markers to PNG format using html2canvas. Issue is html2canvas is able to create PNG of Map but not with the Markers on the map. No sure about the reason but I guess because of the layering, it is creating PNG of map layer only. My Fiddle: http://jsfiddle.net/Lup55pa6/1/ Would be great if someone can provide me solution with existing APIs I am using OR I can consider other export options as well if possible in any JS library or Java.
tagged with: javascript
tagged with: html2canvas
has title: Leaflet OpenStreetMap Image Export with Map Markers using html2canvas
has answer: http://stackoverflow.com/a/30866725
has answer: http://stackoverflow.com/a/26078186
tagged with: leaflet
answer count: 3
linked to: http://stackoverflow.com/q/25172591
score: 1
tagged with: java

http://stackoverflow.com/q/25710763
tagged with: spring
has comment: http://stackoverflow.com/comment/40190701
score: 4
has comment: http://stackoverflow.com/comment/40190641
tagged with: spring-mvc
type: AnsweredQuestion
has title: Spring MVC Redirect Attribute Messages
tagged with: java
answer count: 1
favorite count: 0
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/25711047
tagged with: jstl
has answer: http://stackoverflow.com/a/25711047
has comment: http://stackoverflow.com/comment/40190571
downvote count: 0
has body: I am having some issues while displaying messages after I have successfully, or unsuccessfully performed some type of CRUD operation (CREATE, DELETE, etc). I have attempted to use Redirect Flash Attributes, although I have found no luck with these and I cannot get the message displaying at all. For example I have declared something like this within my Controller method: public String DeleteAction(Model model, Object object, @RequestParam int id, RedirectAttributes attributes) { // Method logic object.delete(id); attributes.addFlashAttribute("success", "Object has been removed successfully."); return "index"; // View resolver redirect } That is an example of my function within one of my controllers where I declare the flash attribute to be binded to the view. I call the flash attribute like this within the .jsp ${success}, although I still cannot get it to display. Is there anything I am missing which is not enabling this to work?
has comment: http://stackoverflow.com/comment/40190827

calculator
tags question: http://stackoverflow.com/q/25681122
tags question: http://stackoverflow.com/q/25590057
tags question: http://stackoverflow.com/q/25597154
type: Tag
tag name: calculator
tags question: http://stackoverflow.com/q/25614814

http://stackoverflow.com/a/35338758
downvote count: 0
has body: I think u should try this ... package com.ankit.vkapplock; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; public class StartupServiceReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){ context.startService(new Intent(context, HeartBeat.class )); } Dont forget to add permisson for boot_completion action. &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/&gt;
score: 2
answers question: http://stackoverflow.com/q/25562899
type: Answer
upvote count: 2

http://stackoverflow.com/comment/40686431
type: AnswerComment
comment on: http://stackoverflow.com/a/25693749
has text: And I really think that next time I will be using Maven.
type: Comment
score: 0

http://stackoverflow.com/comment/39965216
has text: "_I always get an error_" What error? Also, keep your naming conventions consistent meaning start all your variables with a lower case letter.
comment on: http://stackoverflow.com/q/25587239
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/q/25678115
tagged with: spring
tagged with: spring-mvc
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/40131277
has comment: http://stackoverflow.com/comment/40131266
tagged with: java
has body: How to catch all exceptions in spring-3.0 mvc application? I tried something like this: public class CustomExceptionResolver extends SimpleMappingExceptionResolver { ... } and uncaughtException But it's still not going to that class whenever I encounter exceptions. I can't use annotations (eg. @Controller, @ExceptionHandler, @ControllerAdvice) Lastly, how to use @ControllerAdvice without annotations? Thanks.
has title: ExceptionResolver in Spring MVC without annotations
type: Question
tagged with: exceptionhandler
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40132721

http://stackoverflow.com/q/25632123
possible better answer: http://stackoverflow.com/a/25781639
has answer: http://stackoverflow.com/a/25638804
type: Question
has answer: http://stackoverflow.com/a/25781639
has title: Spring Data JPA xml configuration : "Table not found" with create-drop
has comment: http://stackoverflow.com/comment/40048267
downvote count: 0
tagged with: spring
score: 4
tagged with: spring-data-jpa
has answer: http://stackoverflow.com/a/25638507
has body: I probably forgot something in my conf somewhere and I can't figure out what. I have an @Entity : @Entity public class MyEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long id; I have a JpaRepository public interface MyEntityRepository extends JpaRepository<MyEntity, Long> { } Here is my appContext.xml <context:annotation-config /> <context:component-scan base-package="com.foo.project" /> <mvc:annotation-driven /> <mvc:resources mapping="/resources/**" location="/resources/" /> create-drop org.hibernate.dialect.H2Dialect <tx:annotation-driven /> <jpa:repositories base-package="com.foo.project.repository" /> And i have a unit test : @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:**/appContext.xml" }) public class MyEntityRepositoryTest { @Autowired private MyEntityRepository myEntityRepository; When i run the test, i get an error : ERROR: Table "MYENTITY" not found; This is the full log : sept. 04, 2014 8:19:47 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation INFO: HHH000204: Processing PersistenceUnitInfo [ name: default ...] sept. 04, 2014 8:19:47 AM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.3.6.Final} sept. 04, 2014 8:19:47 AM org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found sept. 04, 2014 8:19:47 AM org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist sept. 04, 2014 8:19:48 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final} sept. 04, 2014 8:19:48 AM org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.H2Dialect sept. 04, 2014 8:19:49 AM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: HHH000397: Using ASTQueryTranslatorFactory sept. 04, 2014 8:19:49 AM org.hibernate.valida…
type: AnsweredQuestion
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/40048207
accepted answer: http://stackoverflow.com/a/25638804
favorite count: 0
upvote count: 4

http://stackoverflow.com/q/25632576
has answer: http://stackoverflow.com/a/25632612
accepted answer: http://stackoverflow.com/a/25632589
linked to: http://stackoverflow.com/q/2279030
has answer: http://stackoverflow.com/a/25632589
tagged with: arraylist
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25632612
has comment: http://stackoverflow.com/comment/40048710
tagged with: list
has answer: http://stackoverflow.com/a/25632794
score: 0
tagged with: java
answer count: 7
has comment: http://stackoverflow.com/comment/40048714
has comment: http://stackoverflow.com/comment/40048931
has answer: http://stackoverflow.com/a/25632665
linked to: http://stackoverflow.com/q/383947
has answer: http://stackoverflow.com/a/25632739
has comment: http://stackoverflow.com/comment/40048977
type: Question
has title: Build an ArrayList<> from a List<>
has answer: http://stackoverflow.com/a/25632689
has comment: http://stackoverflow.com/comment/40048825
has body: What is the best way of building an ArrayList&lt;&gt; from a List&lt;&gt; ? An Example would be great and another question, should i keep working with a List&lt;&gt; instead of converting all my Lists to ArrayLists Edit Just to be sure of my code : can this work : public List&lt;Rendezvous&gt; getAllNewlyDoneRdvs() { if (!isThereNewlyDoneRdvs())return null; List&lt;Rendezvous&gt; rdvs = rdvDao.findAllByState(Constants.rdvStateUndone); ArrayList&lt;Rendezvous&gt; rendezvousList = new ArrayList&lt;&gt;(); for (Rendezvous rdv :rdvs ){ if (rdv.getDateRdv().before(Constants.getCurrentDatetime())) rendezvousList.add(rdv) ; } rdvs = rendezvousList; return rdvs; }
has answer: http://stackoverflow.com/a/25633137

http://stackoverflow.com/comment/40074970
has text: Remove the semicolon for(int counter = 0; counter < paco.length; counter++)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25647528
score: 0

http://stackoverflow.com/comment/39984424
comment on: http://stackoverflow.com/q/25597457
has text: There is a reason that `AtomicInt` exists!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25559417
has answer: http://stackoverflow.com/a/25560342
has comment: http://stackoverflow.com/comment/39913451
score: 0
tagged with: sql
tagged with: java
answer count: 1
has title: Getting question marks in hebrew values from SQL in java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/39913767
has comment: http://stackoverflow.com/comment/39973608
tagged with: encoding
has body: I know that there is alot of variation of this question in stackOverflow, but none of then helped me in this problem... I'm tring to build website with java (JSPs, servlets, and more), I'm using mysql 5.6, Java 7, and apache tomcat 7. when I tried to get data from mysql using java, It displayed only question marks. At first, I thought it is only problem of display, but when I checked the string in java, In was an actual question marks, with ascii value of 63... I'm using connector class that I wrote for handling sql, here is the code: package classes; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; public class Connector { private Connection con; public Connector(String userName, String password) { MysqlDataSource ds = new MysqlDataSource(); ds.setServerName("localhost"); ds.setPort(3306); try { con = ds.getConnection("root","16180339887"); } catch (SQLException e) { e.printStackTrace(); } } public void executeUpdate(String sql) { try { Statement st = con.createStatement(); st.executeUpdate(sql); st.close(); } catch (SQLException e) { e.printStackTrace(); } } public String[][] executeQuery(String sql) { String[][] query = null; try { Statement stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet result = stmt.executeQuery(sql); int column = result.getMetaData().getColumnCount(); result.last(); query = new String[result.getRow()][column]; result.beforeFirst(); int i = 0; while (result.next()) { for (int j = 0; j &lt; column; j++) query[i][j] = result.getString(j + 1); i++; } result.close(); stmt.close(); } catch (SQLException e) { e.printStackTrace(); } return query; } } here is the database creation code: private static void createDB() { Connector c = new Connector("root", "16190339887"); c.executeUpdate("CREATE DATABASE grade4troop1"); c.executeUpdate("USE grade4troop1"); c.executeUpdate("CREATE TABLE…
type: UnansweredQuestion
tagged with: jdbc

http://stackoverflow.com/a/25679596
score: 4
upvote count: 4
downvote count: 0
has body: The general answer to your question is that you don't know that. The C specification leaves it entirely open to the libc implementation how malloc will work. It could, if it wanted to, allocate each of those 10k integers at completely random locations in memory, in which case there is certainly many gaps left to fill with longs without allocating new pages. There are, in fact, even real-world examples of malloc implementations acting somewhat like that. You may find it interesting to read about, for example, worst fit allocators. Another thing that you may want to keep in mind is that many current malloc implementations have a minimum amount of memory they will allocate in one call. On x86-64 glibc, this amount is 24 bytes, so whether you call it to allocate 4 or 8 bytes, 24 bytes will still be allocated. Freeing such a 4-byte malloc, therefore, still enables an 8-byte malloc to fill the same space.
answers question: http://stackoverflow.com/q/25679546
type: Answer

http://stackoverflow.com/comment/40069363
type: AnswerComment
score: 0
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/60537/discussion-between-daniel-scott-and-st-antario).
type: Comment
comment on: http://stackoverflow.com/a/25643631

http://stackoverflow.com/q/25579147
has comment: http://stackoverflow.com/comment/39950806
accepted answer: http://stackoverflow.com/a/25579179
favorite count: 0
type: Question
downvote count: 4
has answer: http://stackoverflow.com/a/25579179
has body: AND YES I have looked at simialr quesions and NO I cannot find an answer to my question...If you have a question about my question or code. PLEASE ASK. do{ try { System.out.print ("Volume of a cone... V = 1/3(3.14)r^2(h)"); System.out.println (); System.out.print ("Input Radius: "); radius = keyBoard.nextDouble (); System.out.print ("Input Height: "); height = keyBoard.nextDouble (); //math volume = 0.333 * pie * radius * radius * height; System.out.printf ("Volume = " + volume); }//end try catch (Exception Error){ System.out.println ("You Entered the Wrong Data."); } finally { System.out.println (); System.out.print ("Do you want to try again?"); System.out.println (); System.out.print ("Input '1' to go again OR any other key to End.: "); counter = keyBoard.nextInt (); }//end finally }while (counter == 1);
score: -3
upvote count: 1
has comment: http://stackoverflow.com/comment/39950785
has comment: http://stackoverflow.com/comment/39950808
type: AnsweredQuestion
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39950786
tagged with: try-catch-finally
has comment: http://stackoverflow.com/comment/39950828
has title: When using try/catch/finally, with error inputmismatch exception, How do I correctly implement a finally block, WITHOUT getting an error

http://stackoverflow.com/comment/39986601
type: AnswerComment
score: 0
has text: This give me a good idea about writing a file path in which i always make a mistake. Thank a lot!
type: Comment
comment on: http://stackoverflow.com/a/25598501

random
tags question: http://stackoverflow.com/q/25692407
tags question: http://stackoverflow.com/q/25593219
tags question: http://stackoverflow.com/q/25633414
tags question: http://stackoverflow.com/q/25605348
tags question: http://stackoverflow.com/q/25668144
tags question: http://stackoverflow.com/q/25702850
tags question: http://stackoverflow.com/q/25634169
tag name: random
tags question: http://stackoverflow.com/q/25655458
tags question: http://stackoverflow.com/q/25621159
tags question: http://stackoverflow.com/q/25664752
tags question: http://stackoverflow.com/q/25596839
tags question: http://stackoverflow.com/q/25683321
type: Tag
tags question: http://stackoverflow.com/q/25703774
tags question: http://stackoverflow.com/q/25590597
tags question: http://stackoverflow.com/q/25605181
tags question: http://stackoverflow.com/q/25694807
tags question: http://stackoverflow.com/q/25619270
tags question: http://stackoverflow.com/q/25655366
tags question: http://stackoverflow.com/q/25707515
tags question: http://stackoverflow.com/q/25649005
tags question: http://stackoverflow.com/q/25696205
tags question: http://stackoverflow.com/q/25709506
tags question: http://stackoverflow.com/q/25568771
tags question: http://stackoverflow.com/q/25572740

http://stackoverflow.com/q/25697351
has title: String Input line 4 Error, I cannot seem to figure out what it is
has answer: http://stackoverflow.com/a/25697359
type: UnansweredQuestion
tagged with: java
downvote count: 4
upvote count: 0
score: -4
answer count: 1
has body: import java.io.*; public class StringInput{ public static void main (String args[]);{ String Name "StringInput"; System.out.print ("Enter your name: "); InputStreamReader input = new InputStreamReader(System.in); InputStreamReader reader = new BufferedReader(input); name = reader.readline(); catchException e;{ }//Exception System.out.println ("Hello"+Name+"How are you?"); }//main }//class That is the code that I was doing, theres one error. Line 4, I can't figure out what it is. We were doing it in class (I just started Computer Programming 12) and we didn't have time to finish it and everything. If someone could help me figure out what is wrong with line 4 that'd be really helpful. Thanks ! :) Removed the semi colon, still get String Name "StringInput"; ^ 1 error Process completed.
has comment: http://stackoverflow.com/comment/40166109
favorite count: 0
type: Question

http://stackoverflow.com/comment/39942696
score: 0
has text: I think you can link just one entity at a time.
comment on: http://stackoverflow.com/q/25572084
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25623265
tagged with: performance
tagged with: while-loop
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40031885
has comment: http://stackoverflow.com/comment/40031714
tagged with: large-data
accepted answer: http://stackoverflow.com/a/25623402
has answer: http://stackoverflow.com/a/25623402
type: Question
has comment: http://stackoverflow.com/comment/40031088
has comment: http://stackoverflow.com/comment/40030942
has answer: http://stackoverflow.com/a/25623594
answer count: 3
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25623584
tagged with: lucene
favorite count: 0
has body: I have some efficiency problems. I'm developing an enterprise application that is deployed on a jboss EAP 6.1 server as an EAR archive. I create new objects based on entities in a while loop and write them to a file. I get those entities (with help of an EJB DAO) in limited amount (for example 2000 for each step). The problem is that I need to process millions of objects and the first million goes quite smoothly but the further loop goes the slower it works. Can anyone tell me why is this working slower and slower as the loop advances? How can I make it work smoothly all way long? Here are some crucial parts of the code: public void createFullIndex(int stepSize) { int logsNumber = systemLogDao.getSystemLogsNumber(); int counter = 0; while (counter &lt; logsNumber) { for (SystemLogEntity systemLogEntity : systemLogDao.getLimitedSystemLogs(counter, stepSize)) { addDocument(systemLogEntity); } counter = counter + stepSize; } commitIndex(); } public void addDocument(SystemLogEntity systemLogEntity) { try { Document document = new Document(); document.add(new NumericField("id", Field.Store.YES, true).setIntValue(systemLogEntity.getId())); document.add(new Field("resource", (systemLogEntity.getResource() == null ? "" : systemLogEntity .getResource().getResourceCode()), Field.Store.YES, Field.Index.ANALYZED)); document.add(new Field("operationType", (systemLogEntity.getOperationType() == null ? "" : systemLogEntity document.add(new Field("comment", (systemLogEntity.getComment() == null ? "" : systemLogEntity.getComment()), Field.Store.YES, Field.Index.ANALYZED)); indexWriter.addDocument(document); } catch (CorruptIndexException e) { LOGGER.error("Failed to add the following log to Lucene index:\n" + systemLogEntity.toString(), e); } catch (IOException e) { LOGGER.error("Failed to add the following log to Lucene index:\n" + systemLogEntity.toString(), e); } } I would appreciate your help!
possible better answer: http://stackoverflow.com/a/25623594
type: AnsweredQuestion
has title: Lucene Document creation in while loop slows down more and more

http://stackoverflow.com/q/25690565
answer count: 3
has comment: http://stackoverflow.com/comment/40153240
has title: Use class.getResource() to load file within .jar?
favorite count: 0
has body: I have the following directory structure in my java project: This project is managed by Maven, and when package all resources are put into a single .jar file. Within Utils.java I'm loading car.jpg, and since the texture file is on the classpath I'm using the following method to get a handle on the file: URL url = Utils.class.getResource("/textures/car.jpg"); I've seen a lot of confusion about which method to use when getting a reference to a file on the classpath. Is class.getResource() the right method to use? Or does class.getResourceAsStream() offer any benefits?
type: Question
has answer: http://stackoverflow.com/a/25691260
tagged with: maven
has comment: http://stackoverflow.com/comment/40153193
possible better answer: http://stackoverflow.com/a/25690628
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/25690628
accepted answer: http://stackoverflow.com/a/25690612
has answer: http://stackoverflow.com/a/25690612
type: AnsweredQuestion
tagged with: java
downvote count: 0

http://stackoverflow.com/q/25666293
upvote count: 0
type: UnansweredQuestion
score: -3
linked to: http://stackoverflow.com/q/14784630
has comment: http://stackoverflow.com/comment/40108774
has comment: http://stackoverflow.com/comment/40116129
has comment: http://stackoverflow.com/comment/40109126
has comment: http://stackoverflow.com/comment/73603621
tagged with: converters
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/25666454
has title: java convert decimal to any binary bit
linked to: http://stackoverflow.com/q/22008606
has answer: http://stackoverflow.com/a/25666456
favorite count: 0
has comment: http://stackoverflow.com/comment/40108869
type: Question
has body: I'm making a project of converting decimal number into binary. But I have a problem that how can I convert any entered number into binary (I'm using array), here is my code: public void Decimal2Binary(int a) { int result []=new int[8]; for (int i = 7;i &gt;=0; i--,a/=2) { result[i]=a%2; } I do not need it for just only 8-bit binary result, yet, I need it for any size.
answer count: 2

http://stackoverflow.com/q/25578887
score: 0
has comment: http://stackoverflow.com/comment/39950304
has comment: http://stackoverflow.com/comment/39950606
has comment: http://stackoverflow.com/comment/39950732
tagged with: android-fragments
tagged with: android-listview
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25578932
has title: Custom ListView on fragment
has answer: http://stackoverflow.com/a/25580052
answer count: 2
has comment: http://stackoverflow.com/comment/39950837
has comment: http://stackoverflow.com/comment/39950415
has comment: http://stackoverflow.com/comment/39950639
linked to: http://stackoverflow.com/q/22512833
type: UnansweredQuestion
has body: I'm trying to get my custom listview on a fragment, but I can only accomplish it through an activity. here's my code: MyActivity: package com.teampainite.testreviews; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.RatingBar; import android.widget.TextView; import java.util.ArrayList; import java.util.List; public class MyActivity extends Activity { private List&lt;ReviewAdapter&gt; Review = new ArrayList&lt;ReviewAdapter&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); populateReviews(); populateReviewList(); } private void populateReviewList() { Review.add(new ReviewAdapter("Okay", 4, "Levi", "This is an example")); } private void populateReviews() { ArrayAdapter&lt;ReviewAdapter&gt; adapter = new ReviewList(); ListView list = (ListView) findViewById(R.id.list); list.setFastScrollEnabled(true); list.setAdapter(adapter); } private class ReviewList extends ArrayAdapter&lt;ReviewAdapter&gt; { public ReviewList() { super(MyActivity.this, R.layout.review_layout, Review); } @Override public View getView(int position, View convertView, ViewGroup parent) { View ReviewView = convertView; if(ReviewView == null){ ReviewView = getLayoutInflater().inflate(R.layout.review_layout, parent, false); } //Find view ReviewAdapter currentReview = Review.get(position); TextView title = (TextView)ReviewView.findViewById(R.id.review_list_title); RatingBar rating = (RatingBar)ReviewView.findViewById(R.id.review_rating); TextView user = (TextView)ReviewView.findViewById(R.id.review_user); TextView review = (TextView)ReviewView.findViewById(R.id.review_content); title.setText(currentReview.getTitle()); rating.setRating(currentReview.getRating()); user.setText(currentReview.getUser()); review.setText(currentReview.getReview()); rating.setEnabled(fa…
has comment: http://stackoverflow.com/comment/39950312
linked to: http://stackoverflow.com/q/11737308
has comment: http://stackoverflow.com/comment/39950875
type: Question
has comment: http://stackoverflow.com/comment/39950293
has comment: http://stackoverflow.com/comment/39950592
has comment: http://stackoverflow.com/comment/39950543

http://stackoverflow.com/comment/40046727
has text: +1. However, I would argue (pedantically) that `m` is not actually a class variable, but an instance variable. An instance variable becomes a class variable in Java when marked `static`.
comment on: http://stackoverflow.com/a/25631575
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25686759
answers question: http://stackoverflow.com/q/25686704
has comment: http://stackoverflow.com/comment/40145858
has comment: http://stackoverflow.com/comment/40146706
upvote count: 2
has comment: http://stackoverflow.com/comment/40145817
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40146413
downvote count: 1
has body: You can only access jsps under WEB-INF if you redirect to them through a servlet. Nothing on WEB-INF can be accessed directly.
accepted answer of: http://stackoverflow.com/q/25686704
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/40145927

http://stackoverflow.com/comment/40132656
has text: It is VARCHAR2(40 BYTE)
comment on: http://stackoverflow.com/q/25679372
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40009000
comment on: http://stackoverflow.com/q/25610937
type: Comment
has text: this looks correct to me, maybe someone more experienced can shed some light
score: 0
type: QuestionComment

http://stackoverflow.com/q/25610352
tagged with: variables
score: 2
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/12790528
answer count: 1
accepted answer: http://stackoverflow.com/a/25610750
has title: How to implement an Variable Change Listener, for a variable running in different thread (example)
has answer: http://stackoverflow.com/a/25610750
favorite count: 0
type: Question
tagged with: listener
has body: I have a AtomicInteger Variable (CurrentCycle) that is being updated in a separate thread to my UI thread. I am trying to update a text field in the UI field based on the the value of the AtomicInteger without an ugle while loop in the UI thread. I've spent days searching online looking at related queries but am not getting anywhere on this. I'm looking for the simplest way to do this possible. I'm aware that there are posts out there for similar questions but I haven't been able to use them as they have been too abstract or for a different need. My main questions are: 1. Do I need to register a listener to do this or is there a simpler way? 2. Where and how do I register the listener? Do I have to setup a separate interface class (I'd like to avoid this if possible). 3. Could you please some real example I could use - abstract explanations aren't helping me so far! I've included my key code (which is not doing anything as the method is not being fired yet) below. Anyhelp you can provide would be greatly appreciated. // MyActivity.java // Declaration (do I need this?) AtomicInteger CurrentCycle = new AtomicInteger(0);' // Method which doesn't appear to be firing when CurrentCycle Changes... public void setVariableChangeListener(VariableChangeListener variableChangeListener) { this.variableChangeListener = variableChangeListener; if ((CurrentCycle != PreviousCycle ) &amp;&amp; (this.variableChangeListener !=null)) { Toast.makeText(getApplicationContext(), "Test - code on variable change is firing.", Toast.LENGTH_SHORT).show(); PreviousCycle=CurrentCycle; }
upvote count: 2
tagged with: multithreading
downvote count: 0

http://stackoverflow.com/a/25570689
score: 0
has body: Apache Commons Collections CollectionUtils has a method called disjunction() that will do exactly what you want.
type: Answer
answers question: http://stackoverflow.com/q/25570308

http://stackoverflow.com/a/25572909
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: Seems like it was first introduced in Java 1.4. Reference Links: http://docs.oracle.com/javase/7/docs/technotes/guides/xml/jaxp/JAXP-Compatibility_160.html http://www.oracle.com/technetwork/java/javase/relnotes-139182.html As per the link: New system property to limit entity expansion The entityExpansionLimit system property lets existing applications constrain the total number of entity expansions without recompiling the code. The parser throws a fatal error once it has reached the entity expansion limit. (By default, the limit is set to 64000.) To set the entity expansion limit using the system property, use an option like the following on the java command line: -DentityExpansionLimit=100000
type: Answer
answers question: http://stackoverflow.com/q/25572783
accepted answer of: http://stackoverflow.com/q/25572783
score: 1

http://stackoverflow.com/q/25587318
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39965862
downvote count: 0
linked to: http://stackoverflow.com/q/15421708
tagged with: layout-manager
tagged with: swing
has title: Java Swing API - GroupLayout Not Resizing All Component JPanels Correctly
has comment: http://stackoverflow.com/comment/39965942
score: 2
has comment: http://stackoverflow.com/comment/39980421
has comment: http://stackoverflow.com/comment/39965719
has comment: http://stackoverflow.com/comment/39986385
tagged with: java
answer count: 1
tagged with: grouplayout
has body: I only started using Java Swing yesterday, so pardon me if this isn't a valid question. I've been trying to create a simple UI with a grid and a panel that allows the user to specify the size of dimensions of the grid. I have two classes extending JPanel: GridSizePanel and GridBoxPanel. GridSizePanel specifies the title, border, labels and fields involved in designing the panel that allows the user to alter dimensions. GridBoxPanel displays the actual grid (adopted from here). GridSizePanel uses the GroupLayout as its LayoutManager and GridBoxPanel uses GridBagLayout. The parent JFrame class(MazeSolverInterface) which orchestrates these sub-panels uses GroupLayout as it's LayoutManager. The problem is, if I only add the GridSizePanel to the MazeSolverInterface's GroupLayout, when I resize the window manually, I can see the GridSizePanel resizing automatically. All good. But when I add the GridBoxPanel to the MazeSolverInterface, now when I resize the window manually, only the GridBoxPanel seems to resize. The GridSizePanel doesn't change dimension at all! Here's my code so far: GridSizePanel: public class GridSizePanel extends JPanel implements PropertyChangeListener { public GridSizePanel() throws ParseException { // set the border properties TitledBorder title = BorderFactory.createTitledBorder("Grid Size"); title.setTitleColor(Color.BLACK); title.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.DARK_GRAY, Color.GRAY)); this.setBorder(title); // wire up the group layout and panel to // each other GroupLayout gl = new GroupLayout(this); this.setLayout(gl); // Turn on automatically adding gaps between components gl.setAutoCreateGaps(true); // Turn on automatically creating gaps between components that touch // the edge of the container and the container. gl.setAutoCreateContainerGaps(true); JLabel numRowsLabel = new JLabel("rows"); JLabel numColsLabel = new JLabel("columns"); MaskFormatter textMask = new MaskFormatter("##"); textMask.setPlacehold…
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39979019
has answer: http://stackoverflow.com/a/25621998
upvote count: 2

http://stackoverflow.com/comment/40012022
comment on: http://stackoverflow.com/q/25612786
type: QuestionComment
has text: Can the fields come with uppercase AND lowercase? Or just one of those?
score: 0
type: Comment

http://stackoverflow.com/q/25703769
has comment: http://stackoverflow.com/comment/40177532
tagged with: java-native-interface
has title: Getting "Java Result: -1073741571" on loading library Cryptopp
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25708326
tagged with: crypto++
tagged with: native-code
has comment: http://stackoverflow.com/comment/40177902
has comment: http://stackoverflow.com/comment/40177731
type: Question
downvote count: 0
upvote count: 1
type: UnansweredQuestion
answer count: 1
linked to: http://stackoverflow.com/q/12566732
has comment: http://stackoverflow.com/comment/40184761
favorite count: 0
has body: I'm trying to load custom c++ dll (using jni) to java, but i have a problem: my dll using cryptopp library, and when java tries to load depending (including cryptopp), the application quits with the message: Java Result: -1073741571 What is that, can i fix this without removing cryptopp? Update: If i commented files zCypto.h and zCypro.cpp, and deleted all usage of cryptopp library, it works without any errors, error has thrown if i load cryptopp. Java code: public static void main(String[] args){ System.loadLibrary("cryptopp"); System.loadLibrary("ZCPP_Code64"); } CPP Source (I make dll in Visual Studio 2012): #include "zCrypto.h" JNIEXPORT void JNICALL Java_ru_zontwelg_Loader_loadCache (JNIEnv *env, jobject jobj) { std::fstream stream; stream.open("C:\\testing_capturing\\enc.zwac", ios_base::binary | ios_base::in); // Other decode &amp; read stuff here ... stream.close(); } Header: /* DO NOT EDIT THIS FILE - it is machine generated */ #include &lt;jni.h&gt; /* Header for class ru_zontwelg_Loader */ #ifndef _Included_ru_zontwelg_Loader #define _Included_ru_zontwelg_Loader extern "C" { /* * Class: ru_zontwelg_Loader * Method: loadCache * Signature: ()V */ JNIEXPORT void JNICALL Java_ru_zontwelg_Loader_loadCache (JNIEnv *, jobject); } #endif zCrypto.h: #ifndef ZontWelg_zCrypto #define ZontWelg_zCrypto #include &lt;dll.h&gt; #include &lt;cstdio&gt; #include &lt;Windows.h&gt; #include &lt;iostream&gt; #include "cryptlib.h" using CryptoPP::Exception; #include "hex.h" using CryptoPP::HexEncoder; using CryptoPP::HexDecoder; #include "base64.h" using CryptoPP::Base64Encoder; using CryptoPP::Base64Decoder; #include "filters.h" using CryptoPP::StringSink; using CryptoPP::StringSource; using CryptoPP::StreamTransformationFilter; #include "sha.h" #include "rsa.h" #include "hex.h" #include "osrng.h" #include "secblock.h" #include "modes.h" #include "aes.h" using CryptoPP::AES; //#include "ccm.h" using CryptoPP::CBC_Mode; #pragma comment(lib, "cryptlib.lib") //#pragma comment(li…
linked to: http://stackoverflow.com/q/14022257

http://stackoverflow.com/comment/39920107
comment on: http://stackoverflow.com/q/25550955
type: QuestionComment
has text: Hi, Here table viewer is ExtendedGridTableViewer.From that we create a table Name and coloumn. table we are putting into composite...But the size always big while scrolling or maximising the form.
score: 0
type: Comment

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/25663258
type: Tag

abstract
tags question: http://stackoverflow.com/q/25595250
tag name: abstract
type: Tag

http://stackoverflow.com/comment/40029033
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25622108
has text: So the teamsList array shouldnt be in the Team class right but you are accessing it from the appPlayer which is in the Team class? I'm creating the instance within my main class

unmarshalling
tags question: http://stackoverflow.com/q/25682207
tag name: unmarshalling
type: Tag

http://stackoverflow.com/comment/40035168
score: 0
type: Comment
type: AnswerComment
has text: Thanks for the comment, I made the success handler exactly like you. And added <beans:bean id="authSuccessHandler" class="my.path.AuthSuccessHandler" /> in my security-context.xml file. But the code in the success handler is never called, any idea why that is?
comment on: http://stackoverflow.com/a/25624973

http://stackoverflow.com/comment/40185227
has text: It is ok. No need to be sorry. Just please post up some code what you have done so far thank you :)
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25708011
type: QuestionComment

http://stackoverflow.com/q/25602251
favorite count: 0
type: Question
has body: I would like to compare String arrays to a list with market objects. I implemented the code like that: private List&lt;Data&gt; addMarketData(List&lt;Data&gt; list) { String[] SEE = new String[]{"Albania", "Bosnia and Herzegovina", "Bulgaria", "Croatia", "Macedonia FYR", "Moldavia", "Montenegro", "Romania", "Serbia", "Slovenia" }; List&lt;String&gt; seeList = Arrays.asList(SEE); String[] CEE = new String[]{"Czech Republic", "Hungary", "Poland", "Slovakia"}; List&lt;String&gt; ceeList = Arrays.asList(CEE); for (int i = 0; i &lt; list.size(); i++) { for (int j = 0; j &lt; seeList.size(); j++) { if(list.get(i).getPropertyCountry().equals(seeList.get(j).toString())) { list.get(i).setMarket("SEE"); } } for (int k = 0; k &lt; ceeList.size(); k++) { if(list.get(i).getPropertyCountry().equals(ceeList.get(k).toString())) { list.get(i).setMarket("CEE"); } } } return list; } However, I believe that this code produces more overhead than it really should. Especially the for loops. Could I just use one loop? Therefore, how to make this piece of code much faster? I appreciate your answer!
accepted answer: http://stackoverflow.com/a/25602358
has comment: http://stackoverflow.com/comment/39992750
has answer: http://stackoverflow.com/a/25602358
tagged with: algorithm
score: 4
answer count: 4
has answer: http://stackoverflow.com/a/25602348
upvote count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25602347
has title: Fast way to compare String[] to List
has answer: http://stackoverflow.com/a/25602373
tagged with: java
has answer: http://stackoverflow.com/a/25602347
downvote count: 0
linked to: http://stackoverflow.com/q/383947
has comment: http://stackoverflow.com/comment/39992877

http://stackoverflow.com/q/25636562
tagged with: hadoop
score: 0
has answer: http://stackoverflow.com/a/74869460
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/46783720
has title: Error running Storm with Redis: java.lang.NoClassDefFoundError: Lredis/clients/jedis/Jedis
has answer: http://stackoverflow.com/a/25641054
tagged with: linux
tagged with: redis
answer count: 5
tagged with: java
linked to: http://stackoverflow.com/q/882204
has answer: http://stackoverflow.com/a/25637167
has body: My Storm class uses Redis queue to collect data. I tried to run my Storm jar by storm jar jar_file_name.jar Topology_name configuration_file But I got the following exception: Exception in thread "main" java.lang.NoClassDefFoundError: Lredis/clients/jedis/Jedis; at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2397) at java.lang.Class.getDeclaredField(Class.java:1946) at java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1659) at java.io.ObjectStreamClass.access$700(ObjectStreamClass.java:72) at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:480) at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:468) at java.security.AccessController.doPrivileged(Native Method) at java.io.ObjectStreamClass.&lt;init&gt;(ObjectStreamClass.java:468) at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:365) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1133) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) at backtype.storm.utils.Utils.serialize(Utils.java:77) at backtype.storm.topology.TopologyBuilder.createTopology(TopologyBuilder.java:111) at OutlierPredictor.main(OutlierPredictor.java:98) Caused by: java.lang.ClassNotFoundException: redis.clients.jedis.Jedis at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) I have compiled using javac -classpath $HADOOP_CORE:$HBASE_CLASSPATH:/usr/local/hadoop- 2.2.0/redis_jar/commons-pool-1.5.5.jar:/usr/local/hadoop-2.2.0/redis_jar/jedis-2.1.0.jar:/usr/local/apache-storm-0.9.2-incubating/lib/storm-core-0.9.2-incubating.jar -d dir_name/ dir_name/Javafil…
has comment: http://stackoverflow.com/comment/40057662
tagged with: apache-storm
linked to: http://stackoverflow.com/q/81260
type: Question
has answer: http://stackoverflow.com/a/55076142

http://stackoverflow.com/q/25630202
upvote count: 4
type: AnsweredQuestion
has body: I'm trying to download images from url but got java.io.IOException: exception. My code is: public static void main(String[] args) throws MalformedURLException, IOException { File picutreFile = new File("test.jpg"); FileUtils.copyURLToFile(new java.net.URL("http://paceoil.ca/files/includes/images/images-stories-presentation-october-icon-graphic.jpg"), picutreFile); } When run threw : Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: http://paceoil.ca/files/includes/images/images-stories-presentation-october-icon-graphic.jpg at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.URL.openStream(Unknown Source) at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1460) at com.hrant.Test.main(Test.java:14) This code works for some urls but for this I couldnt understand why not. Advance many Thanks.
answer count: 3
has answer: http://stackoverflow.com/a/25630383
has comment: http://stackoverflow.com/comment/40044474
has answer: http://stackoverflow.com/a/25630416
downvote count: 0
accepted answer: http://stackoverflow.com/a/25630400
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40044339
has answer: http://stackoverflow.com/a/25630400
possible better answer: http://stackoverflow.com/a/25630383
has title: Couldn't download image
tagged with: java
score: 4
linked to: http://stackoverflow.com/q/12732422
has comment: http://stackoverflow.com/comment/40044224

http://stackoverflow.com/comment/40091788
comment on: http://stackoverflow.com/q/25656284
score: 0
type: Comment
type: QuestionComment
has text: @ScaryWombat I don't have sufficient reputation to post the image for better explanation of question so I am afraid to cut down the code .

http://stackoverflow.com/q/25570889
has answer: http://stackoverflow.com/a/25571314
has comment: http://stackoverflow.com/comment/39935536
score: 0
has comment: http://stackoverflow.com/comment/39935608
has title: Casting Parameterized type class argument into sub-class form when extracting the value of the Parameterized Type
tagged with: java
tagged with: generics
type: Question
has body: How can I cast the Parameterized type class argument into its sub-class form? I've read a lot of examples and problems regarding with extracting the value of the type parameter, that you should have an interface or abstract class where you should extend from. Consider the codes below type = (Class&lt;T&gt;) ((ParameterizedType)(getClass().getGenericSuperclass())).getActualTypeArguments()[0]; using the above code, you can cast the "type" variable into something what (Class&lt;T>) represents. Assuming &lt;T> is a Person.class Below is the complete implementation, where Person class is the value being passed into the generic super class type parameter argument. When I create an instance of the generic subclass and I pass a subclass of Person type parameter argument, its always being casted into a Person. the type == Student.class prints false or even if I print the type, its always printing Person instead of Student. How can i achieve this? is the thing that I want even possible? Generic Sub class public class GenericSubClass&lt;T extends Person&gt; extends GenericAbstractSuper&lt;Person&gt; { public Class&lt;T&gt; type; @SuppressWarnings("unchecked") public GenericSubClass() { type = (Class&lt;T&gt;) ((ParameterizedType) (getClass().getGenericSuperclass())).getActualTypeArguments()[0]; System.out.println(type.getSimpleName()); System.out.println(type == Student.class); } public static void main(String[] args) { GenericSubClass&lt;Student&gt; genStud = new GenericSubClass&lt;Student&gt;(); // GenericSubClass&lt;Employee&gt; genEmp = new GenericSubClass&lt;Employee&gt;(); // GenericSubClass&lt;Person&gt; genPer = new GenericSubClass&lt;Person&gt;(); } } Generic Super Abstract class public abstract class GenericAbstractSuper&lt;T&gt; { } Please I really need some help. I cant find a similar issue around.
tagged with: parameterized-types
tagged with: casting
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39936003
answer count: 1
tagged with: inheritance
has comment: http://stackoverflow.com/comment/39935880

http://stackoverflow.com/comment/40072651
comment on: http://stackoverflow.com/q/25646196
type: QuestionComment
score: 0
has text: If you didn't find your main problem and you didn't post your code, what do you expect strangers on the Internet will do for you?
type: Comment

http://stackoverflow.com/a/25703595
type: Answer
has comment: http://stackoverflow.com/comment/40177312
has body: You are not passing the record id to the jsp page from your method. Your getItemFromdb() should be some thing like this public List&lt;ItemBean&gt; getItemFromdb(LoginBean user) throws SQLException { // whatever you are doing comes here while (rs.next()) { ItemBean item = new ItemBean(); item.setId(rs.getInt("id"); // you need to have this, here id is the the primary key of the table item.setItemName(rs.getString("itemname")); item.setItemPrice(rs.getDouble("itemprice")); item.setTransactionTime(rs.getString("transactiontime")); // item.setUserid(rs.getInt("userid")); item.setEmail(rs.getString("email")); itemList.add(item); } // rest of the code } so that in the jsp page you can use this id to identify the record do whatever operation you want to do
score: 0
has comment: http://stackoverflow.com/comment/40177376
has comment: http://stackoverflow.com/comment/40177660
has comment: http://stackoverflow.com/comment/40177551
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25702939
has comment: http://stackoverflow.com/comment/40177445
has comment: http://stackoverflow.com/comment/40177727
accepted answer of: http://stackoverflow.com/q/25702939
has comment: http://stackoverflow.com/comment/40190433

http://stackoverflow.com/comment/40027436
score: 0
comment on: http://stackoverflow.com/q/25570731
type: Comment
type: QuestionComment
has text: @Jens: yes indeed, if you open the XLSX as archive there is total mismatch of folders and a folder named theme is also missing for a table. So it is maybe Microsoft constantly changing the file format internally or Apache POI needs to adopt with new table formats in office 2010, 2013, etc. Will see if I can add some comments to the existing thread discussion there. Thanks though.

gargoyle
type: Tag
tags question: http://stackoverflow.com/q/25624845
tag name: gargoyle

http://stackoverflow.com/comment/39997799
comment on: http://stackoverflow.com/a/25598421
has text: Under ListSelectionModel SM = table1A.getSelectionModel();
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39990000
type: Comment
has text: C. M. Sperberg-McQueen, thanks for the quite elaborate explanation. However, as I see it - the only way for me to avoid this is to go with XSD 1.1. The thing is that I'm pretty much bound to the existing schemas as what I've presented is an extract from another standard that I'm to follow - the EPCIS standard 1.0.1 (http://www.gs1.org/gsmp/kc/epcglobal/epcis/epcis_1_0_1-standard-20070921.pdf) - section 9.1. As far as I can see - the presented schemas reflects what is required when extending the standard. However, it seems more like a tooling problem to me (XJC being the sinner)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25570128

http://stackoverflow.com/comment/40015081
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25608996
has text: Upvoted for all that work untangling and neatening Ankur's code before locating the flaw. Programmers learn most from good code examples.

http://stackoverflow.com/a/25676584
score: 3
downvote count: 1
type: Answer
has body: You have an extra ; after your if test, so the return true; statement is not in the if block, causing a syntax error with the else block below.
answers question: http://stackoverflow.com/q/25676555
upvote count: 4

http://stackoverflow.com/comment/40156920
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25692372
has text: @AleksG I think you mean the Android SparseArray?

http://stackoverflow.com/a/25635244
downvote count: 0
has body: BufferStrategy doesn't play well with Swing, as you've taken control of the painting process Canvas can't be transparent, so it will hide anything beneath it... When you use frame.add(game) you are replaceing what ever use to be at BorderLayout.CENTER Instead of mixing lightweight (Swing) and heavy weight (AWT) components, paint the background image as part of your render process public void render() { BufferStrategy bs = this.getBufferStrategy(); if(bs == null) { createBufferStrategy(3); //Use 5 at most return; } Graphics g = bs.getDrawGraphics(); //RENDER HERE // Paint background here... player.render(g); healthBars.render(g); //END RENDER g.dispose(); bs.show(); }
answers question: http://stackoverflow.com/q/25635204
has comment: http://stackoverflow.com/comment/40053336
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25635204
type: AcceptedAnswer

http://stackoverflow.com/comment/39904791
score: 0
comment on: http://stackoverflow.com/q/25552890
has text: It sounds like you're doing all the right things. When you export, are you using your own key? Does the Eclipse Error log show anything? Is an .apk file actually exported?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25694702
answer count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25695007
has title: threads are not being notified in java
tagged with: java
score: -1
type: Question
has body: In this code two threads are running, I am putting both the threads on wait when button is clicked 1st time, when the button is clicked 2nd time I am notifying both the threads but they are not being notified please help. import java.awt.Color; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingWorker; public class Main implements ActionListener { JButton button = new JButton("Click"); JFrame frame = new JFrame(); boolean wait=false; Counter c[] = new Counter[2]; public static void main(String arg[]) { new Main(); } public Main() { frame.setLayout(new FlowLayout()); frame.getContentPane().setBackground(Color.BLACK); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); button.addActionListener(this); frame.add(button); frame.setVisible(true); c[0]=new Counter(); c[0].execute(); c[1]=new Counter(); c[1].execute(); } public class Counter extends SwingWorker&lt;Void, Void&gt; { JLabel label = new JLabel(); public Counter() { label.setForeground(Color.WHITE); frame.add(label); } public Void doInBackground() { synchronized (this) { for(int i=0; i!=-1; i++) { if(wait==true) try {this.wait();} catch(Exception exp) {exp.printStackTrace();} label.setText(""+i); try {Thread.sleep(200);} catch (InterruptedException e) {e.printStackTrace();} } } return null; } } public void actionPerformed(ActionEvent clicked) { if(wait==false) wait=true; else if(wait==true) { synchronized (c) { c.notifyAll(); } wait=false; } } }
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/39914956
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25560241
type: QuestionComment
has text: please show your json (if not too large)

http://stackoverflow.com/q/25590953
downvote count: 2
has answer: http://stackoverflow.com/a/25591177
tagged with: cryptography
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39972179
tagged with: client-server
type: Question
has comment: http://stackoverflow.com/comment/39972536
tagged with: encryption
has body: i m working on java client server aes encryption which server encrypt and client decrypt.However i having the padding error maybe for the byte[] and string..i cant solve it..anyone can tell me what to change to solve the encryption and decryption problem? SERVER public void run(){ try { String key1 = "1234567812345678"; byte[] key2 = key1.getBytes(); SecretKeySpec secret = new SecretKeySpec(key2, "AES"); String msg = "Singapore Malaysia Japan India"; Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, secret); byte[] encrypted = cipher.doFinal(msg.getBytes()); in = new DataInputStream(incoming.getInputStream()); out = new DataOutputStream(incoming.getOutputStream()); boolean done = false; String str=""; out.writeUTF("Connected!\n"); out.flush(); while (!done){ out.writeUTF("&gt;"); out.flush(); str = in.readUTF(); System.out.println(in+":"+str); if (str == null) done = true; else{ System.out.println("Sending Ciphertext : " + new String(encrypted)); out.writeUTF(new String(encrypted)); out.flush(); CLIENT String str = ""; String str2 = ""; DataOutputStream out; DataInputStream in; try { Socket t = new Socket("127.0.0.1", 9003); in = new DataInputStream(t.getInputStream()); out = new DataOutputStream(t.getOutputStream()); BufferedReader br = new BufferedReader (new InputStreamReader(System.in)); boolean more = true; System.out.println(in.readUTF()); while (more) { str = in.readUTF(); System.out.print(str); str2 = br.readLine(); out.writeUTF(str2); out.flush(); str = in.readUTF(); System.out.println("Encrypted Info: " + str); try { String key1 = "1234567812345678"; byte[] key2 = key1.getBytes(); SecretKeySpec secret = new SecretKeySpec(key2, "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, secret); byte[] decrypted = cipher.doFinal(str.getBytes()); System.out.println("Decrypted Info: " + new String(decrypted)); }
type: UnansweredQuestion
score: -2
has title: Suggestion on input length must be multiple of 16 when decrypting with padded cipher
tagged with: aes
upvote count: 0
tagged with: java

http://stackoverflow.com/a/25619869
has comment: http://stackoverflow.com/comment/40026666
type: Answer
has comment: http://stackoverflow.com/comment/40025182
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25597213
has comment: http://stackoverflow.com/comment/40026781
has comment: http://stackoverflow.com/comment/40029732
has comment: http://stackoverflow.com/comment/40029990
has body: Yes, it's possible. You can pass a data source from your code, as this blog post shows.

http://stackoverflow.com/q/25686563
has comment: http://stackoverflow.com/comment/40145498
has comment: http://stackoverflow.com/comment/40164195
tagged with: android
has comment: http://stackoverflow.com/comment/40145573
score: 0
has answer: http://stackoverflow.com/a/25687245
has comment: http://stackoverflow.com/comment/40145588
answer count: 2
has comment: http://stackoverflow.com/comment/40164158
has comment: http://stackoverflow.com/comment/40145396
has comment: http://stackoverflow.com/comment/40164168
tagged with: java
has comment: http://stackoverflow.com/comment/40164154
has answer: http://stackoverflow.com/a/25686784
has body: I am not sure why I cannot create a new application. I go to file > New > Android Application Project. After entering in everything correctly, neither the 'Next' nor the 'Finish' button light up and I am just stuck here for hours.
upvote count: 1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40146699
has title: Can't create New Android Application in Java Eclipse
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40145377
has comment: http://stackoverflow.com/comment/40146674
has comment: http://stackoverflow.com/comment/40148605
type: UnansweredQuestion

http://stackoverflow.com/q/25679922
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40133797
tagged with: linux
type: Question
has comment: http://stackoverflow.com/comment/40136668
type: UnansweredQuestion
has title: Try to execute two shell scripts one after another by using java code
score: -2
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/40134570
has body: Which is the code i was used. ssh.sh: #!/bin/sh ssh root@192.168.1.6 ssh1.sh: #!/bin/sh ifconfig Code public static void main(String[] args) { Process p,p1; String s=null,s1=null; try { p = Runtime.getRuntime().exec("/home/test/Desktop/selenium/ssh.sh"); Thread.sleep(2500); p1 = Runtime.getRuntime().exec("/home/test/Desktop/selenium/ssh1.sh"); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader br1 = new BufferedReader(new InputStreamReader(p1.getInputStream())); while ((s = br.readLine()) != null){ System.out.println(s); } while ((s1 = br1.readLine())!=null) { System.out.println(s1); } p.waitFor(); p1.waitFor(); System.out.println ("exit: " + p.exitValue()); System.out.println ("exit: " + p1.exitValue()); p.destroy(); p1.destroy(); } catch (Exception e) {} } But it was executing ssh.sh only
upvote count: 0
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/25680674
has comment: http://stackoverflow.com/comment/40133878
has comment: http://stackoverflow.com/comment/40134943

http://stackoverflow.com/q/25680668
type: Question
answer count: 2
has title: Java - Formatting Strings in an ArrayList
has answer: http://stackoverflow.com/a/25682261
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40135443
has comment: http://stackoverflow.com/comment/40134989
downvote count: 2
has comment: http://stackoverflow.com/comment/40135001
has comment: http://stackoverflow.com/comment/40135466
score: -2
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40135694
has comment: http://stackoverflow.com/comment/40135591
has body: I have an ArrayList that contains elements in the following format: 1. 11111 "Top Secret Twenty One - Janet Evanovich" $8.99 1 0% $8.99 What would be the best way to format each element in the ArrayList to make it look as follows: 11111, "Top Secret Twenty One - Janet Evanovich", 8.99, 1, 0.0, 8.99 I'm basically looping through the ArrayList and placing it in an output file. How can I format it in this loop? BufferedWriter bw = new BufferedWriter(file); for(int i = 0; i&lt;items.size(); i++){ bw.append(items.get(i).toString()); }
tagged with: java
has comment: http://stackoverflow.com/comment/40135493
has answer: http://stackoverflow.com/a/25681340
tagged with: formatting
has comment: http://stackoverflow.com/comment/40135328
has comment: http://stackoverflow.com/comment/40135069
favorite count: 0

http://stackoverflow.com/a/25570571
answers question: http://stackoverflow.com/q/25570425
has body: This will work: import java.text.DecimalFormat; public class Test { public static void main(String[] args) { double d = (106108048) / (double)10; System.out.println(d); System.out.println(new DecimalFormat("#.#").format(d)); } }
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/25577327
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39947761
has comment: http://stackoverflow.com/comment/39954280
tagged with: rotation
has title: Camera rotation issue Libgdx
tagged with: libgdx
has comment: http://stackoverflow.com/comment/39954248
answer count: 0
has comment: http://stackoverflow.com/comment/39947729
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39953261
has body: I have a OrthographicCamera and I want to rotate 90° it, but when I rotate it seems to be shifted more to the right. Before rotation: http://postimg.org/image/4ojldia8t/ After rotation:http://postimg.org/image/dul66z2rv/ The setting up of the camera is this: In the create method: //map is an object of my personal class that wraps tiledmap class this.renderer=new OrthogonalTiledMapRenderer(this.map.getMap()); this.camera=new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); this.camera.translate(mappa.getMapPixelWidth()/2, mappa.getMapPixelHeight()/2); this.camera.update(); view=new StretchViewport(map.getMapPixelWidth(),map.getMapPixelHeight(), camera); flag=false; In the render method: if(!flag) { flag=true; camera.rotate(90); } this.renderer.setView(this.camera); this.renderer.render(); this.camera.position.y+=1; this.camera.update(); Is that wrong? thanks for your time
type: Question
tagged with: camera
has comment: http://stackoverflow.com/comment/40057250
score: 0

http://stackoverflow.com/a/25553281
score: 0
has comment: http://stackoverflow.com/comment/39997807
has body: You can create a new class implementing Runnable. public class MyTask implements Runnable { public void run() { //do something } } Then you can schedule it using Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new MyTask(), 60, 100); if you want to schedule the task from other class like EventHandler you may write a grtInstance() method in your main class or you can use Bukkit.getPluginManager().getPlugin("yourplugin") to retrieve your plugin main class instance.
answers question: http://stackoverflow.com/q/25550960
has comment: http://stackoverflow.com/comment/40146990
type: Answer
has comment: http://stackoverflow.com/comment/39923258
has comment: http://stackoverflow.com/comment/39906303
has comment: http://stackoverflow.com/comment/39914058

http://stackoverflow.com/a/25565841
has comment: http://stackoverflow.com/comment/39931779
has comment: http://stackoverflow.com/comment/39925573
answers question: http://stackoverflow.com/q/25565707
has comment: http://stackoverflow.com/comment/39925242
has comment: http://stackoverflow.com/comment/39925265
score: 0
has body: t.start() makes a native call to actually execute the run() method in a new thread. t.run() merely executes the run() in the current thread. Now, On a side note, I am aware that it makes perfect OO sense to implement the Runnable interface than to extend the Thread class Actually, it makes perfect OO sense to follow either approaches (implementing Runnable or extending Thread). It is not that one is bad in OO sense. The advantage that you get by implementing Runnable is that you can make your class extend another class (which might actually break your OO design.)
type: Answer
has comment: http://stackoverflow.com/comment/39925225

http://stackoverflow.com/q/25586490
tagged with: apache
has title: Removing app name from url in proxypassreverse setup
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/39963871
tagged with: tomcat
has answer: http://stackoverflow.com/a/25588839
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/39963938
has body: I have been able to map my application to the domain in a manner I found after doing some research (copy-paste) on internet. &lt;VirtualHost *:80&gt; ServerName example.com ProxyPass /MyApp http://localhost:8080/MyApp ProxyPassReverse /MyApp http://localhost:8080/MyApp ProxyPassReverseCookieDomain localhost example.com ProxyPreserveHost On RewriteEngine on RewriteRule ^/$ http://example.com/MyApp &lt;/VirtualHost&gt; The rewrite works fine and whenever I open example.com it redirects to example.com/MyApp . My query is, how can I make it not redirect and deliver the MyApp at example.com/ without any redirect. Just plain simple mapping of the MyApp to the root of the domain. The rewrite works fine, but certainly don't want app name in url.
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39963851
type: Question
type: UnansweredQuestion

http://stackoverflow.com/q/25621835
has comment: http://stackoverflow.com/comment/40028588
has comment: http://stackoverflow.com/comment/40028677
tagged with: java
has comment: http://stackoverflow.com/comment/40029499
has title: Drive Explorer Using JTree
has comment: http://stackoverflow.com/comment/40028427
downvote count: 1
favorite count: 0
type: Question
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40028625
tagged with: swing
score: -1
accepted answer: http://stackoverflow.com/a/25628096
has body: I want to create a Drive explorer with jcheckbox selection which will display all drives, folders and files of a computer using JTree just like as windows file explorer: This much I have done: public class NewJFrame extends javax.swing.JFrame { DefaultMutableTreeNode nodes; public NewJFrame() { nodes = new DefaultMutableTreeNode("Root", true); addRoots(nodes); initComponents(); jTree1.setRootVisible(false); } public void addRoots(DefaultMutableTreeNode parent){ File roots[] = File.listRoots(); for(File root: roots){ DefaultMutableTreeNode child = new DefaultMutableTreeNode(root); child.add(new DefaultMutableTreeNode("test")); parent.add(child); } } private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jTree1 = new javax.swing.JTree(nodes); //....... //....... } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25628096

http://stackoverflow.com/comment/39931123
has text: @user1965834 Use the mac terminal, it defaults to running bash. See http://en.wikipedia.org/wiki/Terminal_%28OS_X%29
comment on: http://stackoverflow.com/a/25551720
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25630361
has title: Eclipse Android java.lang.NoClassDefFoundError
linked to: http://stackoverflow.com/q/22526925
linked to: http://stackoverflow.com/q/34413
has comment: http://stackoverflow.com/comment/134480238
duplicate of: http://stackoverflow.com/q/22526925
answer count: 0
score: 1
tagged with: android
tagged with: java
has body: I'm trying to do the Android tutorial on the Android developer site (here). I installed the Eclpise/Android SDK bundle on the site, but when I try to run the autogenerated code, which is supposed to just display "Hello World," I get a java.lang.NoClassDefFoundError. I haven't written any code myself yet. Here's the logcat log of the error: 09-02 17:44:15.430: D/dalvikvm(872): Not late-enabling CheckJNI (already on) 09-02 17:44:15.780: W/dalvikvm(872): VFY: unable to resolve static field 1864 (ActionBarWindow) in Landroid/support/v7/appcompat/R$styleable; 09-02 17:44:15.780: D/dalvikvm(872): VFY: replacing opcode 0x62 at 0x0004 09-02 17:44:15.790: D/AndroidRuntime(872): Shutting down VM 09-02 17:44:15.790: W/dalvikvm(872): threadid=1: thread exiting with uncaught exception (group=0xb2a99d70) 09-02 17:44:15.800: E/AndroidRuntime(872): FATAL EXCEPTION: main 09-02 17:44:15.800: E/AndroidRuntime(872): Process: com.example.test1, PID: 872 09-02 17:44:15.800: E/AndroidRuntime(872): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable 09-02 17:44:15.800: E/AndroidRuntime(872): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:106) 09-02 17:44:15.800: E/AndroidRuntime(872): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:57) 09-02 17:44:15.800: E/AndroidRuntime(872): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:99) 09-02 17:44:15.800: E/AndroidRuntime(872): at com.example.test1.MainActivity.onCreate(MainActivity.java:13) 09-02 17:44:15.800: E/AndroidRuntime(872): at android.app.Activity.performCreate(Activity.java:5242) 09-02 17:44:15.800: E/AndroidRuntime(872): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 09-02 17:44:15.800: E/AndroidRuntime(872): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161) 09-02 17:44:15.800: E/AndroidRuntime(872): at android.app.ActivityThread.hand…
has comment: http://stackoverflow.com/comment/40044902
duplicate of: http://stackoverflow.com/q/21591169
tagged with: eclipse
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/21591169
type: UnansweredQuestion
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39928805
type: Comment
type: AnswerComment
has text: @Charl Du Plessis, follow this answer and your problems solved.
comment on: http://stackoverflow.com/a/25567614
score: 0

http://stackoverflow.com/q/25568496
accepted answer: http://stackoverflow.com/a/25568723
answer count: 2
has title: Java Generic Type syntax
has answer: http://stackoverflow.com/a/25568723
downvote count: 0
has comment: http://stackoverflow.com/comment/39930132
upvote count: 1
type: AnsweredQuestion
has body: &lt;D extends com.j256.ormlite.dao.Dao&lt;T,?&gt;,T&gt; D getDao(Class&lt;T&gt; clazz) I am not able to understand above statement getDao(Class clazz) returns D D having following constraints D extends com.j256.ormlite.dao.Dao&lt;T,?&gt; and extra ,T i am not able to understand. Could you please explain it ?
tagged with: syntax
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25568538
tagged with: generics
has answer: http://stackoverflow.com/a/25568538
favorite count: 0
type: Question

http://stackoverflow.com/a/25597342
upvote count: 4
answers question: http://stackoverflow.com/q/25596471
type: Answer
has body: For-comprehensions are always slower then using a while loop or tail recursion as explained here. The other problem in your example is the concatenation of the Strings. Scala will use the scala.collection.mutable.StringBuilder which has some performance issues (e.g. it will box your chars to Char instances) as mentioned in the other answers. Changing the for-comprehension to a tail-recursive method and using java.lang.StringBuilder you will get mostly the same results in both Scala and Java (on my machine Scala is actually a few milliseconds faster).
score: 4
downvote count: 0

http://stackoverflow.com/a/25644672
upvote count: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40071223
score: 2
answers question: http://stackoverflow.com/q/25640080
has body: Thanks for your replies. The following code is better because uses the java 8 js engine instead of rhino from previous java versions: double[] output = {}; try { ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("nashorn"); String locationTemp = "D:/test.js"; engine.eval("load(\"" + locationTemp + "\");"); Invocable invocable = (Invocable) engine; ScriptObjectMirror obj = (ScriptObjectMirror) invocable.invokeFunction("avg", input, period); Collection&lt;Object&gt; values = obj.values(); if (values.size() == 0) { return output; } output = new double[values.size()]; int i = 0; for (Iterator&lt;Object&gt; iterator = values.iterator(); iterator.hasNext();) { Object value = iterator.next(); if (value instanceof Double) { Double object = (Double) iterator.next(); output[i] = object; } } } catch (NullPointerException | NoSuchMethodException | ScriptException ex) { log.error(ex.getLocalizedMessage()); } Thanks ninad for his quickly answer Best Regards, Aurelian,
has comment: http://stackoverflow.com/comment/40070786

http://stackoverflow.com/a/25612972
answers question: http://stackoverflow.com/q/25612898
type: Answer
has comment: http://stackoverflow.com/comment/40012259
has body: Your refactoring is incorrect; each -step variable does not depend on any of the others (note that each assignment to temp from a date.get overwrites what was there before). Also makes it clear that all of the assignments except the last, and all of the multiplications by 100, are useless. This refactoring makes it clear that these values are independent, and could be assigned in any order (even in parallel, if that were allowed).
score: 0

http://stackoverflow.com/comment/40094684
type: AnswerComment
has text: Thanks @Jigar Joshi for you answer.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25657963

http://stackoverflow.com/q/25705860
has title: Using convention plugin with struts.xml
tagged with: java
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25708453
downvote count: 1
tagged with: struts2-convention-plugin
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40214765
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3029376
accepted answer: http://stackoverflow.com/a/25708453
has body: I'm using convention plugin in my project and everything was fine until I needed to add a custom interceptor. To add a custom interceptor I need to have struts.xml in my project. But when I add struts.xml, it gives me 404 error for every page. I have tried this solution but it doesn't seem to work.
tagged with: struts2
tagged with: http://stackoverflow.com/tag/xml
score: 0

http://stackoverflow.com/a/25621764
upvote count: 2
has body: You already added the logo to the panel, yet you try and add the logo again to the content pane (Same with the title). The first add to the panel is negated, Which is bad because you need the FlowLayout to keep the position. Each component can only have one parent. Don't add the logo to the content pane. Just add the panel, and make the panel's layout new FlowLayout(FlowLayut.LEADING). That will put the label to the very left of the panel. Then you can add an empty border for the label to add spacing to the label import java.awt.BorderLayout; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Font; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class ProgDraftMain { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run() { ProgDraft gui = new ProgDraft(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setResizable(false); gui.setSize(500 , 300); gui.setVisible(true); } }); } } class ProgDraft extends JFrame { private ImageIcon image1; private JLabel label1; ProgDraft() { JPanel panel = new JPanel(); panel.setLayout(new FlowLayout(FlowLayout.LEADING)); ImageIcon pics = new ImageIcon(getClass().getResource("stackoverflow.png")); JLabel logo = new JLabel(pics); logo.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0)); panel.add(logo); panel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); JLabel title = new JLabel("Testing Title", JLabel.CENTER); Font font = new Font("impact", Font.PLAIN, 30); title.setFont(font); getContentPane().setLayout(new BorderLayout()); getContentPane().add(panel, BorderLayout.CENTER); getContentPane().add(title, BorderLayout.PAGE_START); } } Learn to use the different layout managers. Don't try to depend on pixel perfect position. See Laying out Components Within a Container Also have a look at How to Use Borders
has comment: http://stackoverflow.com/comment/40029223
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25621312
score: 2
accepted answer of: http://stackoverflow.com/q/25621312
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40153659
type: Comment
has text: Thanks for the detailed answer! As Simone posted in a previous response, getLocalPort() was the one of interest for me.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25690800

http://stackoverflow.com/q/25661230
has body: My question is if it's right to create an inner class only because I need to access from this class to one of the outer instance variable. But the real problem is "It's right to use this inner class also as an instance variable of the same outer class?". In my specific case, I have the outer class called Exam and should have a result associated but the result (it will be a String or a Double) depends on the ExamType (that's is a Exam instance variable). So I am not sure if the best practise is: to create an isolated Result class receiving as constructor input the ExamType to create a inner Result class that could easily access to the Exam instance variable (in particular ExamType variable) and instantiate it as a instance variable of the Exam class.
favorite count: 0
type: Question
tagged with: inner-classes
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25661344
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40100133
has comment: http://stackoverflow.com/comment/40100058
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40100244
has title: It is necessary to create an inner class, using it as a instance variable of the outer class?

http://stackoverflow.com/comment/40179285
has text: Hint: What is this->next->prev? (Oops! Java, I forgot) What is this.next.prev?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25704654

http://stackoverflow.com/comment/40183443
comment on: http://stackoverflow.com/a/25693463
score: 0
type: Comment
has text: even after removing the bracket i am getting the same error in eclipse.i validated the schema in http://jsonlint.com/, there it is showin valid without removing the brackets.but if remove brackets then it is showin as parse error.please help.
type: AnswerComment

http://stackoverflow.com/a/25701184
has body: If the method returns an int, 1/n + harmonicOf(n-1) is evaluated as an int. This means that 1/n would be zero for each n &gt; 1. That's why 1 is returned. If the method returns float or double, 1/n + harmonicOf(n-1) is evaluated as float or double (based on the return type of harmonicOf(n-1)). That's why 1/n is also evaluated as float or double, and can be non zero.
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25701145

http://stackoverflow.com/q/25644812
tagged with: arraylist
downvote count: 4
upvote count: 0
tagged with: java
answer count: 3
has title: JAVA: BMI Calculator using
has answer: http://stackoverflow.com/a/25644949
has body: I am very new to java trying to build a simple BMI calculator using a constructor, a public instance method and a toString method. public class BMI { public BMI(String name, double height, double weight){ } public String getBMI() { return (weight/height); } public String toString() { return name + "is" + height + "tall and is " + weight + "and has a BMI of" + getBMI() ; } public static void main(String[] args) { } i don't really know what i'm doing, so all help is appreciated. If you know how to complete this and can show me a main method which can demonstrate how to use it that would be even more appreciated. thanks :)
favorite count: 0
has answer: http://stackoverflow.com/a/25645099
type: Question
tagged with: double
has comment: http://stackoverflow.com/comment/40070246
type: UnansweredQuestion
score: -4
has answer: http://stackoverflow.com/a/25644845

http://stackoverflow.com/a/25667086
answers question: http://stackoverflow.com/q/25664452
has comment: http://stackoverflow.com/comment/40133603
type: Answer
has comment: http://stackoverflow.com/comment/40138545
score: 0
has comment: http://stackoverflow.com/comment/40137390
has body: In both the table hbm mapping you should have same no. of column ,what you are using to make composite.You need to add these 3 column in TEST_Oder. Example to follow : &lt;many-to-one name="orderLine" class="OrderLine"&gt; &lt;column name="lineId"/&gt; &lt;column name="orderId"/&gt; &lt;column name="customerId"/&gt; &lt;/many-to-one&gt; Refer same URL

http://stackoverflow.com/q/25622858
downvote count: 0
tagged with: jax-rs
has answer: http://stackoverflow.com/a/25627314
has comment: http://stackoverflow.com/comment/40032885
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/40031055
accepted answer: http://stackoverflow.com/a/25629409
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/25627314
has answer: http://stackoverflow.com/a/25629409
has body: I'm having an example code: @PUT public String method(@FormParam("firstName") String firstName, @FormParam("lastName") String lastName ) { Person person = new Person(firstName, lastName); // ... } I would like to stop using @FormParams and use Person instead: @PUT public String method(@Person person) { // ... } What would be the best way to do it? I'm experimenting with a custom BodyReader but than I have to "manually" parse the InputStream in readFrom method. Is that the right way to do it and if yes what is the best way to transform the InputStream into KEY => VALUE HashMap?
favorite count: 0
type: Question
has title: Using a custom object instead of @FormParam as JAX-RS resource input
has comment: http://stackoverflow.com/comment/40031522
answer count: 2
has comment: http://stackoverflow.com/comment/40042577
has comment: http://stackoverflow.com/comment/40030767
tagged with: jersey

http://stackoverflow.com/comment/40136825
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25681531
has text: According to [the docs](http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html) it doesn't look like there is one

http://stackoverflow.com/comment/40030275
comment on: http://stackoverflow.com/q/25622515
type: Comment
type: QuestionComment
has text: Can you log the `newValue` string, and post some examples of values that get opened by the Windows file manager?
score: 0

parallel-processing
tags question: http://stackoverflow.com/q/25675890
type: Tag
tag name: parallel-processing
tags question: http://stackoverflow.com/q/25593699
tags question: http://stackoverflow.com/q/25711616
tags question: http://stackoverflow.com/q/25706234
tags question: http://stackoverflow.com/q/25691084
tags question: http://stackoverflow.com/q/25597457
tags question: http://stackoverflow.com/q/25679780

http://stackoverflow.com/a/25700780
type: Answer
has body: Try this: String str = "34,56,78,32,45"; String[] parts = str.split(","); for (int i = 0; i &lt; parts.length; i++) { int no=Interger.parse(parts[i]); //Do your stuff here }
score: 0
answers question: http://stackoverflow.com/q/25700696

http://stackoverflow.com/q/25584508
score: 0
tagged with: java
has title: OnItemListener for Spinner without a button
answer count: 1
tagged with: spinner
tagged with: onitemselectedlistener
type: Question
has body: my question is the following: I have a StartActivity, where the user can find a spinner and can choose from a list of options I have in an array. I want that the user can choose and then it jumps to another acitivity, for example the user chooses "Wien Simmering" and then the Simmering.java opens. package at.co.ccc.mondel; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.Toast; import android.os.Bundle; public class StartingPoint extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Spinner spinner = (Spinner) findViewById(R.id.comboCasino); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.comboCasino, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // action with ID action_refresh was selected case R.id.action_refresh: Toast.makeText(this, R.string.refreshed, Toast.LENGTH_SHORT).show(); break; // action with ID action_settings was selected case R.id.action_settings: Toast.makeText(this, R.string.settings_clicked, Toast.LENGTH_SHORT).show(); break; default: break; } return true; } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.starting_point, menu); return true; } } And here is the strings xml: Wien Simmering Wien Lugner City Gmunden Salzburg Linz Saalbach Innsbruck Reutte Bregenz Kufstein Bratislava
accepted answer: http://stackoverflow.com/a/25584539
has answer: http://stackoverflow.com/a/25584539
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/q/25595395
has answer: http://stackoverflow.com/a/25595413
type: Question
has answer: http://stackoverflow.com/a/25595441
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25595701
upvote count: 1
score: 1
tagged with: methods
has title: Method to get the sum of an ArrayList
favorite count: 0
has body: I am getting the totals of various String ArrayLists such as [1,3,4]... by parsing them into integers and getting the total. This worked when I coded each individual one, but when I made a method by passing in the total int value and arraylist I always get a value of zero. A method would save a lot of time. public class Playing { static ArrayList&lt;String&gt; list; static int Vigor; public static void main(String[] args) { list = new ArrayList&lt;String&gt;(); vigoroustotal(list,Vigor); public static void Listtotal(String par, int tt) { for (String s : par) { int i = Integer.parseInt(s); tt += i; } }
tagged with: arraylist
has answer: http://stackoverflow.com/a/25595452
has answer: http://stackoverflow.com/a/25595630
answer count: 5
tagged with: java

http://stackoverflow.com/a/25609165
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40007347
type: Answer
answers question: http://stackoverflow.com/q/25608827
has body: This would be more appropriate String jsonArr = "[\"http://www.ebuy.al/Images/dsc/17470_500_400.jpg\", \"http://www.ebuy.al/Images/dsc/17471_500_400.jpg\"]"; List&lt;String&gt; listFromJsonArray = new ArrayList&lt;String&gt;(); JSONArray jsonArray = new JSONArray(jsonArr); for(int i =0 ;i&lt;jsonArray.length();i++){ listFromJsonArray.add(jsonArray.get(i).toString()); } And don't forget to add json library
score: 0
has comment: http://stackoverflow.com/comment/40005430
has comment: http://stackoverflow.com/comment/40007325
accepted answer of: http://stackoverflow.com/q/25608827

http://stackoverflow.com/q/25558174
has answer: http://stackoverflow.com/a/39782281
has body: I've been working with Kafka for two months, and I used this code to consume messages locally. I recently decided to distribute Zookeeper and Kafka and everything seems to work just fine. My issue started when I tried to use the consumer's code from a remote IP; Once I change seeds.add("127.0.0.1"); to seeds.add("104.131.40.xxx"); I get this error message: run: Error communicating with Broker [104.131.40.xxx] to find Leader for [temperature, 0] Reason: java.net.ConnectException: Connection refused Can't find metadata for Topic and Partition. Exiting BUILD SUCCESSFUL (total time: 21 seconds)r code here this is the code that I currently use: /* Kafka API consumer reads 10 readings from the "temperature" topic */ package simpleexample; import kafka.api.FetchRequest; import kafka.api.FetchRequestBuilder; import kafka.api.PartitionOffsetRequestInfo; import kafka.common.ErrorMapping; import kafka.common.TopicAndPartition; import kafka.javaapi.*; import kafka.javaapi.consumer.SimpleConsumer; import kafka.message.MessageAndOffset; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; public class SimpleExample { public static void main(String args[]) { SimpleExample example = new SimpleExample(); //long maxReads = Long.parseLong(args[0]); long maxReads = 10; //String topic = args[1]; String topic = "temperature"; //int partition = Integer.parseInt(args[2]); int partition =0; List&lt;String&gt; seeds = new ArrayList&lt;String&gt;(); //seeds.add(args[3]); seeds.add("104.131.40.xxx"); //int port = Integer.parseInt(args[4]); int port =9092; try { example.run(maxReads, topic, partition, seeds, port); } catch (Exception e) { System.out.println("Oops:" + e); e.printStackTrace(); } } private List&lt;String&gt; m_replicaBrokers = new ArrayList&lt;String&gt;(); public SimpleExample() { m_replicaBrokers = new ArrayList&lt;String&gt;(); } public void run(long a_maxReads, String a_topi…
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/39967748
favorite count: 0
type: Question
tagged with: apache-zookeeper
has title: Kafka Java consumer works only for localhost and fails for remote server
has comment: http://stackoverflow.com/comment/39911552
has comment: http://stackoverflow.com/comment/39929090
tagged with: api
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39930978
answer count: 1
downvote count: 0
upvote count: 7
has comment: http://stackoverflow.com/comment/40048450
has comment: http://stackoverflow.com/comment/39918581
tagged with: apache-kafka
has comment: http://stackoverflow.com/comment/39929612

http://stackoverflow.com/a/25639942
type: Answer
accepted answer of: http://stackoverflow.com/q/25639845
has body: printf could help. This loop should do: for (int i = 0; i &lt; Test.length; i++) { System.out.printf("%s%s", Test[i], i % 3 == 2 ? "\n" : " "); }
upvote count: 2
answers question: http://stackoverflow.com/q/25639845
type: AcceptedAnswer
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/40061568

http://stackoverflow.com/a/27250876
has comment: http://stackoverflow.com/comment/50015916
has comment: http://stackoverflow.com/comment/56628557
has body: A little late maybe, but a representative answer to user3902144's answer: Similar Answer to this question : Link You may have missed out this from your manifest: &lt;application android:name="&lt;package-name&gt;.app.AppController" // &lt;-- this one android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"&gt; That's why onCreate never called and mInstance is null. Hope this helps :)
type: Answer
score: 11
upvote count: 11
has comment: http://stackoverflow.com/comment/56020920
downvote count: 0
answers question: http://stackoverflow.com/q/25697362

stream
tags question: http://stackoverflow.com/q/25709593
tags question: http://stackoverflow.com/q/25552218
tags question: http://stackoverflow.com/q/25648397
tags question: http://stackoverflow.com/q/25682954
tags question: http://stackoverflow.com/q/25670635
tags question: http://stackoverflow.com/q/25606592
tags question: http://stackoverflow.com/q/25571107
type: Tag
tag name: stream
tags question: http://stackoverflow.com/q/25676206
tags question: http://stackoverflow.com/q/25591204
tags question: http://stackoverflow.com/q/25684558
tags question: http://stackoverflow.com/q/25680210
tags question: http://stackoverflow.com/q/25665189

http://stackoverflow.com/comment/40004030
has text: @HinoHara - please see edited answer on how to configure main class. Let me know if it works.
type: Comment
comment on: http://stackoverflow.com/a/25601601
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40158145
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25693083
has text: Thanks for your reply. I tried to do this search for "org.springframework.stereotype.Controller", however didn't get any result (search.maven.org). Is there any other method or we have to restore to hit and trial method?

http://stackoverflow.com/comment/40143050
type: Comment
has text: B extends A and has both int fie (A p) and fie (B p). So polymorphism is causing this to work. You are not actually overriding fie(A a), which I assume you were intending.
type: QuestionComment
comment on: http://stackoverflow.com/q/25685105
score: 2

http://stackoverflow.com/comment/40191800
comment on: http://stackoverflow.com/q/25711351
type: QuestionComment
score: 0
has text: @Rezaio : Could you post the part of your `IntentService` code where you have used this method?
type: Comment

http://stackoverflow.com/q/25608484
tagged with: image-processing
has answer: http://stackoverflow.com/a/25608771
tagged with: image
favorite count: 0
type: Question
has body: I need a java function that takes Image and Image Size (in Kb) as input and return output an image . can anyone tell me the relationship between the Dimensions and Size (in Kb ) of Image . Thanks in Advance !
has comment: http://stackoverflow.com/comment/40004408
has comment: http://stackoverflow.com/comment/40004228
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/40004470
upvote count: 1
tagged with: swing
has title: Need Java function that takes image and imagesize(in Kb) as input and return an image
has comment: http://stackoverflow.com/comment/40004355
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25608771
downvote count: 3
has comment: http://stackoverflow.com/comment/40004195
has comment: http://stackoverflow.com/comment/40004449

http://stackoverflow.com/comment/40068246
type: Comment
type: QuestionComment
has text: Please don't add it as comment, modify your initial question. Also make sure that you aren't importing/loading the same configuration twice (i.e. don't let your `dummyProject-servlet.xml` import the `applicationContext.xml` else it will load and thus execute twice).
comment on: http://stackoverflow.com/q/25643208
score: 0

http://stackoverflow.com/a/25626667
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40059434
has comment: http://stackoverflow.com/comment/40069651
has body: There are numerous examples of Jetty embedded use on github.com/eclipse/jetty.project Example: LikeJettyXml.java - Jetty 8, with no XML used, setting up an SSL connector. SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector(); ssl_connector.setPort(8443); SslContextFactory cf = ssl_connector.getSslContextFactory(); cf.setKeyStorePath(jetty_home + "/etc/keystore"); cf.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"); cf.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g"); cf.setTrustStore(jetty_home + "/etc/keystore"); cf.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"); cf.setExcludeCipherSuites( new String[] { "SSL_RSA_WITH_DES_CBC_SHA", "SSL_DHE_RSA_WITH_DES_CBC_SHA", "SSL_DHE_DSS_WITH_DES_CBC_SHA", "SSL_RSA_EXPORT_WITH_RC4_40_MD5", "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA" }); ssl_connector.setStatsOn(false); server.addConnector(ssl_connector); ssl_connector.open(); SslSocketConnector ssl2_connector = new SslSocketConnector(cf); ssl2_connector.setPort(8444); ssl2_connector.setStatsOn(false); server.addConnector(ssl2_connector); ssl2_connector.open();
answers question: http://stackoverflow.com/q/25619208
has comment: http://stackoverflow.com/comment/40059916

http://stackoverflow.com/comment/39978144
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25593688
has text: @pskink But I'm developing on a Samsung S5! Anyway, looks like now is solved. As soon as I unplugged the device from the PC the app began to work properly.
score: 0

http://stackoverflow.com/a/25592786
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39975742
type: Answer
has body: You need to declare your Activity in your AndroidManifest, the error is specific: it's trying to find the Activity called "PractEnd", yet you only have "EasyMain" declared in your Manifest.
answers question: http://stackoverflow.com/q/25592628
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25592628
upvote count: 1
score: 1

http://stackoverflow.com/comment/40099510
comment on: http://stackoverflow.com/a/25660165
type: AnswerComment
score: 0
type: Comment
has text: sorry dude .. i m confused .. i added necessary headers but still the behavior of my program is unpredictable ... i mean sometime it is showing webpage and sometime just plain text(source code)...

http://stackoverflow.com/q/25599833
has comment: http://stackoverflow.com/comment/39988268
linked to: http://stackoverflow.com/q/18734273
has answer: http://stackoverflow.com/a/25600190
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/39988347
upvote count: 2
has answer: http://stackoverflow.com/a/44180801
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25600006
downvote count: 1
tagged with: baseadapter
has title: How to set custom listview font for items in custom baseadapter class
linked to: http://stackoverflow.com/q/24801769
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39988283
has comment: http://stackoverflow.com/comment/39988527
has answer: http://stackoverflow.com/a/25600028
has body: I have a custom listview baseadapter class that has a listview of installed apps on the phone. Essentially I want to set a custom font for the appname in the listview. I tried to set like this with the id and setting the typeface; however, it was unable to be resolved/done in everywhere in my baseadapter class. appname = (TextView)findViewById(R.id.appname); appname.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/raleway-regular.otf")); I have done a lot of research How to set custom font for android listview? But this is a really weird situation with my baseadapter and needs, so I have been unable to produce a solution so far. BaseAdapter class: public class ApkAdapter extends BaseAdapter { //Pastebin link: http://pastebin.com/LGRicg4U , http://pastebin.com/c4WfmhMK , http://pastebin.com/gFuuM4dY, http://pastebin.com/4Q7EP9G4 // http://pastebin.com/Te2g072w, http://pastebin.com/NLT5iUiA , SharedPreferences sharedPrefs; SharedPreferences sharedPrefsapp; List&lt;PackageInfo&gt; packageList; TextView appnamestyle; Activity context; PackageManager packageManager; boolean[] itemChecked; HashSet checked; String PACKAGE_NAME; TextView appname; public ApkAdapter(Activity context, List&lt;PackageInfo&gt; packageList, PackageManager packageManager) { super(); this.context = context; this.packageList = packageList; this.packageManager = packageManager; itemChecked = new boolean[packageList.size()]; } private class ViewHolder { TextView apkName; CheckBox ck1; TextView packageName; } public int getCount() { return packageList.size(); } public Object getItem(int position) { return packageList.get(position); } public long getItemId(int position) { return 0; } @Override public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder holder; LayoutInflater inflater = context.getLayoutInflater(); if (convertView == null) { convertView = inflater.inflate(R.layout.installed_apps, null); holder = new ViewHolder(); holder.apkName = (TextView) conv…
has answer: http://stackoverflow.com/a/25600570
tagged with: android-listview
score: 1
tagged with: android
tagged with: java

http://stackoverflow.com/q/25631791
downvote count: 0
favorite count: 0
type: Question
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/40155174
possible better answer: http://stackoverflow.com/a/36867587
has body: I have spring boot webapp that uses the Java-based configuration to configure a JdbcUserDetailsManager: @Configuration @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired protected DataSource dataSource; @Autowired public void configAuthentication(AuthenticationManagerBuilder auth) throws Exception { auth.jdbcAuthentication() .dataSource(dataSource) .usersByUsernameQuery("select username as principal, password as credentials, true from users where username = ?") .authoritiesByUsernameQuery("select username as principal, authority as role from authorities where username = ?") .rolePrefix("ROLE_"); } @Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .antMatchers("/api/**") .authenticated() .and() .formLogin() .successHandler( (request, response, authentication) -&gt; { response.setStatus(HttpStatus.NO_CONTENT.value()); }) .failureHandler( (request, response, authentication) -&gt; { response.setStatus(HttpStatus.FORBIDDEN.value()); }) .and() .logout() .logoutUrl("/logout") .logoutSuccessHandler( (request, response, authentication) -&gt; { response.setStatus(HttpStatus.NO_CONTENT.value()); }); } } I can set a breakpoint in configAuthentication(), so I know that the method is getting called. I now want to get the JdbcUserDetailsManager injected in my Application class: @EnableAutoConfiguration @ComponentScan public class Application { private Environment env; private UserDetailsManager userDetailsManager; @Autowired public Application(JdbcTemplate jdbcTemplate, Environment env, UserDetailsManager userDetailsManager) { this.env = env; this.userDetailsManager = userDetailsManager; ... When I try to start my application, I get the following error: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'application': Unsatisfied dependency expressed through constructor argument with index 2 of type [org.springframework.se…
has answer: http://stackoverflow.com/a/25694157
has title: Cannot get UserDetailsManager injected with Spring Boot and Java-based Configuration
has answer: http://stackoverflow.com/a/36867587
tagged with: spring
tagged with: autowired
tagged with: spring-security
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/25694157
tagged with: java

http://stackoverflow.com/comment/40190992
comment on: http://stackoverflow.com/a/25711123
type: Comment
type: AnswerComment
has text: @Adam Harwood : thank you for the input. i had mistaken .jsp as java script, any suggestions wwhat i need to alter in the code to make it execute?
score: 0

http://stackoverflow.com/q/25582223
answer count: 1
linked to: http://stackoverflow.com/q/4638832
has title: Custom Android UI and multiple screen support
type: Question
tagged with: user-interface
has answer: http://stackoverflow.com/a/25582488
accepted answer: http://stackoverflow.com/a/25582488
type: AnsweredQuestion
has body: I know these kinds of questions have been asked before, but I haven't seen one of this type yet. I am creating a custom android UI using android canvas. I have created all the necessary drawables for it and put them in the appropriate folders and I am now drawing the UI with this code: public class MainMenuView extends View { private Bitmap pasteImage; private Bitmap adventureLetters; private Bitmap settingsLetters; private Bitmap quitLetters; private Bitmap backgroundImage; private DisplayMetrics metrics; public MainMenuView(Context context){ super(context); pasteImage = decodeFile(R.drawable.paste, 200, true); Log.w("Visina imagea", String.valueOf(pasteImage.getHeight())); pasteImage.recycle(); } public MainMenuView(Context context, AttributeSet attrSet){ super(context, attrSet); metrics = context.getResources().getDisplayMetrics(); pasteImage = decodeFile(R.drawable.paste, 330, true); adventureLetters = decodeFile(R.drawable.adventureletters, 100, true); settingsLetters = decodeFile(R.drawable.settingsletters, 100, true); quitLetters = decodeFile(R.drawable.quitletters, 50, true); Log.w("Je li image null? ", pasteImage == null ? "da" : "ne"); backgroundImage = decodeFileScaled(R.drawable.toothpastebackground); backgroundImage = Bitmap.createScaledBitmap(backgroundImage, metrics.widthPixels - 20, metrics.heightPixels, true); //adventureLetters = BitmapFactory.decodeResource(getResources(), R.drawable.adventureletters); //settingsLetters = BitmapFactory.decodeResource(getResources(), R.drawable.settingsletters); //quitLetters = BitmapFactory.decodeResource(getResources(), R.drawable.quitletters); } @Override protected void onMeasure(int widthMeasure, int heightMeasure){ setMeasuredDimension(calculateMeasure(widthMeasure), calculateMeasure(heightMeasure)); Log.w(String.valueOf(calculateMeasure(widthMeasure)), "Izmjereno"); } private static final int DEFAULT_SIZE = 70; private int calculateMeasure(int measure) { int result = (int)(DEFAULT_SIZE * getResources().getDis…
score: 0
tagged with: android
tagged with: java

http://stackoverflow.com/comment/40050451
score: 0
type: Comment
has text: This is a well-known problem. You may have to lie to Hibernate and tell it the column is nullable even though in the database it's not. I haven't found a way to prevent Hibernate from being "too helpful" in this case.
type: QuestionComment
comment on: http://stackoverflow.com/q/25621013

http://stackoverflow.com/comment/40099201
type: Comment
has text: Please give more details. What do you want to do, what have you tried so far?
type: QuestionComment
comment on: http://stackoverflow.com/q/25660700
score: 0

http://stackoverflow.com/q/25602485
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39993225
has answer: http://stackoverflow.com/a/25602855
has comment: http://stackoverflow.com/comment/39993295
downvote count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/25602855
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39993738
favorite count: 0
type: Question
has title: Arraylist override values issue?
has comment: http://stackoverflow.com/comment/39993478
has comment: http://stackoverflow.com/comment/39993513
has answer: http://stackoverflow.com/a/25603071
has answer: http://stackoverflow.com/a/25602818
possible better answer: http://stackoverflow.com/a/25602818
tagged with: android
linked to: http://stackoverflow.com/q/25598696
tagged with: android-spinner
has body: I have an object of Order Items.it contains three values 1.item Name 2.Item Price 3.No of Items I have a spinner, i have add this object on item selected. When I add this object and select again , an other item it will also add into list, not override. My code is below private OnItemSelectedListener itemSelectListener = new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,int arg2, long arg3) { // TODO Auto-generated method stub System.out.println("parent Tag:"+arg0.getTag()); TextView itemName = (TextView)findViewById(Integer.parseInt(arg0.getTag().toString())); System.out.println("Item Name:" +itemName.getText().toString()); System.out.println("Item Price:" +itemName.getTag().toString()); System.out.println("Item QTY:" +arg0.getItemAtPosition(arg2).toString()); orderItems = new OrderItems(); if(!"".equals(arg0.getItemAtPosition(arg2).toString())){ orderItems.itemName = itemName.getText().toString(); orderItems.itemPrice = itemName.getTag().toString(); orderItems.noOfItems = Integer.parseInt(arg0.getItemAtPosition(arg2).toString()); //if(itemsArray) itemsArray.additem(orderItems); } } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { // TODO Auto-generated method stub } }; public void additem(OrderItems object){ itemArrayList.add(object); } can any body help me in this? What i am missing here?
has comment: http://stackoverflow.com/comment/39993355
tagged with: arraylist

http://stackoverflow.com/comment/75870556
has text: in the Class-Path entry in the manifest, the folder separators are platform specific, java was not able to resolve path with / in windows and when I changed the manifest and replaced / with \ it worked. Is there a way to avoid this ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25564350
type: Comment

http://stackoverflow.com/q/25593689
has comment: http://stackoverflow.com/comment/39977175
has comment: http://stackoverflow.com/comment/39978681
has comment: http://stackoverflow.com/comment/39979274
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/39978361
type: AnsweredQuestion
tagged with: java
downvote count: 0
has body: I have two Fragments named HomeworkListFragment and HomeworkFragment. BOTH INHERIT FROM -> Fragment Intent i = new Intent(getActivity(),HomeworkPagerActivity.class); i.putExtra(HomeworkFragment.EXTRA_HOMEWORK_ID, homework.getId()); startActivityForResult(i,REQUEST_DELETE_HOMEWORK_ID); This is how I start MyFragment from MyListFragment. After I finish, I want to call this from MyFragment: Intent i = new Intent(); i.putExtra(EXTRA_DELETE_HOMEWORK_ID, mHomework.getId()); getActivity().setResult(Activity.RESULT_OK, i); //Toast.makeText(getActivity(), "deleting?", Toast.LENGTH_SHORT).show(); //getActivity().finish(); NavUtils.navigateUpFromSameTask(getActivity()); Back in MyListFragment I've implemented: @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Toast.makeText(getActivity(), "HERE", Toast.LENGTH_SHORT).show(); if (requestCode == REQUEST_DELETE_HOMEWORK_ID){ String filename = data.getStringExtra(HomeworkFragment.EXTRA_DELETE_HOMEWORK_ID); Toast.makeText(getActivity(), "ID: "+filename, Toast.LENGTH_SHORT).show(); } } However, this method is never called! I've declared them both in my manifest: &lt;activity android:name=".HomeworkListFragment" android:label="@string/app_name" android:launchMode="singleTop" &gt; &lt;meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".HomeworkTabFragment"/&gt; &lt;/activity&gt; &lt;activity android:name=".HomeworkFragment" android:label="@string/app_name" &gt; &lt;meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".HomeworkListFragment"/&gt; &lt;/activity&gt; Is part of the answer with: NavUtils.navigateUpFromSameTask(getActivity()); Is MyListFragment getting recreated?
upvote count: 1
accepted answer: http://stackoverflow.com/a/25944596
score: 1
tagged with: android-activity
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25944596
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/39978405
has comment: http://stackoverflow.com/comment/39979171
tagged with: android-intent
has title: onActivityResult() not called with two fragments

http://stackoverflow.com/q/25634889
downvote count: 2
has comment: http://stackoverflow.com/comment/40053266
type: UnansweredQuestion
score: -2
answer count: 1
has answer: http://stackoverflow.com/a/25635447
has comment: http://stackoverflow.com/comment/40052836
has comment: http://stackoverflow.com/comment/40052839
tagged with: bufferedimage
has comment: http://stackoverflow.com/comment/40052822
tagged with: get
tagged with: nullpointerexception
tagged with: java
has body: I am getting a NullPointerException on an image that I have loaded. When I render the image using a JFrame everything works, however, my goal is to load each pixel into an ArrayList that contains the RBG color of that pixel. Whe nI try to use getRGB(x,y) I receive a NullPoint Exception. I have marked in the comments on the code where the error occurs. I will load my code, thank you for your time and help! public static void populateMapNode(BufferedImage image) { int width = image.getWidth(); int height = image.getHeight(); int pixel; int i = 0, j= 0; System.out.println("width = " + width); System.out.println("height = " + height); pixel = image.getRGB(j, i); //error occurs here System.out.println("pixel = " + pixel); MapNodes.add(new MapNode(new ArrayList&lt;MapNode&gt;(), new MapNode(), j, i, pixel, 0, 0, 0, 0, null)); System.out.println("do i get here?"); for (i = 0; i &lt; height; i++) { for (j = 0; j &lt; width; j++) { pixel = image.getRGB(j, i); MapNodes.add(new MapNode(MapNode.neighbors, MapNode.neighbors.get(j-1), j, i, pixel, 0, 0, 0, 0, null)); } } } public static void loadMap() //if I just go to the JFrame the picture loads. { //Util.loadImage("AntWorld.png", null); BufferedImage antMap = Util.loadImage("AntWorld.png", new Container()); populateMapNode(antMap); JFrame frame = new JFrame(); frame.getContentPane().setLayout(new FlowLayout()); frame.getContentPane().add(new JLabel(new ImageIcon(antMap))); frame.pack(); frame.setVisible(true); //System.out.println(Util.manhattanDistance(MapNode.x, MapNode.y, MapNode.parent.x, MapNode.parent.y)); } public static void main(String[] args) { loadMap(); } /* helper class Util for loadImage */ import java.awt.Container; import java.awt.MediaTracker; import java.awt.image.BufferedImage; import java.net.URL; import javax.imageio.ImageIO; public class Util { /** * Loads a image file with the given path into a new bufferedImage. Blocks * until the image has finished loading. widit is the component on which the * images …
linked to: http://stackoverflow.com/q/15175109
favorite count: 0
type: Question
has title: Java BufferedImage Nullpointer Exception on LoadedImage
upvote count: 0

http://stackoverflow.com/comment/40140617
comment on: http://stackoverflow.com/q/25683000
type: Comment
type: QuestionComment
has text: AFAIK Apple dropped Java support at some point in OS X 10.7, and if you try running the 'java' command in a Terminal it prompts you with a dialog to visit an Apple's site and install Java 1.6
score: 1

http://stackoverflow.com/a/25687002
has comment: http://stackoverflow.com/comment/40146640
has comment: http://stackoverflow.com/comment/40146726
has comment: http://stackoverflow.com/comment/40146408
has comment: http://stackoverflow.com/comment/40147249
has comment: http://stackoverflow.com/comment/40147138
has comment: http://stackoverflow.com/comment/40146177
upvote count: 0
score: -2
downvote count: 2
type: Answer
has body: for(T element : list){ if((element instanceof User) &amp;&amp; (element.getLastName().equals("Jobs"))) element.setCompany("Google"); } And you will need setters and getters, since those fields are private.
answers question: http://stackoverflow.com/q/25686930

http://stackoverflow.com/a/25591256
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25591063
answers question: http://stackoverflow.com/q/25591063
has body: -Xmx will set the maximum heap size. The the JVM will allocate more memory as needed up to that limit. If you, for some reason, want to allocate more memory for the heap at JVM start, use the -Xms option in addition to the -Xmx option. See the Oracle docs for details. Also, these options refer to RAM, so the HD space is not relevant.
score: 2
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/39972233
type: AnswerComment
has text: Are you sure we can use `this.cancel()` on the class?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25590842

http://stackoverflow.com/comment/40162437
has text: @Nidhi, Did you read the API? The setLabelFor(...) method is used to invoke requestFocus() on the specified component. If you attempt to specify two component how would this code work. Also the method uses "set" (not "add") so whenever you invoke the method you replace the old property. This is the way all "setter" methods work.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25570133

http://stackoverflow.com/a/25602397
has comment: http://stackoverflow.com/comment/40009986
type: Answer
answers question: http://stackoverflow.com/q/25602198
score: 0
has comment: http://stackoverflow.com/comment/40016319
has body: PROBLEM : The thing you are doing is creating an infinite loop because everytime you call setText(), again afterTextChanged() gets called (because you are changing the text inside the EditText. SOLUTION : Suppose the EditText is editTextToClearStyle EditText editTextToClearStyle = (EditText)findViewById(R.id.youredittextname); editTextToClearStyle.addTextChangedListener(new TextWatcher(){ public void afterTextChanged(Editable s) { editTextToClearStyle.setTextAppearance(getApplicationContext(),R.style.normalText); }

http://stackoverflow.com/comment/40098842
comment on: http://stackoverflow.com/q/25660433
has text: SeleniumServer srvr = new SeleniumServer(); srvr.start(); String site="website_name"; DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*firefox",site ); selenium.wait(); selenium.start("captureNetworkTraffic=true"); selenium.open("/"); String trafficOutput = selenium.captureNetworkTraffic("json"); System.out.println(trafficOutput);
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40111877
score: 0
type: Comment
type: QuestionComment
has text: You could use a well known system/environment property and/or default for it instead of passing it to the constructor (maybe you can show the code). If you would use the `Environment` that is available through the `COnfigurableApplicationContext` property of the `ApplicationContextInitializer`. That way if you lookup the property (to start loading from) you will consult the servletcontext(local to servlet and global)/system properties and finally the environment properties. You could then in your test set a system property to load it.
comment on: http://stackoverflow.com/q/25666409

http://stackoverflow.com/q/25551271
tagged with: combobox
has title: Combo box in Java - nullpointer
has body: I am trying to add this list of Strings private String[] dest = {"New York", "Dahab", "Rome", "Sydney", "Tokyo"}; To this combo box like so for(int i = 0; i &lt; dest.length; i++){ System.out.println(dest[i]); destinationField.addItem(dest[i]); } However I get a NullPointerException on the destinationField.addItem(dest[i]); line JComboBox&lt;String&gt; destinationField;
has comment: http://stackoverflow.com/comment/39897619
has comment: http://stackoverflow.com/comment/39897686
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25551348
answer count: 1
has comment: http://stackoverflow.com/comment/39897713
linked to: http://stackoverflow.com/q/218384
type: Question
type: UnansweredQuestion
tagged with: spring
duplicate of: http://stackoverflow.com/q/218384

http://stackoverflow.com/q/25638523
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25639086
possible better answer: http://stackoverflow.com/a/25639086
tagged with: java
tagged with: codeigniter
has answer: http://stackoverflow.com/a/25639051
accepted answer: http://stackoverflow.com/a/25639051
type: Question
tagged with: zend-framework
has body: I want from htaccess url like this example http://www.clubrowcreations.co.uk/marketing-mistakes-general/thank-you all url end with (/thank-you) redirect to main url how do i do from htaccess
tagged with: yii
tagged with: php
has title: htaccess find last name after slash to redirect to an other page
type: AnsweredQuestion

http://stackoverflow.com/a/25681291
has comment: http://stackoverflow.com/comment/40196995
answers question: http://stackoverflow.com/q/25679897
has comment: http://stackoverflow.com/comment/40206513
type: Answer
accepted answer of: http://stackoverflow.com/q/25679897
score: 0
type: AcceptedAnswer
has body: To be sure that I've understood your needs, let me recap - you don't want to add interfaces to your MyBean declaration, but you want to add methods that are defined by the DynamicMBean? I am not sure I understand the part: implement a class as DynamicMBean From where the implementation (i.e. methods) would come? Why do you need AOP for this? Proxetta offers you way to create proxies in 2 ways (or 3:). First one is by subclassing your class and wrapping the methods you want to change; or by providing you the wrapper that delegates calls to your target. In both cases, I do not see how you would use Proxetta to achieve what you need, if I've understood it right. Anyway, you may always try to contact Jodds support with some code samples that explain your question :)

http://stackoverflow.com/comment/40185434
has text: possible duplicate of [how can I wait for a java sound clip to finish playing back?](http://stackoverflow.com/questions/557903/how-can-i-wait-for-a-java-sound-clip-to-finish-playing-back)
type: Comment
comment on: http://stackoverflow.com/q/25702200
score: 0
type: QuestionComment

http://stackoverflow.com/a/25695509
type: Answer
score: 0
has body: You should first convert dataB string to int: int number = Integer.parseInt(dataB); String dataC = "0x" + Integer.toHexString(number);
has comment: http://stackoverflow.com/comment/40162757
answers question: http://stackoverflow.com/q/25695459

http://stackoverflow.com/q/25557418
answer count: 2
tagged with: multithreading
tagged with: android
has comment: http://stackoverflow.com/comment/39909776
has title: About "synchronus operations" in android
possible better answer: http://stackoverflow.com/a/25557561
has body: some text from a android book: "However, starting with Android 3.0, synchronous operations can no longer be run directly from a UI thread. " I think that every code running in the some thread is "synchronous operations " so,What is the "synchronous operations" mean ? How the android runtime detect that the code is a "synchronous operations "
has answer: http://stackoverflow.com/a/25557561
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25557560
has comment: http://stackoverflow.com/comment/39909989
has comment: http://stackoverflow.com/comment/39909929
has answer: http://stackoverflow.com/a/25557560
type: Question

http://stackoverflow.com/comment/42054953
has text: javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617)
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26708637

http://stackoverflow.com/q/25655652
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40090482
has comment: http://stackoverflow.com/comment/40090444
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/40090431
answer count: 1
downvote count: 0
upvote count: 7
tagged with: generics
tagged with: variadic-functions
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25655726
has answer: http://stackoverflow.com/a/25655726
has title: Is T... (generics vararg parameter) really stripped down to Object[] at compile time?
has body: (I'll use T to refer to a generic argument here, used in a parameterized class.) I read that the reason that T... is a potential source of heap pollution when used as an argument is that the compiler is making an exception to the normal (no T[] arrays allowed) rule, and allowing T... (which is varargs, and so would normally translate by varargs rules internally to T[], except that this isn't allowed with generics) as a parameter by implementing it internally as though it were a raw type, converting it to an array of Object[] instead. So I wrote some code to verify this, to cement the concept into my memory. I took T...t as an argument to a method, and then System.out.println'd t.getClass[]. I expected to get the class of Object[], but instead, I got T[]'s class. So, it appears that the compiler is converting T...t to T[] internally, and not to Object[]. e.g. public class MyClass&lt;T&gt;{ public void method(T...t) { System.out.println(t.getClass().getName()); //for MyClass&lt;String&gt;, this gives me //[Ljava.lang.String } What am I missing here? And if the compiler's not converting the generic varargs parameter internally to Object[], how is it losing type safety and acting as a potential source of heap pollution?

http://stackoverflow.com/a/25564185
accepted answer of: http://stackoverflow.com/q/25564045
upvote count: 4
has comment: http://stackoverflow.com/comment/39922503
has body: Assuming your question is Can anyone help to figure out the way for sending message to multiple consumers and without reading through your complete code, an approach could be to put your clients in a collection static Vector&lt;consumer&gt; vecConsumer; where you put in every new client and give a reference to all existing clients. The broadcasting is just like sending to a single client, encapsulated in, for an example, a foreach loop for(consumer cons : vecConsumer) { //send stuff or put in sending queue }
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/39924920
answers question: http://stackoverflow.com/q/25564045

http://stackoverflow.com/comment/40009617
type: Comment
has text: Now that i got the list.get(pos).getName() and knowing that you just have to input the position in the .get(), isnt it unnecessary to use any kind of conditional or loop? or is it better to do so?
type: AnswerComment
comment on: http://stackoverflow.com/a/25611396
score: 0

http://stackoverflow.com/comment/40108289
has text: @Aneesh That library I linked to is open source - you can look through it for inspiration (provided you obey their license of course).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25665899

http://stackoverflow.com/q/25677384
has title: Java scanner not starting from beginning of file
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/40129241
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25677444
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40129202
has body: First of all this is not a duplicate of other posts, because in my problem the scanner class does not recognize the beginning of the .txt file not the end, instead it starts approximately 1/2 way through the file. Here is my code: package Program; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class App { public static void main(String[] args) throws FileNotFoundException { String filename = "C:\\Users\\vroy\\Programming\\Text documents\\P&amp;P.txt"; File textFile = new File(filename); Scanner reader = new Scanner(textFile); // int value = reader.nextInt(); // System.out.println(value); while (reader.hasNextLine()) { String line = reader.nextLine(); System.out.println(line); } reader.close(); } } Here is the .txt document that my program is reading: http://www.goodreads.com/ebooks/download/1885.Pride_and_Prejudice?doc=2 My program starts printing out lines of text starting at: "with the ill-judged officiousness..." It should start much further up the document. Is this a problem with the scanner class?
tagged with: text
type: AnsweredQuestion
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/25677444
downvote count: 0

jackson
tags question: http://stackoverflow.com/q/25639247
tags question: http://stackoverflow.com/q/25603581
tags question: http://stackoverflow.com/q/25693309
tag name: jackson
tags question: http://stackoverflow.com/q/25651225
tags question: http://stackoverflow.com/q/25675011
tags question: http://stackoverflow.com/q/25689872
tags question: http://stackoverflow.com/q/25581678
tags question: http://stackoverflow.com/q/25556624
tags question: http://stackoverflow.com/q/25596301
tags question: http://stackoverflow.com/q/25615895
tags question: http://stackoverflow.com/q/25584183
tags question: http://stackoverflow.com/q/25708946
tags question: http://stackoverflow.com/q/25694832
tags question: http://stackoverflow.com/q/25691550
tags question: http://stackoverflow.com/q/25563189
tags question: http://stackoverflow.com/q/25582730
tags question: http://stackoverflow.com/q/25551283
tags question: http://stackoverflow.com/q/25692444
tags question: http://stackoverflow.com/q/25564116
type: Tag
tags question: http://stackoverflow.com/q/25671806
tags question: http://stackoverflow.com/q/25580593
tags question: http://stackoverflow.com/q/25650356
tags question: http://stackoverflow.com/q/25650678
tags question: http://stackoverflow.com/q/25586687
tags question: http://stackoverflow.com/q/25621522
tags question: http://stackoverflow.com/q/25698687
tags question: http://stackoverflow.com/q/25616528

http://stackoverflow.com/comment/40112761
type: QuestionComment
comment on: http://stackoverflow.com/q/25652892
has text: possible duplicate of [SWT - table layout - Resize the column of a table to fill all the available space](http://stackoverflow.com/questions/9211106/swt-table-layout-resize-the-column-of-a-table-to-fill-all-the-available-spac)
score: 0
type: Comment

http://stackoverflow.com/a/25707859
score: 1
downvote count: 0
upvote count: 1
type: Answer
has body: In Hazelcast 3.3 the logging which configuration file is loaded, is improved extensively and it will show which file is being picked up. This week Hazelcast 3.3 is going to be released. If you are using an older version; one trick is to set e.g. a custom groupname for example and once the HazelcastInstance is loaded, just read out that groupname and make sure it is the expected value.
answers question: http://stackoverflow.com/q/25688665

http://stackoverflow.com/comment/41682550
comment on: http://stackoverflow.com/a/25707276
type: Comment
type: AnswerComment
has text: Maybe that small peace of information helps anybody out: It is also mandatory to have the form attributed with th:action. Just attributing plain HTML action won't do and the hidden CSRF input filed won't be added automatically. Couldn't find that peace of information documented anywhere and spent 2h research on that. I had attributed the form with action="#" and set the corresponding value by java script. The CSRF token input field wasn't added automatically until added th:action="@{#}" to the form. Works as a charm now.
score: 11

http://stackoverflow.com/q/25696816
type: UnansweredQuestion
tagged with: cdata
has answer: http://stackoverflow.com/a/25854491
score: 0
tagged with: rss
tagged with: java
has body: I followed Vogella's tutorial for parsing an RSS Feed using JAVA. The code is straightforward and I was able to get it to work. The problem is some of the nodes im parsing have CDATA, and I'm getting empty strings (based on the way the parser is implemented). In short, my question is, is there an easy way to modify this implementation to handle CDATA? Vogella RSS Parser
answer count: 1
has title: Handling CDATA when parsing RSS Feed with JAVA
type: Question

http://stackoverflow.com/q/25663918
has body: I want to create multi parameter search using JDBC prepared statement so as to prevent SQL injection attack and improve performance. As I couldn't find the best way to do it on the net. I've tried to implement on my own as follow. In this program I want to allow the user to search an employee by either first name, last name or department id. I want to know if my implementation would prevent SQL injection If I am using prepared statement correctly? I have some doubt on this line PreparedStatement stat = conn.prepareStatement(sql.toString()); Let's say two users search by using the same parameters, and thus it would result the same sql string. According to my implementation, would the database have to prepare that sql twice or just once? public class EmpDAO { public static List&lt;Employee&gt; findByCriteria(Employee e) throws SQLException, IOException { try (Connection conn = getConnection()) { StringBuilder sql = new StringBuilder("SELECT * FROM Employee "); //collect user supplied parameters Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;(); if (e.getFname() != null &amp;&amp; e.getFname().length() != 0) { params.put(EmpDAO.FNAME, e.getFname()); } if (e.getLname() != null &amp;&amp; e.getLname().length() != 0) { params.put(EmpDAO.LNAME, e.getLname()); } if (e.getDepid() &gt; 0) { params.put(EmpDAO.DEPT_ID, new Integer(e.getDepid()).toString()); } //construct prepared statement based on the parameters Set&lt;String&gt; colSet = params.keySet(); if (colSet != null &amp;&amp; !colSet.isEmpty()) { StringBuilder whereClause = new StringBuilder(" WHERE"); String andOp = ""; for (String colName : colSet) { whereClause.append(andOp); whereClause.append(" "); whereClause.append(colName); whereClause.append("=? "); andOp = " AND "; } sql.append(whereClause); } PreparedStatement stat = conn.prepareStatement(sql.toString()); int paramPos = 1; for (String colName : colSet) { if (colName.equals(EmpDAO.FNAME)) { stat.setString(paramPos, params.get(colName)); …
score: 0
tagged with: java
answer count: 1
type: Question
has title: Java/ JDBC – Multi Parameter Search Using JDBC PreparedStatement
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25668597
tagged with: jdbc

http://stackoverflow.com/q/25570189
downvote count: 0
upvote count: 1
tagged with: sqoop
tagged with: sqoop2
has body: I want use Sqoop Java API for export content of SequenceFile to Oracle. Where I can see parameters for form.getInputString() methods? All examples at www represents a command line commands, Apache Sqoop documentation not contains necessary information.
score: 1
tagged with: java
favorite count: 0
type: Question
has title: Sqoop java api stringInput parameters
tagged with: hadoop
answer count: 0
has comment: http://stackoverflow.com/comment/52363729
type: UnansweredQuestion

sockets
tags question: http://stackoverflow.com/q/25709593
tags question: http://stackoverflow.com/q/25690611
tags question: http://stackoverflow.com/q/25662508
tags question: http://stackoverflow.com/q/25640668
tags question: http://stackoverflow.com/q/25589132
tags question: http://stackoverflow.com/q/25590127
tags question: http://stackoverflow.com/q/25556654
tags question: http://stackoverflow.com/q/25683038
tags question: http://stackoverflow.com/q/25567836
tags question: http://stackoverflow.com/q/25688659
tags question: http://stackoverflow.com/q/25611741
tags question: http://stackoverflow.com/q/25698585
tags question: http://stackoverflow.com/q/25651438
tags question: http://stackoverflow.com/q/25656222
tags question: http://stackoverflow.com/q/25659276
tags question: http://stackoverflow.com/q/25637039
tags question: http://stackoverflow.com/q/25580593
tag name: sockets
tags question: http://stackoverflow.com/q/25675715
tags question: http://stackoverflow.com/q/25610710
tags question: http://stackoverflow.com/q/25571431
tags question: http://stackoverflow.com/q/25574635
tags question: http://stackoverflow.com/q/25559508
tags question: http://stackoverflow.com/q/25678165
tags question: http://stackoverflow.com/q/25670635
tags question: http://stackoverflow.com/q/25612277
tags question: http://stackoverflow.com/q/25565095
tags question: http://stackoverflow.com/q/25566658
tags question: http://stackoverflow.com/q/25594197
tags question: http://stackoverflow.com/q/25611248
tags question: http://stackoverflow.com/q/25706352
type: Tag
tags question: http://stackoverflow.com/q/25633758
tags question: http://stackoverflow.com/q/25645391
tags question: http://stackoverflow.com/q/25653932
tags question: http://stackoverflow.com/q/25646467
tags question: http://stackoverflow.com/q/25640587

http://stackoverflow.com/comment/40057684
has text: I have not used any package.All the classes are in default package.So if i put all the images in the src folder and use "search.jpg" ,Will it work?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25637776
type: Comment

http://stackoverflow.com/q/25711705
has body: I have an issue with the GAE tutorial. I just started learning how to use it, and I came to face an issue with '@Entity' when I go to the localhost:8888 page to check the '@Entity' list in there, it shows an empty list.... and I don't understand why... I'm following the tutorial line by line !!! @Entity public class CheckIn { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key key; private String placeId; private String userEmail; private Date checkinDate;
tagged with: android
has comment: http://stackoverflow.com/comment/40198926
score: 0
has title: issues with 'Entity' in google app engine tutorial
tagged with: java
has comment: http://stackoverflow.com/comment/40198931
has comment: http://stackoverflow.com/comment/40198905
type: Question
has comment: http://stackoverflow.com/comment/40225444
answer count: 0
has comment: http://stackoverflow.com/comment/40198850
has comment: http://stackoverflow.com/comment/40198830
type: UnansweredQuestion
tagged with: google-app-engine

http://stackoverflow.com/comment/39984795
type: QuestionComment
comment on: http://stackoverflow.com/q/25597839
score: 0
type: Comment
has text: what does symbollist have?

http://stackoverflow.com/comment/40033913
has text: Thanks for the link. I read it and confused - is it HQL or native SQL in the `@formula` annotation. All I was need is to try.
comment on: http://stackoverflow.com/q/25617517
type: QuestionComment
type: Comment
score: 0

ackermann
tag name: ackermann
type: Tag
tags question: http://stackoverflow.com/q/25705695

myfaces
type: Tag
tags question: http://stackoverflow.com/q/25581726
tag name: myfaces

http://stackoverflow.com/q/25676019
has title: Array out of bounds exception, Josephus
answer count: 4
has answer: http://stackoverflow.com/a/25676187
tagged with: bounds
has answer: http://stackoverflow.com/a/25676242
accepted answer: http://stackoverflow.com/a/25676242
has answer: http://stackoverflow.com/a/25676120
possible better answer: http://stackoverflow.com/a/25676120
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: queue
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25676136
has body: I can't seem to figure out why I keep getting this error! It's my first time dealing with Queues. I'm sure the solution is simple and I'm probably missing something basic. Any guidance/help is greatly appreciated: import java.util.LinkedList; import java.util.Queue; public class Josephus{ public static void main(String[] args) { int n = Integer.parseInt(args[0]), m = Integer.parseInt(args[1]); Queue&lt;Integer&gt; q = new LinkedList&lt;Integer&gt;(); for (int i = 0; i &lt; n; i++) q.remove(new Integer(i)); int k = 0; while (!q.isEmpty()) { int x = q.remove(); if (++k % m == 0) System.out.print(x + " "); else q.remove(x); System.out.println(x + " "); } } } The original prompt for this code is as follows: Josephus problem. In the Josephus problem from antiquity, N people are in dire straits and agree to the following strategy to reduce the population. They arrange them- selves in a circle (at positions numbered from 0 to N–1) and proceed around the circle, eliminating every Mth person until only one person is left. Legend has it that Josephus figured out where to sit to avoid being eliminated. Write a Queue client Josephus that takes N and M from the command line and prints out the order in which people are eliminated (and thus would show Josephus where to sit in the circle).
tagged with: josephus
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/40126924
has comment: http://stackoverflow.com/comment/40126916

http://stackoverflow.com/comment/40000340
type: QuestionComment
comment on: http://stackoverflow.com/q/25604914
type: Comment
has text: Is this a *Web Application* (e.g. you are using Tomcat) or *Standalone Application*?
score: 0

http://stackoverflow.com/a/25646349
has body: I think dom4j+Xpath will resolve the problem , you just need to add jaxen dependency. // ContactInfo Element having key = 'keyTwo' Node node = document.selectSingleNode( "//Party/Contact/ContactInfo[Key = 'keyTwo']"); // retrieve data from the selected node String value = node... ; Maven : jaxen jaxen 1.1.6 Cheers.
has comment: http://stackoverflow.com/comment/40073133
has comment: http://stackoverflow.com/comment/40073067
answers question: http://stackoverflow.com/q/25646113
type: Answer
has comment: http://stackoverflow.com/comment/40079757
score: 0

http://stackoverflow.com/comment/40178016
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25702939
type: QuestionComment
has text: I would like to say than you toooooooooooo much

http://stackoverflow.com/a/25554071
has body: Well, 16 bits can store a number as high as 2^16 - 1 = 65535. That's assuming unsigned numbers (non-negative), which means it is not enough to represent of 5 digits decimal numbers. With 17 bits you can get represent unsigned numbers as high as 2^17 -1 = 131071.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25554001
type: Answer
downvote count: 0

http://stackoverflow.com/q/25576350
has body: I just want to start a activity on the first run. So after I run it once it should never open again.This Activity is added with &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; so this Activity starts first. I have a variable which helps me to decide if this Activity started for the first time or not (Im saving it with SharedPreferences which is called sem_first_time).When it is 0 then its the first time if not then this Activity have to finish and start another one. Here's my code @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences data = getSharedPreferences("datas",Context.MODE_PRIVATE); SharedPreferences.Editor editor = data.edit(); first_start = data.getInt("fstart", 0); if (first_start == 1) { finish(); Intent start = new Intent(this, Main.class); startActivity(start); } setContentView(R.layout.first_start); I got a Button which sets first_start to 1 public void create (View view) { SharedPreferences data = getSharedPreferences("datas",Context.MODE_PRIVATE); SharedPreferences.Editor editor = data.edit(); first_start = 1; editor.putInt("fstart", first_start); ... } But when I start this App once It is showing this Activity again ... What is wrong ?
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25576385
type: Question
has comment: http://stackoverflow.com/comment/39945636
has title: Run Activity only by first start
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39945688
score: 0

http://stackoverflow.com/comment/40128794
comment on: http://stackoverflow.com/a/25677160
score: 0
has text: @LuiggiMendoza 1- The OP is already using `switch` with `String`, but the `for-each` statement was introduced in Java 6, my bad for not been specific :P
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40161676
type: Comment
has text: My output looks like this now with your suggestion. Its almost right. 1 [Bird, Dog, Cat, Elephant, Tiger, Zebra] 2 [Bird, Dog, Cat, Elephant, Tiger, Zebra] 3 [Bird, Dog, Cat, Elephant, Tiger, Zebra] 4 [Bird, Dog, Cat, Elephant, Tiger, Zebra] 5 [Bird, Dog, Cat, Elephant, Tiger, Zebra] 6 [Bird, Dog, Cat, Elephant, Tiger, Zebra]
comment on: http://stackoverflow.com/a/25694717
type: AnswerComment
score: 0

cdi
type: Tag
tags question: http://stackoverflow.com/q/25647760
tags question: http://stackoverflow.com/q/25573479
tag name: cdi
tags question: http://stackoverflow.com/q/25630370

http://stackoverflow.com/comment/39984794
score: 0
comment on: http://stackoverflow.com/q/25597683
type: Comment
type: QuestionComment
has text: @user3651293 answer posted for you acceptance with output

http://stackoverflow.com/a/25630416
type: Answer
score: 0
has body: this server maybe dont promise the some request that has invalid HTTP request . you can send your HTTP header file with you request and server will promise you to download this image if its need the some HTTP header information . something like this : URL myURL = new URL(serviceURL); HttpURLConnection myURLConnection = (HttpURLConnection)myURL.openConnection(); String userCredent = "username:password"; myURLConnection.setRequestProperty ("property", value); myURLConnection.setRequestMethod("POST");
answers question: http://stackoverflow.com/q/25630202

http://stackoverflow.com/q/25601759
downvote count: 0
has answer: http://stackoverflow.com/a/61914609
has comment: http://stackoverflow.com/comment/39992043
favorite count: 0
has comment: http://stackoverflow.com/comment/39992555
type: Question
has comment: http://stackoverflow.com/comment/39991945
has comment: http://stackoverflow.com/comment/39994186
has comment: http://stackoverflow.com/comment/39992097
has comment: http://stackoverflow.com/comment/39992514
has comment: http://stackoverflow.com/comment/39992117
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/39994328
has comment: http://stackoverflow.com/comment/39991869
has comment: http://stackoverflow.com/comment/39992054
tagged with: date
has comment: http://stackoverflow.com/comment/39992420
has title: Hibernate 3.6.7-final java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
tagged with: timestamp
score: 2
has comment: http://stackoverflow.com/comment/39992402
has comment: http://stackoverflow.com/comment/39992301
upvote count: 2
tagged with: java
tagged with: hibernate
has body: I have this field in my entity. @Column(name = "CREATED_DATE") @Temporal(TemporalType.DATE) @DateTimeFormat(style = "yyyy-MM-dd-HH.mm.ss.SSSSSS") private Date createdDate; When i use TemporalType.TIMESTAMP i get the following error: Caused by: java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff] at java.sql.Timestamp.valueOf(Unknown Source) ~[na:1.6.0_45] at oracle.jdbc.driver.CharCommonAccessor.getTimestamp(CharCommonAccessor.java:544) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0] at oracle.jdbc.driver.T4CCharAccessor.getTimestamp(T4CCharAccessor.java:851) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0] at oracle.jdbc.driver.OracleResultSetImpl.getTimestamp(OracleResultSetImpl.java:1408) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0] at oracle.jdbc.driver.OracleResultSet.getTimestamp(OracleResultSet.java:512) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0] at org.apache.commons.dbcp.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:300) ~[commons-dbcp-1.3.jar:1.3] at org.apache.commons.dbcp.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:300) ~[commons-dbcp-1.3.jar:1.3] at org.hibernate.type.descriptor.sql.TimestampTypeDescriptor$2.doExtract(TimestampTypeDescriptor.java:62) ~[hibernate-core-3.6.7.Final.jar:3.6.7.Final] at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64) ~[hibernate-core-3.6.7.Final.jar:3.6.7.Final] at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:254) ~[hibernate-core-3.6.7.Final.jar:3.6.7.Final] at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:250) ~[hibernate-core-3.6.7.Final.jar:3.6.7.Final] at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:230) ~[hibernate-core-3.6.7.Final.jar:3.6.7.Final] at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:331) ~[hibernate-core-3.6.7.Final.jar:3.6.7.Final] at org.hibernate.persister.entity.AbstractEntityPersi…
answer count: 1

http://stackoverflow.com/q/25564641
tagged with: code-formatting
has body: I have the following code in a Java file within Eclipse: @Annotation({"arg1", "arg2"}) public void method() { ... } I have an issue whereby CheckStyle dislikes that particular formatting and warns that: Whitespace Around: '}' is not preceded with whitespace. However the eclipse formatter will not allow me to add any whitespace and will remove it whenever I format. If I just wanted to remove the warning then I would have to disable the Whitespace Around rule for } within CheckStyle, but then it won't warn me when I screw up in other places, so don't want to do that. The authors of CheckStyle have added the option I would need, by allowing you to ignore Annotation Array Initialization curlies as it does for Array Initialization outside of annotations. However, CheckStyle have not released a new version with the update and have no roadmap for when they will do so. In any case, lets say that I agree with CheckStyle and would like a space before the }, how can I configure the formatter with my preference, or at the least, to not care about this issue? I am aware of @formatter:off, I am hoping for a one off solution in the formatter configuration, not something I have to use every time I use an array within an annotation.
tagged with: eclipse
type: Question
tagged with: checkstyle
score: 2
upvote count: 2
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25566722
has answer: http://stackoverflow.com/a/25566722
favorite count: 0
type: AnsweredQuestion
has title: How can I change the formatting of arrays within annotations in Eclipse?
tagged with: java

http://stackoverflow.com/comment/39968570
comment on: http://stackoverflow.com/a/25569873
score: 0
type: Comment
has text: The key passed here is actually an earlier output of KeyFactor.keyToString passed to the client by a GET api, now when client wants to get entity, it needs to pass back the String key it got for the GET (or list method).
type: AnswerComment

http://stackoverflow.com/q/25570617
tagged with: java
has comment: http://stackoverflow.com/comment/39934691
downvote count: 0
has answer: http://stackoverflow.com/a/25570859
has body: I'm working on a legacy system that has a custom exception that's used gosh-frickity-everywhere. It was inspired by the ServletException class, that said "well any time you have an exception in your Servlet, you'll want to throw this ServletException". As the system evolved (over 10 years) a more robust system of catching the exceptions at a higher level has taken place and it's no longer necessary to wrap every exception in this custom exception. (One could argue it never was, but that's another story. It's a stable app, so I tend not to complain too much!!) But we're not going to be refactoring them all at once, just slowly over time. However, one thing that would make things simpler going forward would be if the custom exception were a runtime exception instead of a checked exception. This way we wouldn't need to explicitly catch it everywhere, and legacy code that hasn't been refactored yet will just continue to throw this the same way as they'd throw a null pointer exception if one occurred. My question is... What are the side effects of taking a once checked exception and making it a runtime exception? I can't think of any, aside from warnings for unnecessary check and throws declarations, but it would be nice to get input from someone who has been down this road before.
has answer: http://stackoverflow.com/a/25571262
favorite count: 0
type: Question
upvote count: 8
has title: Making a checked exception a RuntimeException
has comment: http://stackoverflow.com/comment/39934556
has answer: http://stackoverflow.com/a/25570805
score: 8
has comment: http://stackoverflow.com/comment/39934592
tagged with: runtimeexception
answer count: 3
has comment: http://stackoverflow.com/comment/39934610
type: UnansweredQuestion

http://stackoverflow.com/a/25600742
score: 2
answers question: http://stackoverflow.com/q/25600575
has comment: http://stackoverflow.com/comment/40022957
type: Answer
has body: There is the singleton design pattern. It used to make sure that only one instance of a class can be created. public class MySingletonClass { private static MySingletonClass instance; public synchronized static MySingletonClass getInstance() { if (instance == null) { instance = new MySingletonClass(); // "lazy" initialization } return instance; } /** * private constructor can be called only inside of MySingleton class, but not from outside. */ private MySingletonClass() { // your code here } } So, to get an instance of this class in the code, a developer does not use the constructor. Developer uses the static method getInstance(). MySingletonClass mySingleton = MySingletonClass.getInstance(); Please be careful with singletons. Many novice developers abuse use of singletons and use them as global variables. Don't do it :) UPDATE: I added synchronized to the getInstance() method to make it thread safe.
upvote count: 2
has comment: http://stackoverflow.com/comment/39991900
downvote count: 0
has comment: http://stackoverflow.com/comment/39991072
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39991505
accepted answer of: http://stackoverflow.com/q/25600575

http://stackoverflow.com/a/25701848
has comment: http://stackoverflow.com/comment/40187154
has body: There is no such method in core Smack package which takes care of registering the Smack providers for the various packet (and packet extension) classes of Smack. Yes there is (although not in smack-core). So i have manually configure provide using configure(ProviderManager pm) method on this link Never manually configure the provider (at least not, if you are don't know what you are doing). Exception in thread "Smack Packet Reader (0)" java.lang.NoSuchMethodError: org.jivesoftware.smack.util.StringUtils.parseDate(Ljava/lang/String;)Ljava/util/Date; at org.jivesoftware.smackx.provider.DelayInformationProvider.parseExtension(DelayInformationProvider.java:45) You are seeing a NoSuchmethodError. For some reason, the parseDate method in StringUtils does not exists as excepted by DelayInformationProvider. Could it be that you are mixing Smack components of different major versions? Which Smack version do you use?
has comment: http://stackoverflow.com/comment/40186925
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25701308
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40185982
has comment: http://stackoverflow.com/comment/40184067
has comment: http://stackoverflow.com/comment/40187528
score: 2
answers question: http://stackoverflow.com/q/25701308
has comment: http://stackoverflow.com/comment/40213887
type: AcceptedAnswer

http://stackoverflow.com/a/25640005
score: 4
has body: Go to Settings->Editor->AutoImports->And click on optimize imports on the fly and also add unambigous imports on the fly
upvote count: 4
answers question: http://stackoverflow.com/q/25639896
downvote count: 0
type: Answer

http://stackoverflow.com/a/25680120
has body: If you use Servlet, in your service method use code like this. response.setHeader("Refresh", "10; URL=http://localhost:9090/J2EE_Exercise/index.html"); It will refresh my page in 10 seconds, and redirect it in "index.html" page which is the index page of my project named "J2EE_Exercise".
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25679530
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25578325
type: AnsweredQuestion
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39949325
tagged with: java
tagged with: string
type: Question
accepted answer: http://stackoverflow.com/a/25578354
possible better answer: http://stackoverflow.com/a/25578346
has answer: http://stackoverflow.com/a/25578354
has answer: http://stackoverflow.com/a/25578346
has title: Java regular expression to split the String
tagged with: regex
has body: How would I split a string upon one or more spaces in between, preserving the effect of having more than one space. e.g. when the input string is: s = "a bc de fg "; spl = s.split(" "); gives me the array {a, bc, de, fg}. how do I get the same array to 1-or-more spaces in between, like s = "a bc de fg "; TIA.

http://stackoverflow.com/comment/40009106
type: Comment
has text: When the user tries to buy a book in UserPage just check if flag == 0 or flag == 1. It looks like you already have the variable being transferred to that Activity.
comment on: http://stackoverflow.com/q/25610974
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40076906
comment on: http://stackoverflow.com/q/25647845
score: 0
type: QuestionComment
has text: For general info for exporting the files and reading, see the second example [from this post](http://stackoverflow.com/a/25636097/2587435). Create a `resources` folder for the files, then add the directory to the build path. Once you have the files on the build path, then use `InputStream is = getClass().getResourceAsStream("/file.ser")'`
type: Comment

http://stackoverflow.com/q/25660371
score: 0
tagged with: configuration
tagged with: java
has comment: http://stackoverflow.com/comment/40101059
has body: I need to change values of selected configuration properties at runtime which are loaded using spring's PropertyPlaceHolderConfigurer. Tried following two solutions but dint solve much, SOLUTION 1: Used PropertyOverrideConfigurer in my configuration file. Referred here But this solution only pushes values from overriden properties file to mentioned bean's property. But concern is, I got many beans referring to this property. All I need to override the default values at runtime at one place. This encouraged me to go for second solution below. SOLUTION 2: Use of maven surefire plugin as mentioned here. But i am not upto using any surefire for this sole purpose. Is there any spring configuration which helps me to override default property values in test profile. Thanks. Please let me know if I am not clear enough.
has title: How to override specific properties loaded from spring PropertyPlaceHolderConfigurer?
type: Question
linked to: http://stackoverflow.com/q/17752435
type: UnansweredQuestion
answer count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/40100265
has comment: http://stackoverflow.com/comment/40099487
has answer: http://stackoverflow.com/a/33549860

http://stackoverflow.com/comment/40196190
score: 0
type: AnswerComment
has text: @MadProgrammer Right now in the JDK 7 version that I am using, the document insertString method is threadsafe, if indeed the solution above is sound, I'll then need to investigate the ramifications of delivering my JDK7 built code on later JREs (I wont ask that question here for fear of downvotes given that I havent looked into that yet).
type: Comment
comment on: http://stackoverflow.com/a/25705034

http://stackoverflow.com/comment/39965419
type: QuestionComment
comment on: http://stackoverflow.com/q/25587265
has text: @SME_Dev Nah. That's not the problem. I just decided to type it again instead of copying and pasting it.
type: Comment
score: 0

http://stackoverflow.com/comment/39942183
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25572634
has text: I don't think I have array called maze. The IDE is giving me a yellow underline on Vector, pending.setElementAt(sq, pending.size() - 1);, pending.addElement(sq);, Vector(), and pending.addElement(new Sqr(startX, startY, RIGHT, false, false, false, true));. For the first Vector, when I hover over it it gives me this:Vector is a raw type. References to generic type Vector<E> should be parameterized.
type: Comment

http://stackoverflow.com/q/25660948
score: 0
tagged with: java
answer count: 1
has body: i'm new to OptaPlanner so this question can be trivial. Playing with CVRP example i've added some customer that overload the vehicle capacity obviously the problem is become not feasible. the result that i aim to achieve is obtain the route that involve only a subset of customer in order to not overload the vehicle's capacity and so not broke the hard constraint. i have think to use: a nullable variable, but it can't be used with chained graph. with factchange, remove entity that overload the capacity, but i think that using such workaround i can't obtain the best fit load capacity. any suggestion is really appreciate.
tagged with: optaplanner
type: Question
has answer: http://stackoverflow.com/a/25661816
has title: Optaplanner CVRP - capacity feasible (overconstrained optimization)
accepted answer: http://stackoverflow.com/a/25661816
type: AnsweredQuestion

http://stackoverflow.com/comment/39944550
type: Comment
score: 0
type: AnswerComment
has text: Me stupid! All my tests are there, except for this one (which I forgot to move).
comment on: http://stackoverflow.com/a/25575762

http://stackoverflow.com/a/25573262
has body: Tomcat is looking for a package private class called DemoServlet. You need to use the fully qualified class com.prem.controller.DemoServlet
answers question: http://stackoverflow.com/q/25573245
upvote count: 4
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/comment/40069442
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25644403
has text: @JonSkeet I'm using Kepler SR2 with JDK 1.6 (Java 6 compliance) and no error is shown :S

http://stackoverflow.com/q/25591365
answer count: 1
tagged with: eclipse
type: Question
has title: Building Android project on remote server from Eclipse
type: UnansweredQuestion
has body: I'm currently at a stage where I need to frequently rebuild my Android application in release mode (and using Proguard). My application is pretty complex, so each build in release mode from Eclipse takes around ~75 seconds, which is a huge waste of time when I'm doing this dozens of times. I have an Amazon AWS account and I can launch an instance with high CPU resources. Is there a script/plugin/built-in feature in Eclipse that would allow me to automatically send the code to the server to be built and then retrieve the finished APK?
tagged with: build
score: 0
has answer: http://stackoverflow.com/a/26529013
tagged with: android
tagged with: java

http://stackoverflow.com/comment/40183195
has text: Could you post the `PuzzleState` interface then? I hate to suggest a cast, but if something's broken (i.e., no suitable interface method)...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25706665

http://stackoverflow.com/q/25616096
has answer: http://stackoverflow.com/a/25616241
has title: NullPointerException on getReadableDatabase()
has comment: http://stackoverflow.com/comment/40018070
has answer: http://stackoverflow.com/a/25616138
has comment: http://stackoverflow.com/comment/40018074
tagged with: android-sqlite
accepted answer: http://stackoverflow.com/a/25616138
type: Question
has body: I have this method in a class (non-activity) - public boolean usernameChk(String usrname) { String usrnmQuery = "SELECT * FROM " + TABLE_ACCOUNTS + " WHERE username = '" + usrname + "'"; SQLiteDatabase db = this.getReadableDatabase(); //NullPointerException on line above Cursor cursor = db.rawQuery(usrnmQuery, null); cursor.close(); if (cursor.getCount() &lt;= 0) { return false; } else { return true; } } But I get NullPointerException on line SQLiteDatabase db = this.getReadableDatabase(); when I call this method from other activity - private Context context; this.context = context; new DatabaseHandler(this); DatabaseHandler dbz = new DatabaseHandler(context); boolean z = dbz.usernameChk(username.getText().toString()); Here is my LogCat - 09-02 10:28:11.906: W/ApplicationPackageManager(9380): getCSCPackageItemText() 09-02 10:28:12.171: D/OpenGLRenderer(9380): Enabling debug mode 0 09-02 10:28:13.881: W/ApplicationPackageManager(9380): getCSCPackageItemText() 09-02 10:28:18.436: D/AndroidRuntime(9380): Shutting down VM 09-02 10:28:18.436: W/dalvikvm(9380): threadid=1: thread exiting with uncaught exception (group=0x4180ec08) 09-02 10:28:18.441: E/AndroidRuntime(9380): FATAL EXCEPTION: main 09-02 10:28:18.441: E/AndroidRuntime(9380): Process: com.Atlantiz.diary, PID: 9380 09-02 10:28:18.441: E/AndroidRuntime(9380): java.lang.NullPointerException 09-02 10:28:18.441: E/AndroidRuntime(9380): at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224) 09-02 10:28:18.441: E/AndroidRuntime(9380): at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188) 09-02 10:28:18.441: E/AndroidRuntime(9380): at com.Atlantiz.diary.DatabaseHandler.usernameChk(DatabaseHandler.java:142) 09-02 10:28:18.441: E/AndroidRuntime(9380): at com.Atlantiz.diary.Create.onClick(Create.java:42) 09-02 10:28:18.441: E/AndroidRuntime(9380): at android.view.View.performClick(View.java:4633) 09-02 10:28:18.441: E/AndroidRuntime(9380): at android.…
has comment: http://stackoverflow.com/comment/40018292
has answer: http://stackoverflow.com/a/25616234
possible better answer: http://stackoverflow.com/a/25616234
tagged with: nullpointerexception
answer count: 5
tagged with: android
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/40018096
has answer: http://stackoverflow.com/a/56470996
has answer: http://stackoverflow.com/a/25616236
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39991604
type: QuestionComment
has text: Please provide the specific code to reproduce the problem. Do not explain your code problem in plain words only.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25601644

http://stackoverflow.com/comment/40076671
type: Comment
has text: when you look at my tutorial you don't even need a canvas ^^ @user3750325
type: AnswerComment
comment on: http://stackoverflow.com/a/25617232
score: 0

http://stackoverflow.com/q/25606355
answer count: 0
tagged with: java
tagged with: sqlite
has comment: http://stackoverflow.com/comment/40000633
has comment: http://stackoverflow.com/comment/40000529
has title: java sqlite fetching entire table content
type: Question
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40000496
has comment: http://stackoverflow.com/comment/40000697
has body: I have a SQLite database. Now I try to create a function, that fetches the entire table content and returns it as an Array or ArrayList or whatever. How do I do that the best way? Can I directly convert the cursor into an array of strings and add that to an arraylist? If so, how? Should I create a map for each row the cursor traverses through, and add the strings into that, with their keys? I tried that, but it didn't work. I haven't programmed anything in Java for many years. Thanks for any help.
score: 0
has comment: http://stackoverflow.com/comment/40000465
has comment: http://stackoverflow.com/comment/40000429

http://stackoverflow.com/comment/40018521
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25616074
type: QuestionComment
has text: Component must have a valid peer pops up when you don't show your component. That means: your component isn't brought to front! create and show your frame and components FIRST and your buffer/bufferstragey SECOND - then render!

http://stackoverflow.com/comment/40073364
has text: import javax.persistence.OrderBy does sorting with HashSet only. Then i tried using import org.hibernate.annotations.OrderBy;
comment on: http://stackoverflow.com/a/25646614
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25642642
answer count: 3
accepted answer: http://stackoverflow.com/a/25642768
downvote count: 0
tagged with: locking
upvote count: 1
score: 1
tagged with: java
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/25644342
favorite count: 0
has answer: http://stackoverflow.com/a/25644342
type: Question
type: AnsweredQuestion
tagged with: static
has body: Does it mean that any Thread irrespective of the object it obtain will not interfere other Thread executing in Synchronized static method. Even if we call with class_name.static_Method. Ex- If we have two thread : public class Test implements Runnable { public synchronized static testMethod(){} public void run(){ testMethod(); } public static void main(String[] args) { Test obj1=new Test(); Test obj2=new Test(); Thread t1=new Thread(obj1); Thread t2=new Thread(obj2); t1.start(); // thread on object obj1 t2.start(); // Thread on object obj2 Test.testMethod(); // main thread } } If Thread t1 enters static method then t2 and main thread will not enter the method even though both have different object. Correct me If I am wrong.
has title: Static Synchronized method provides Class level lock. What does Class Level Lock means?
has answer: http://stackoverflow.com/a/25642848
has answer: http://stackoverflow.com/a/25642768

http://stackoverflow.com/comment/39932341
comment on: http://stackoverflow.com/q/25569437
score: 0
type: QuestionComment
has text: Good question, updated my answer to make the problem clearer.
type: Comment

http://stackoverflow.com/comment/40082034
type: AnswerComment
has text: @jjj: Re "I don't think it's even retrieving XML from url" - I think it must be, because otherwise, the `builder.parse("http://...")` would throw an exception.
comment on: http://stackoverflow.com/a/25648549
type: Comment
score: 0

http://stackoverflow.com/comment/40067969
type: Comment
type: AnswerComment
has text: I made the abstract method protected.
score: 0
comment on: http://stackoverflow.com/a/25610522

http://stackoverflow.com/q/25692328
duplicate of: http://stackoverflow.com/q/22152982
answer count: 2
has title: Iterator.class vs Iterator<String>.class
upvote count: 1
downvote count: 0
favorite count: 0
has body: I wanted to obtain class object of Iterator and discovered that Iterator&lt;String&gt;.class is not valid. This highlighted a question if its possible at all to use ".class" syntax for Object&lt;T&gt; kind of objects in Java. If yes, then how it can be done? If not, what are the alternatives ? I am doing Mocking for Iterator using Mockito's Mockito.mock(Class&lt;T&gt;) syntax.
has comment: http://stackoverflow.com/comment/40157101
type: AnsweredQuestion
tagged with: reflection
linked to: http://stackoverflow.com/q/1652692
score: 1
has answer: http://stackoverflow.com/a/25692375
has answer: http://stackoverflow.com/a/25692393
tagged with: java
possible better answer: http://stackoverflow.com/a/25692393
accepted answer: http://stackoverflow.com/a/25692375
linked to: http://stackoverflow.com/q/22152982
type: Question

http://stackoverflow.com/a/39344179
answers question: http://stackoverflow.com/q/25609815
downvote count: 1
upvote count: 0
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/139665914
has body: Have a look at: http://dr-brenschede.de/bheapsampler/ This generates a graph using graphviz.

http://stackoverflow.com/q/25631382
tagged with: android
has comment: http://stackoverflow.com/comment/40048386
has comment: http://stackoverflow.com/comment/40055084
score: -1
has title: Filtering list of apps in custom baseadapter
has comment: http://stackoverflow.com/comment/40057301
has comment: http://stackoverflow.com/comment/40055344
has comment: http://stackoverflow.com/comment/40051318
has comment: http://stackoverflow.com/comment/40057096
upvote count: 0
has body: I am trying to implement a searchview for my listview of my installed apps with my baseadapter class. Currently it looks like this: The problem is that when I hit it crashes with 09-02 19:56:47.925 1628-1628/com.spicycurryman.getdisciplined10.app.dev E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.spicycurryman.getdisciplined10.app.dev, PID: 1628 java.lang.NullPointerException at com.spicycurryman.getdisciplined10.app.BlockActivity$2.onQueryTextSubmit(BlockActivity.java:126) because I'm not sure how set up my listview and adapter Currently this is my fragment class: package com.spicycurryman.getdisciplined10.app; import android.annotation.TargetApi; import android.app.ActionBar; import android.app.FragmentTransaction; import android.app.SearchManager; import android.content.Context; import android.content.pm.ActivityInfo; import android.os.Build; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBarActivity; import android.support.v7.widget.SearchView; import android.text.Spannable; import android.text.SpannableString; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.ArrayAdapter; import android.widget.ListView; import com.ibc.android.demo.appslist.app.ApkAdapter; import info.androidhive.tabsswipe.adapter.TabsPagerAdapter; /** * Created by Spicycurryman on 6/17/14. */ public class BlockActivity extends ActionBarActivity implements ActionBar.TabListener, SearchView.OnQueryTextListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; ApkAdapter mAppAdapter; private ListView mListView; private ArrayAdapter&lt;String&gt; hanadapter; SearchManager searchManager; SearchView searchView; // Tab titles private String[] tabs = {"Installed Apps"}; @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override protected void onCreate(Bundle savedInstanceState) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATI…
has comment: http://stackoverflow.com/comment/40047928
has comment: http://stackoverflow.com/comment/40046353
has comment: http://stackoverflow.com/comment/40056867
tagged with: android-listview
tagged with: java
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40046376
tagged with: baseadapter
has comment: http://stackoverflow.com/comment/40054619
has comment: http://stackoverflow.com/comment/40076496
favorite count: 0
type: Question
tagged with: searchview
has comment: http://stackoverflow.com/comment/40076438
has comment: http://stackoverflow.com/comment/40046385
has answer: http://stackoverflow.com/a/25631651
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40057539

http://stackoverflow.com/a/25570252
upvote count: 2
has body: Assuming you are not Google, but you do want to use your own website, which you can modify, I suggest that you place a javascript on your webpage, that calls a native method inside your Android app and just submitts the value from this textfield. There is already a thread on that topic here: android - get Text out of webview
has comment: http://stackoverflow.com/comment/39991210
type: Answer
has comment: http://stackoverflow.com/comment/39950298
has comment: http://stackoverflow.com/comment/39985614
has comment: http://stackoverflow.com/comment/39953050
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25566553

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/25584656
type: Tag
tags question: http://stackoverflow.com/q/25569969
tags question: http://stackoverflow.com/q/25588782

http://stackoverflow.com/q/25572243
has comment: http://stackoverflow.com/comment/39938372
has answer: http://stackoverflow.com/a/25574478
has comment: http://stackoverflow.com/comment/39938820
has comment: http://stackoverflow.com/comment/39938678
has comment: http://stackoverflow.com/comment/39945070
accepted answer: http://stackoverflow.com/a/25574478
has comment: http://stackoverflow.com/comment/39938126
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/39938158
upvote count: 3
tagged with: java
tagged with: user-interface
downvote count: 0
has comment: http://stackoverflow.com/comment/39938554
answer count: 1
has comment: http://stackoverflow.com/comment/39938086
tagged with: swing
has title: Need a little help, in hiding/disabling the jbutton
favorite count: 0
tagged with: jbutton
type: Question
score: 3
has comment: http://stackoverflow.com/comment/39938454
has body: I am working on an student/admin portal application and I need a little help in hiding/enabling the jbuttons. If the user is logged in as an admin, the jbutton should be enabled/appear. If the user is logged in as a student, the jbutton should be disabled/disappear. For example, I have button 1 in Jframe1 and will hide the button in JFrame2. Please find the code below - the one that is in double asterisk is my code for setting the visibility of the jbutton in frame2 to hide. I have also set the jbutton's variable modifier as public. FORM 1 - login package testlogin; import java.sql.*; import javax.swing.JOptionPane; //////////////////////////////// public class login extends javax.swing.JFrame { public welc welc; public Statement st; public int xtry =1,ytry=4,trig; Connection conn=null; PreparedStatement pst =null; ResultSet rs =null; /// public login() { initComponents(); conn=mysqlconnect.Connectdb(); //class connection } ////////// @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); user1 = new javax.swing.JTextField(); submitbtn = new javax.swing.JButton(); pass1 = new javax.swing.JPasswordField(); jPanel2 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setMaximumSize(new java.awt.Dimension(350, 300)); setMinimumSize(new java.awt.Dimension(350, 100)); setName("Login"); // NOI18N setPreferredSize(new java.awt.Dimension(350, 230)); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt); } }); jLabel1.setText("LOGIN"); jLab…
has comment: http://stackoverflow.com/comment/39939283
has comment: http://stackoverflow.com/comment/39938753

http://stackoverflow.com/comment/40079311
comment on: http://stackoverflow.com/q/25646891
score: 0
type: Comment
type: QuestionComment
has text: I'm curious, have you even attempted my answer? If you don't want the circles to change, that's the way to go. Like I said, don't do the random operation in the paint method. Create the circles outside the method

http://stackoverflow.com/comment/40090254
type: QuestionComment
comment on: http://stackoverflow.com/q/25655437
has text: The problem is that even with me trying to get the spawn point to change to a location defined by the map, it isn't, despite my best efforts.
type: Comment
score: 0

http://stackoverflow.com/q/25691415
has answer: http://stackoverflow.com/a/25691614
accepted answer: http://stackoverflow.com/a/25691614
upvote count: 70
possible better answer: http://stackoverflow.com/a/25691416
has answer: http://stackoverflow.com/a/51601734
tagged with: trim
linked to: http://stackoverflow.com/q/3796121
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/47608492
downvote count: 0
score: 70
has body: How can I trim the leading or trailing characters from a string in java? For example, the slash character "/" - I'm not interested in spaces, and am looking to trim either leading or trailing characters at different times.
tagged with: string
has answer: http://stackoverflow.com/a/25691416
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/47310313
has answer: http://stackoverflow.com/a/48094919
tagged with: java
has title: Trim leading or trailing characters from a string?
answer count: 6

http://stackoverflow.com/a/25701189
type: Answer
answers question: http://stackoverflow.com/q/25701147
downvote count: 0
upvote count: 1
score: 1
has body: Try: int lengthNoNull = 0; for(String a : asd) { if(a != null) { lengthNoNull++; } } String[] newAsd = new String[lengthNoNull]; int i = 0; for(String a : asd) { if(a != null) { newAsd[i++] = a; } }

http://stackoverflow.com/comment/39939169
type: AnswerComment
comment on: http://stackoverflow.com/a/25572833
has text: @Teakon It would be a `List<Function>`.
type: Comment
score: 0

http://stackoverflow.com/q/25707710
has comment: http://stackoverflow.com/comment/40184752
tagged with: android
has body: I'm using this function that I got from another question for copy an image: public static boolean copyFile(String from, String to) { try { File sd = Environment.getExternalStorageDirectory(); if (sd.canWrite()) { int end = from.toString().lastIndexOf("/"); String str1 = from.toString().substring(0, end); String str2 = from.toString().substring(end+1, from.length()); File source = new File(str1, str2); File destination= new File(to, str2); if (source.exists()) { FileChannel src = new FileInputStream(source).getChannel(); FileChannel dst = new FileOutputStream(destination).getChannel(); dst.transferFrom(src, 0, src.size()); src.close(); dst.close(); } } return true; } catch (Exception e) { return false; } } and I'm using that in this way: String filePath = Helper.pathgal(act, data.getData()); File mydir = new File(Environment.getExternalStorageDirectory() + "/Albummaker/Pics/"); if (!mydir.exists()) { mydir.mkdirs(); } else { Log.d("error", "dir. already exists"); } String dest = mydir.getAbsolutePath(); copyFile(filePath, dest); // now I want to use destination file path for using in a bitmap bmp = Helper.decodeFile(dest, act); // now I'm loading that bitmap in an imageview Helper.showpic(act, id1, bmp); But It's not showing in ImageView (If I use original file path it's working though). the copy function is working and the image file exist in final filepath but I think I should add file name some how to "mydir" file path for using in bitmap.
has answer: http://stackoverflow.com/a/25707767
type: AnsweredQuestion
has title: how to get filepath after copy?
score: 0
has comment: http://stackoverflow.com/comment/40184910
has comment: http://stackoverflow.com/comment/40184901
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25707767
type: Question

http://stackoverflow.com/a/25699358
accepted answer of: http://stackoverflow.com/q/25699308
has comment: http://stackoverflow.com/comment/40191966
answers question: http://stackoverflow.com/q/25699308
score: 0
type: AcceptedAnswer
has body: directly access system display memory on Linux You can't. Linux is a memory protected virtual address space operating system. Ohh, the kernel gives you access to the graphics memory through some node in /dev but that's not how you normally implement this kind of thing. Also in Linux you're normally running a display server like X11 (or in the future something based on the Wayland protocol) and there might be no system graphics memory at all. I have researched a bit and found that one way to achieve this is to capture the screen at a high frame rate (screen shot), convert it into RAW format, compress it and store it in an ArrayList. That's exactly how its done. Use the display system's method to capture the screen. It's the only reliable way to do this. Note that if conversion or compression is your bottleneck, you'd have that with fetching it from graphics memory as well.
type: Answer

http://stackoverflow.com/q/25567398
tagged with: java
tagged with: javafx
tagged with: webview
has body: I need to get the full filepath of the user's selected file. HTML &lt;input name="attachFiles" id="attachFiles" type="file"/&gt; Java HTMLInputElement attachFiles = WebMisc.getHTMLInputElement(webEngine, "attachFiles"); final String filename = attachFiles.getValue(); However, filename is always C:\fakepath\&lt;file name&gt; How do I get the real full filepath? This is used for a web-looking UI. All the real work is still done by myself, not the WebEngine.
favorite count: 0
type: Question
tagged with: javafx-webengine
type: UnansweredQuestion
has title: how to get filepath from JavaFX WebView?
score: 2
upvote count: 2
tagged with: security
downvote count: 0
answer count: 0

http://stackoverflow.com/q/25650158
has title: Alfresco 5.0: AuthenticationUtils.startSession generate 404
accepted answer: http://stackoverflow.com/a/25667403
has comment: http://stackoverflow.com/comment/40100972
tagged with: alfresco
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25667403
possible better answer: http://stackoverflow.com/a/35946824
tagged with: web-services
has comment: http://stackoverflow.com/comment/40086946
tagged with: cmis
tagged with: alfresco-share
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/35946824
has body: I'm working on an old project and, due to the short time to deploy new release, I cannot migrate the upload of content using CMIS so, I need to use old WebServiceFactory code to create binary into Alfresco. But, with the new release of Alfresco (5.0.a) I'm not able to obtain the authorization using: WebServiceFactory.setEndpointAddress("http://localhost:8080/alfresco/api"); AuthenticationUtils.startSession(userName, password); This is the error I'm getting: Caused by: (404)Not Found at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) Any clue? Do you know if there a really (really really) fast way to create folder and update binary from Java classes? thanks, Andrea

http://stackoverflow.com/q/25667381
upvote count: 1
has answer: http://stackoverflow.com/a/25667433
tagged with: regex
has body: I have some String like this String text = "&amp;gt;www.stackoverflow.com&amp;lt;something else" now I'm looking for a regexp pattern to capture solely www.stackoverflow.com but keep in mind that the URL can contain the ampersand. The pattern needs to match exactly the &amp;lt; substring. I have so far this regexp: (www.)([-a-zA-Z0-9@:%_\\+,.~#?!&amp;\\/=äöü]+(?![&amp;lt]).) but, of course, it doesn't work.
has answer: http://stackoverflow.com/a/25667502
favorite count: 0
type: Question
downvote count: 0
possible better answer: http://stackoverflow.com/a/25667598
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25667598
answer count: 3
has title: Regexp pattern to stop at &lt;
accepted answer: http://stackoverflow.com/a/25667433
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/comment/40090283
type: AnswerComment
has text: That was the levelColor code for GRASS. I was just trying to get the player to spawn anywhere but at 0, 0. Even with it being 0xffff0000, it doesn't do it.
type: Comment
comment on: http://stackoverflow.com/a/25655480
score: 0

http://stackoverflow.com/a/25639594
type: Answer
has comment: http://stackoverflow.com/comment/40064626
answers question: http://stackoverflow.com/q/25639279
score: 0
has comment: http://stackoverflow.com/comment/40064924
has body: To access anything from one fragment to another, you can create its static instance like below- private static FragmentOne fragmentOne; public static FragmentOne getInstance() { if (fragmentOne == null) { fragmentOne = new FragmentOne(); } return fragmentOne; } //you have edit text public EditText myEditText; Now in second fragment, you can access it by- FragmentOne.getInstance().myEditText
has comment: http://stackoverflow.com/comment/40064537
has comment: http://stackoverflow.com/comment/40064717

http://stackoverflow.com/q/25699568
linked to: http://stackoverflow.com/q/5126090
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25699687
downvote count: 3
score: -3
answer count: 1
tagged with: maven
favorite count: 0
has body: All I want is the project file/jar for this project: http://thiagolocatelli.github.io/parse4j/ It says I need to do the following to obtain it: Getting Started Download the library manually Maven ... com.github.thiagolocatelli parse4j 1.3 ... I have never used Maven, do not really know what it is. Can someone advice me how I obtain the project file?
type: Question
has title: Download project via Maven
has comment: http://stackoverflow.com/comment/40172032
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/39960478
comment on: http://stackoverflow.com/a/25584396
type: Comment
has text: Okay, this work doesn't cover reading from a text file. I don't remember the functions at the top of my head to do that. However, if you are able to get that String from a text file (e.g. P1;5;3;-4;1;8;0) then you simply do Poly name = new Poly("P1;5;3;-4;1;8;0", anyDoubleValueForX); This will load all the values into the ArrayList that has been constructed. Going with the String above, getValue() for index 0 represents 5, getX()=anyDoubleValueForX, getExponent() = 3. To access them, just simply do name.getFunc().get(0).getValue(); and so on and use those values to work it out with a math lib.
type: AnswerComment
score: 0

http://stackoverflow.com/q/25632914
favorite count: 0
type: Question
type: AnsweredQuestion
has title: Making a Scrollable UI in Libgdx
has body: Okay So today I sat down to make a options panel that would allow you to scroll down through the list of options and for some reason I drew a blank... Anyone got an example at where I could get started for some reason I can't seem to see in my mind how to do it though It seems really simple.
tagged with: libgdx
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25647116
accepted answer: http://stackoverflow.com/a/25647116
upvote count: 1
answer count: 1
tagged with: user-interface
downvote count: 0

http://stackoverflow.com/comment/40195531
type: Comment
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/25682471
has text: Sudo for IDEA is unacceptable. Let's strive for something better. What user do you run IDEA under? What are the permissions for the .ivy2 directory? I think you once ran sbt/activator/IDEA using sudo and that messed up the local repo's permission. Could you rename .ivy2 directory and start over a sbt session?

http://stackoverflow.com/comment/40111959
has text: Thanks, so you suggest to switch to AtomicBoolean and to add a check for its value as part of the loop. I should have added this type of check also to my original code with the volatile. But can you explain why AtomicBoolean is preferable over volatile in this case? performance-wise I thought that they are pretty much the same since both are lock-free and are not cached.
comment on: http://stackoverflow.com/a/25666830
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40189478
type: QuestionComment
has text: `\d+|\d+.\d+` will not work as you want because before regex will try to test if string is match for `\d+.\d+` it will first test for `\d+`. It happenes because pattern is being redden from left to right (parts from left have higher precedence than ones from right). Same rule applies for `fo|foo` regex. It will never be able to match `foo` because it first two characters of `foo` will be matched by `fo`. To solve this problem you could change order of `OR` (`|`) arguments (subregexes) to first thy to match `\d+\.\d+` instead if `\d+`, so try with `\d+\.\d+|\d+`.
score: 0
comment on: http://stackoverflow.com/q/25707779
type: Comment

http://stackoverflow.com/q/25691312
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40158503
tagged with: jpa
has title: ClassNotFoundException: org.hibernate.ejb.HibernatePersistence with spring, glassfish, hibernate and mysql
tagged with: spring
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40159332
tagged with: mysql
has comment: http://stackoverflow.com/comment/40154916
has comment: http://stackoverflow.com/comment/40154850
type: Question
has body: I'm trying to develop a simple application using JavaEE, Spring, Glassfish 4, jpa (hibernate) and mysql. but im having problems with the Hibernate Persistence class. I get the following exception: 2014-09-05T14:08:53.651-0300|Grave: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:167) at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107) at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223) at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510) at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230) at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168) at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:922) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:431) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) ... For other questions are resolved by adding dependencies to pom.xml. But I'm trying to fix it since a few days ago, and I always receive the same error. here its the pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.companyname springapp war 0.0.1-SNAPSHOT springapp Maven Webapp http://maven.apache.org junit junit 4.11 test org.springframework spring-core ${org.springframework.version} org.springframework spring-webmvc ${org.springframework.version} org.springframework spring-orm ${org.springframework.version} org.springframework spring-context ${org.springframework.version} javax.servlet servlet-api 2.5 provided jstl jstl 1.2 taglibs standard 1.1.2 javax.validation valida…
answer count: 0

http://stackoverflow.com/comment/85194463
comment on: http://stackoverflow.com/a/32064236
type: Comment
score: 0
type: AnswerComment
has text: Great, thanks a lot. Adding org.gradle.configureondemand=true helped me.

http://stackoverflow.com/q/25699308
score: 1
has title: How to access system display memory / frame buffer in a Java program?
tagged with: memory
favorite count: 0
tagged with: vnc
type: Question
accepted answer: http://stackoverflow.com/a/25699358
downvote count: 0
has answer: http://stackoverflow.com/a/25699358
tagged with: python
answer count: 1
has body: I am trying to create my own VNC client and would like to know how to directly access system display memory on Linux? So that I can send it over a Socket or store it in a file locally. I have researched a bit and found that one way to achieve this is to capture the screen at a high frame rate (screenshot), convert it into RAW format, compress it and store it in an ArrayList. But, I find this method a bit too resource heavy. So, was searching for alternatives. Please, let me also know if there are other ways for the same (using Java or Python only)?
type: AnsweredQuestion
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/40104491
type: QuestionComment
comment on: http://stackoverflow.com/q/25663501
type: Comment
score: 0
has text: Hi Duncan, This is printing the date in a different timezone. But i really want a 'Date' object with the new time zone so that when i print the new date, it prints the new timezone that we have set.

http://stackoverflow.com/q/25561865
tagged with: switch-statement
has answer: http://stackoverflow.com/a/25561931
type: Question
has answer: http://stackoverflow.com/a/25561904
has answer: http://stackoverflow.com/a/25561902
has answer: http://stackoverflow.com/a/25561922
has body: I want to make the ImageView work as button, because I want it be able to click and go to another activity. Each imageView(button) should contain its own value. The problem is, I don't know how to pass the value in the imageView(button) to another activity. This is what I have tried so far: public class ButtonClickHandler implements View.OnClickListener { public void onClick(View view) { String value = " "; switch(view.getId()) { case R.id.imageView2: value = "5"; break; case R.id.imageView6: value = "10"; break; case R.id.imageView3: value = "30"; break; case R.id.imageView02: value = "50"; break; case R.id.imageView06: value = "100"; break; default: break; } if(view.getId()==R.id.imageView2){ //get the value from switch case and send to other activity }
tagged with: if-statement
tagged with: android
has answer: http://stackoverflow.com/a/25561933
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25561911
answer count: 7
tagged with: eclipse
has answer: http://stackoverflow.com/a/25562058
has title: How to assign value in button and display the value at other activity?
possible better answer: http://stackoverflow.com/a/25561902
accepted answer: http://stackoverflow.com/a/25562058

http://stackoverflow.com/comment/40011086
type: Comment
type: QuestionComment
has text: Hi, try this: http://stackoverflow.com/questions/4015579/how-to-open-one-jsp-from-another-through-struts
comment on: http://stackoverflow.com/q/25611753
score: 0

http://stackoverflow.com/comment/40184963
has text: I think you can get the path via File desFile = copyFile(filePath, dest); Helper.decodeFile(desFile.getAbsolutePath(), act);
comment on: http://stackoverflow.com/a/25707767
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39926402
type: AnswerComment
comment on: http://stackoverflow.com/a/25566353
score: 0
type: Comment
has text: Yes, it was in microseconds: new Date(1409304572565675L / 1000) is perfect, thanks!

http://stackoverflow.com/q/25687635
has title: struts2 json result type for ajaxfile upload
tagged with: java
has comment: http://stackoverflow.com/comment/40147918
tagged with: http://stackoverflow.com/tag/json
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40147885
tagged with: struts2
score: 0
answer count: 0
has body: I have code as below, but still i am getting json result as download file. I couldn't find where is the mistake. i am using ajaxfileupload.js jquery-1.7.2.min.js struts2-core-2.3.4.jar struts2-json-plugin-2.3.4.jar my Struts.xml text/html text/html My Ajax script: function validateFile(Url, resultID, buttonId) { $('#validatesuccessId').attr('style','display:none'); $("#loading") .ajaxStart(function(){ $(this).show(); }) .ajaxComplete(function(){ $(this).hide(); }); $.ajaxFileUpload({ url:Url,// secureuri:false,//false fileElementId:'fileToUpload',//id dataType: 'json',// json success: function (data, status) // { alert(data.successMessage);//jsonmessage,messagestruts2 if(typeof(data.error) != 'undefined') { if(data.error != '') { alert(data.error); }else { alert(data.message); } } }, error: function (data, status, e) { alert(e); } } ); return false; } My Action class public String validateFile() throws ApplicationException { //******* Application logic with uploaded file****** this .setSuccessMessage("Are you sure you want to upload the file"); this.getHttpResponse().setContentType("text/html"); return Action.SUCCESS; }
tagged with: javascript
tagged with: jquery
type: Question

http://stackoverflow.com/a/25566355
answers question: http://stackoverflow.com/q/25566289
score: 0
type: Answer
has body: You can use setTimeInMillis() method on a Calendar object: Calendar c = Calendar.getInstance(); c.setTimeInMillis(temp);

http://stackoverflow.com/comment/40176204
has text: Why do you think you can check a signature without the public key **or** the document?
comment on: http://stackoverflow.com/q/25703092
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/77684936
has text: @snaran This question was answered three years ago. Since then, Doug has added many examples in the CC class. The example you mention is horrendously complex, not something one would normally want. I don't know how a RecursiveAction could do this easily since there is no single focal point for all the Tasks. The key work is "easily", anyone can make a messy program (as Doug did with the CC example.) But, if you have an example then show us.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25691334
type: AnswerComment

http://stackoverflow.com/q/25580887
has title: Fragment in Android programming
has comment: http://stackoverflow.com/comment/39953901
answer count: 1
has comment: http://stackoverflow.com/comment/39954000
accepted answer: http://stackoverflow.com/a/25583429
type: Question
tagged with: android-fragments
has answer: http://stackoverflow.com/a/25583429
tagged with: android
has body: I think that it's a bit difficult to explain the problem but I'll try. I have a class which extends Fragment and I call it with the follow code frag = new SearchDoctor(); fragTransaction = getFragmentManager().beginTransaction().replace(R.id.container, frag); fragTransaction.commit(); Here is a part of class code @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub rootView = inflater.inflate(R.layout.search_doctor, container, false); spinnerCity = (Spinner) rootView.findViewById(R.id.cityList); The first time that class is called it's alright. But the next time when I call it thead exit at the line "rootView = inflater.inflate(R.layout.search_doctor, container, false);". I have understand that the problem is with the fragment that contained in search_doctor.xml (layout) because I had tried it with other layouts many times and it was any problem. Here is the layout search_doctor.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;Spinner android:id="@+id/cityList" android:layout_width="match_parent" android:layout_height="wrap_content" android:entries="@array/city_arrays" android:prompt="@string/city_prompt" /&gt; &lt;Button android:id="@+id/btnSearch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_below="@+id/specialtyList" android:layout_marginRight="16dp" android:text="Αναζήτηση" /&gt; &lt;Spinner android:id="@+id/specialtyList" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/cityList" android:entries="@array/specialty_arrays" android:prompt="@string/specialty_prompt" /&gt; &lt;fragment android:id="@+id/map" android:name="com.google.android.gms.maps.Ma…
has comment: http://stackoverflow.com/comment/39957389
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39956491
tagged with: java

mongodb
tags question: http://stackoverflow.com/q/25666330
tags question: http://stackoverflow.com/q/25675686
tags question: http://stackoverflow.com/q/25687649
tags question: http://stackoverflow.com/q/25644149
tags question: http://stackoverflow.com/q/25661457
tag name: mongodb
tags question: http://stackoverflow.com/q/25682001
tags question: http://stackoverflow.com/q/25576153
tags question: http://stackoverflow.com/q/25608189
tags question: http://stackoverflow.com/q/25606877
tags question: http://stackoverflow.com/q/25622866
tags question: http://stackoverflow.com/q/25619487
tags question: http://stackoverflow.com/q/25690609
tags question: http://stackoverflow.com/q/25611053
tags question: http://stackoverflow.com/q/25600736
tags question: http://stackoverflow.com/q/25569128
tags question: http://stackoverflow.com/q/25647834
tags question: http://stackoverflow.com/q/25565608
tags question: http://stackoverflow.com/q/25696403
type: Tag
tags question: http://stackoverflow.com/q/25569125
tags question: http://stackoverflow.com/q/25558334
tags question: http://stackoverflow.com/q/25673135
tags question: http://stackoverflow.com/q/25595962
tags question: http://stackoverflow.com/q/25600789
tags question: http://stackoverflow.com/q/25658787
tags question: http://stackoverflow.com/q/25586853
tags question: http://stackoverflow.com/q/25625104
tags question: http://stackoverflow.com/q/25646047

http://stackoverflow.com/comment/40166332
score: 0
type: AnswerComment
has text: yes, it will. check it by executing above example.
comment on: http://stackoverflow.com/a/25697104
type: Comment

http://stackoverflow.com/comment/40002505
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25607282
has text: @PeterLawrey Because I don't want to copy the entire bytebuffer but only the bytes from `header.fileofs` to `header.fileofs + header.filelen`.

http://stackoverflow.com/comment/40021881
type: QuestionComment
has text: check your pom, you may be having modules added to each other as dependency.
score: 0
comment on: http://stackoverflow.com/q/25617201
type: Comment

memoization
type: Tag
tags question: http://stackoverflow.com/q/25705488
tag name: memoization

http://stackoverflow.com/comment/39938608
comment on: http://stackoverflow.com/a/25572158
type: Comment
score: 0
type: AnswerComment
has text: I passed PrintWrite object too and got this error " "The method print(boolean) in the type JspWriter is not applicable for the arguments (void)""

http://stackoverflow.com/comment/39940257
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25573369
type: AnswerComment
has text: @Tenacious `sleep()` has nothing to do with locks. Start there and adjust your thinking. They are completely separate concepts and completely unrelated to each other.

http://stackoverflow.com/comment/39963600
has text: @alkis no error but listview is not populated correctly. Only last item
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25586025

http://stackoverflow.com/comment/39970104
type: Comment
has text: A simple debugging would have saved lot of people's time
type: QuestionComment
comment on: http://stackoverflow.com/q/25589521
score: 0

http://stackoverflow.com/a/25630393
has comment: http://stackoverflow.com/comment/40062873
type: Answer
has body: You're hitting a common problem with floating point numbers. If you need exact results you should use BigDecimal.
has comment: http://stackoverflow.com/comment/40076754
downvote count: 2
upvote count: 1
score: -1
answers question: http://stackoverflow.com/q/25630224
has comment: http://stackoverflow.com/comment/40044683

http://stackoverflow.com/q/25592901
has body: I have a program where the user can change the layout of the user interface by editing an XML file. I did this with a modified version of Swixml to let it include script tags and execute them. I have Rhino included so that the user can execute Javascript events when someone clicks a button or such. The only problem is that I want users to be able to reference the elements they include by their ids. Is there some way to use HTML-like DOM in Rhino, like some library which already exists? Edit: Nevermind about that function, I got it to work: EOBKAC. But I'd still like to know if something like what I described exists.
tagged with: rhino
score: 0
tagged with: java
answer count: 1
has title: Java Rhino with DOM Objects
tagged with: swixml
type: Question
has answer: http://stackoverflow.com/a/25962261
tagged with: javascript
type: UnansweredQuestion
tagged with: dom

http://stackoverflow.com/q/25604978
answer count: 1
has answer: http://stackoverflow.com/a/25605335
downvote count: 6
tagged with: android-sqlite
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/39998243
type: Question
has body: from the WebServer i can fetch data and pass it correctly into ListView with this class: ReceiveFields class Structure: public class ReceiveFields { public long lastId; public String smsNumber; public String mobileNumber; public String senderName; public String smsBody; public String receiveDate; private Context ctx; } ReceivedSMS Class to get data from WebService: public class ReceivedSMS extends ListFragment implements AbsListView.OnScrollListener { private List&lt;ReceiveFields&gt; rows; private int prevVisibleItem; private TSMS tsms; private String username; private String password; public Long getLastReceivedSMSID; private boolean isFirstTime; private Context context; public ResivedSMS(Context context, String username, String password) { this.username = username; this.password = password; this.context = context; } public ResivedSMS(String username, String password, long start, long count,Context context) { this.username = username; this.password = password; this.context = context; tsms = new TSMS(context ,new User(username, password)); getResivedSMS(start , count); } public ResivedSMS(List&lt;ReceiveFields&gt; receivedSMSList,Context context){ rows = receivedSMSList; this.context = context; } public List&lt;ReceiveFields&gt; getResivedSMS(long start, long count) { tsms = new TSMS(context,new User(this.username, this.password)); try { rows = tsms.getReceivedSMS(start, count); } catch (TException e) { e.printStackTrace(); Log.e("ERROR IN Fetch SMS From WebService List&lt;ReceiveFields&gt; getResivedSMS(long start, long count) " , String.valueOf(e)); } return rows; } use ResivedSMS class as : ResivedSMS receivedSMSList = new ReceivedSMS("username","password",0,20,context); and pass into ListView : getSupportFragmentManager().beginTransaction().replace(R.id.drawer, receivedSMSList).commit(); all of this way is correct and i dont have problem. but i want to fetch data from DataBase and pass it insted of ReceivedSMS as : List&lt;ReceiveFields&gt; r1 = db.getAllReceiv…
has title: Android pass Fragment parameter instead of List into ListView
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39998298
has comment: http://stackoverflow.com/comment/39998076
tagged with: listview
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/40007131
type: Comment
type: QuestionComment
has text: @gnasher729 You are right, the field has to be `volatile`
comment on: http://stackoverflow.com/q/25610043
score: 0

http://stackoverflow.com/q/25673757
downvote count: 1
tagged with: spring-security
tagged with: spring-mvc
score: 0
has body: I'm looking for an example of how to do a code based configuration of the spring-security.xml file. This is a standard spring-security.xml file that I'm using to guide myself. &lt;beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"&gt; &lt;http auto-config="true"&gt; &lt;intercept-url pattern="/admin**" access="ROLE_USER" /&gt; &lt;form-login login-page="/login" default-target-url="/welcome" authentication-failure-url="/login?error" username-parameter="username" password-parameter="password" /&gt; &lt;logout logout-success-url="/login?logout" /&gt; &lt;!-- enable csrf protection --&gt; &lt;csrf/&gt; &lt;/http&gt; &lt;authentication-manager&gt; &lt;authentication-provider&gt; &lt;user-service&gt; &lt;user name="mkyong" password="123456" authorities="ROLE_USER" /&gt; &lt;/user-service&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; &lt;/beans:beans&gt; And this is a code based configuration class that I'm also using to guide myself @EnableWebSecurity @Configuration public class CustomWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) { auth .inMemoryAuthentication() .withUser("user") // #1 .password("password") .roles("USER") .and() .withUser("admin") // #2 .password("password") .roles("ADMIN","USER"); } @Override public void configure(WebSecurity web) throws Exception { web .ignoring() .antMatchers("/resources/**"); // #3 } @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeUrls() .antMatchers("/signup","/about").permitAll() // #4 .antMatchers("/admin/*…
tagged with: java
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
has answer: http://stackoverflow.com/a/29242517
type: UnansweredQuestion
answer count: 1
has title: Spring-security.xml code based configuration
upvote count: 1
tagged with: spring

http://stackoverflow.com/q/25686539
has body: I'm experiencing a strange behavior on my Android app. I want to schedule a fixed-rate operation that saves the properties of a "player" object. During the application flow, the user may change it's settings but the saving is performed every 2 minutes by this little task. The task is run by a static ScheduledExecutorService, initialized when the app starts: private static ScheduledExecutorService threadExecutor; //... public static void initialize() { if (!initialized) { threadExecutor = Executors.newScheduledThreadPool(1); // start the thread that will perform a scheduled check for unsaved player state threadExecutor.scheduleAtFixedRate(new Runnable() { @Override public void run() { // ... the saving operation ... } }, 0, 120, TimeUnit.SECONDS); initialized = true; } } When I'm in debug mode, this thing works both when the app is in the foreground and in the background too, as espected. Problems come when I switch to RELEASE mode: once the app is in the background (by pressing the home button, for example), this thread stops and the operation is not repeated anymore! Is there any documentation about this (unexpected?) behavior?
has title: scheduleAtFixedRate() doesn't work when the app is in background (and in "release" mode)
has comment: http://stackoverflow.com/comment/40145620
linked to: http://stackoverflow.com/q/8999103
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40146028
linked to: http://stackoverflow.com/q/14606039
score: 1
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40146338
tagged with: scheduled-tasks
has comment: http://stackoverflow.com/comment/40146361
favorite count: 0
has comment: http://stackoverflow.com/comment/40146324
type: Question
accepted answer: http://stackoverflow.com/a/25687193
downvote count: 0
answer count: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40146289
has answer: http://stackoverflow.com/a/25687193

http://stackoverflow.com/q/25573307
has answer: http://stackoverflow.com/a/25574260
type: Question
has body: My Program has a JMenuBar with JMenuItems. They have a ActionListener, and I set a Shortcut with setAccelerator. Now I am hiding the menu bar when the window become unfocused, to get more space for a displayed image. But after the first hiding of the menubar, the hotkeys just stop working. How can I fix that? I created a little example code to illustrate that strange behavior: import javax.swing.*; import java.awt.event.*; class Example extends JFrame{ public static void main(String[] args) { new Example(); //main is static } static JMenuBar menubar; //be accessable for the ActionListener Example() { //JPanel this.setSize(50,50); this.setVisible(true); //Menubar, static menubar = new JMenuBar(); this.setJMenuBar(menubar); //Menu JMenu filemenu = new JMenu("File"); menubar.add(filemenu); //Item JMenuItem menuitem = new JMenuItem("Do Something..."); filemenu.add(menuitem); menuitem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, KeyEvent.SHIFT_DOWN_MASK)); // Shift + D menuitem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("Action!"); } }); JButton button = new JButton("Show/Hide menubar"); this.add(button); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("Toggle Bar!"); menubar.setVisible(!menubar.isVisible()); //Toggle } }); } } For reference: I'm using Java 1.7.0_60-ea (Java 7) on a Mac. But this error occurs independent of using the Mac native menu bar or the normal java menu bar inside the JFrame.
has title: invisible JMenuBar, Accelerator not working
tagged with: hotkeys
score: 2
upvote count: 2
type: AnsweredQuestion
tagged with: jmenubar
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25574260
tagged with: actionlistener

http://stackoverflow.com/comment/40068597
has text: Why it's not possible to assign value again in case of primitive but possible with object?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25643987
type: Comment

http://stackoverflow.com/a/25607872
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25607632
has body: In your ViewPart use this code: MenuManager contextMenu = new MenuManager(); contextMenu.setRemoveAllWhenShown(true); getSite().registerContextMenu(contextMenu, viewer); Control control = viewer.getControl(); Menu menu = contextMenu.createContextMenu(control); control.setMenu(menu); where viewer is your TableViewer. The context menu this creates has the same id as your view so you contribute to it with: &lt;menuContribution locationURI="popup:your.view.id"&gt; .... &lt;/menuContribution&gt;
has comment: http://stackoverflow.com/comment/40027810
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25607632
downvote count: 0
has comment: http://stackoverflow.com/comment/40027301
upvote count: 1

http://stackoverflow.com/q/25688661
type: UnansweredQuestion
tagged with: android
has body: Hello fellow devs, I've got an odd requirement that I'd like to share that relates to an expandableListView. I'm going to try and explain via screenshots. That's how it looks now, with just two text views showing two values. The requirement I got is to "push the values up, allowing room to enter two more values below" I've asked if I can just append the two additional TextViews to the existing linearLayout, but got a strong "No, we do not want that." Below is a new screenshot with how I think they want it to look (assume all text is the same font). Is this even possible? I'm not seeing any way to stack related textviews vertically without adding another child view, which I don't think they will be happy with. Thanks.
has answer: http://stackoverflow.com/a/25692875
tagged with: expandablelistview
score: 0
tagged with: java
answer count: 1
tagged with: expandablelistadapter
type: Question
tagged with: mobile
has title: vertical stacking of text views in expandableListView

http://stackoverflow.com/comment/39927981
comment on: http://stackoverflow.com/a/25555272
type: AnswerComment
score: 0
has text: @jeroen_de_schutter: I totally agree, and I updated my answer to reflect your comments.
type: Comment

http://stackoverflow.com/comment/40050845
type: QuestionComment
has text: CashRegister.class is in c:\temp_72\animals both .java started in c:\temp_72
comment on: http://stackoverflow.com/q/25633761
score: 0
type: Comment

http://stackoverflow.com/comment/39913763
comment on: http://stackoverflow.com/q/25559508
score: 0
has text: @Laura how many posibilities do you have? if you have only three, use a `if/elseif/else`, if the number of posibilities will grow up, then use a Builder.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25574354
has comment: http://stackoverflow.com/comment/39943442
upvote count: 4
type: AnsweredQuestion
has title: Work-around for assigning to this in Java?
has comment: http://stackoverflow.com/comment/39943817
downvote count: 0
linked to: http://stackoverflow.com/q/7979623
tagged with: this
answer count: 1
has body: After reading this thread, I understand that it is not possible to assign to this in Java. But are there any workarounds? I have the following situation. I'm writing a subclass B, but the base class A does not have any explicit constructors or methods that would allow to create the object given my arguments. The only available way is to call some external function F(): public class B extends A { public B(some args) { A a = F(some args); this = a; } } Both A and F() are from external libraries, A is a pretty complex object, and F() implements a sophisticated algorithm. The only solution I can think of, is simply not to make a subclass: public class B { public A a; public B(some args) { a = F(some args); } } It doesn't look very appealing though. What would be the least ugly solution in this situation?
has comment: http://stackoverflow.com/comment/39941778
tagged with: inheritance
has answer: http://stackoverflow.com/a/25574587
score: 4
accepted answer: http://stackoverflow.com/a/25574587
favorite count: 0
has comment: http://stackoverflow.com/comment/39941791
type: Question
has comment: http://stackoverflow.com/comment/39941749
has comment: http://stackoverflow.com/comment/39942202
tagged with: subclass
has comment: http://stackoverflow.com/comment/39942049
tagged with: java
has comment: http://stackoverflow.com/comment/39941792
has comment: http://stackoverflow.com/comment/39945313

http://stackoverflow.com/a/25595046
has comment: http://stackoverflow.com/comment/39982457
answers question: http://stackoverflow.com/q/25595001
has comment: http://stackoverflow.com/comment/39979679
score: 2
has body: Hibernate doesn't enforce the uniqueness. That's the job of the database. For your OneToOne, make sure there is a unique constraint on the address_id column. For the IDs, make sure there is a primary key constraint (which enforces uniqueness) on the ID columns. If you generate the database using Hibernate DDL generation, Hibernate will use the attributes of the annotations: @Id will create a PK, and unique = true will generate a unique constraint. But for any serious work, I would generate the schema by myself, using a tool like FlywayDB or Liquibase, which allows migrating your schema from version to version.
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39979620
has comment: http://stackoverflow.com/comment/39982452
type: Answer

http://stackoverflow.com/q/25641043
type: Question
has comment: http://stackoverflow.com/comment/40063995
score: 0
answer count: 2
has body: I have a login page with email address and password. How can i use spring security for the secure login. I'm don't understand how to do it..? In my web app the first page is the login page with with userEmail and Password. This is my jsp page &lt;form:form action="/pname/signin" modelAttribute="user" method="post" id="form" &gt; &lt;form:input path="userEmailId" placeholder="User Name" /&gt; &lt;form:password path="userPassword" placeholder="Password" /&gt; &lt;a href="signin" class="anchorStyle"&gt;&lt;input type="submit" value="signin"/&gt; &lt;/a&gt; &lt;/form:form&gt; and here is my spring-security.xml &lt;http auto-config="true"&gt; &lt;intercept-url pattern="/**" access="ROLE_ADMIN" /&gt; &lt;logout logout-success-url="/signin?logout" /&gt; &lt;/http&gt; &lt;authentication-manager&gt; &lt;authentication-provider&gt; &lt;user-service&gt; &lt;user name="user" password="password" authorities="ROLE_ADMIN" /&gt; &lt;/user-service&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; Please tell me where my mistake is. Also after a success login it should go the hello page.
has comment: http://stackoverflow.com/comment/40066836
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/41243176
tagged with: jsp
tagged with: spring-security
has title: how to add spring security in login form
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/40064681
tagged with: java
has answer: http://stackoverflow.com/a/25643610
tagged with: spring
has comment: http://stackoverflow.com/comment/40066440

http://stackoverflow.com/q/25671049
tagged with: regex
has answer: http://stackoverflow.com/a/25671318
accepted answer: http://stackoverflow.com/a/25671318
has title: RegEx to match ends with
type: Question
has answer: http://stackoverflow.com/a/25671124
has answer: http://stackoverflow.com/a/25671317
answer count: 6
has answer: http://stackoverflow.com/a/25671145
has answer: http://stackoverflow.com/a/25671516
has body: I need to write regex in java to match domain and subdomain(.domain.com). Regex should return true for domain.com m.domain.com abc.domain.com www.domain.com but returns false for abcdomain.com 1domain.com I try to match domain.com and and if preceding character is present then it must be . I tried various options but it is failing in one or other test cases.
possible better answer: http://stackoverflow.com/a/25671145
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25671130

http://stackoverflow.com/comment/40018439
comment on: http://stackoverflow.com/q/25616307
has text: try-- `String colValue=rowsList.get(rowIndex)[columnIndex];`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25569469
tagged with: tile
answer count: 0
type: UnansweredQuestion
has body: I'm makeing a 2d game and im stuck at map. I want it to be stored in text file like this [block name] [x] [y] wall 20 20 wall 20 40 wall 20 60 wall 20 80 wall 20 100 wall 20 120 wall 20 140 wall 20 160 wall 20 180 wall 20 200 I have a code that reads that public void TileLayer() throws IOException{ InputStream inp = (InputStream) getClass().getResourceAsStream("/image/msdf.txt"); BufferedReader in = new BufferedReader(new InputStreamReader(inp)); String str; while ((str = in.readLine()) != null) { if (str.startsWith("wall ")) { float x = Float.valueOf(str.split(" ")[1]); float y = Float.valueOf(str.split(" ")[2]); } } } but than how to display it? How to buffer it ? Thanks for help. If you have any questions youst ask and i'll answer. Full code import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import javax.swing.Timer; import javax.imageio.ImageIO; import javax.swing.JFrame; import org.omg.CORBA.portable.InputStream; import java.io.Reader; public class NewTest extends JFrame implements KeyListener { /** * */ private static final long serialVersionUID = 1L; private Image TestImage; private BufferedImage bf; private int cordX = 100; private int cordY = 100; private boolean down, up, left, right; public NewTest() throws IOException { setTitle("Testing...."); setSize(200, 200); imageLoader(); setVisible(true); } public void imageLoader() throws IOException { TestImage = Toolkit.getDefaultToolkit().getImage("image/Koala.jpg"); addKeyListener(this); } public void update(Graphics g){ paint(g); } public void paint(Graphics g){ bf = new BufferedImage( this.getWidth(),this.getHeight(), BufferedImage.TYPE_INT_RGB); try{ animation(bf.getGraphics()); g.drawImage(bf,0,0,null); }catch(Exception ex){ …
has title: Loading Map from Text File Java
tagged with: dictionary
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39938452
has comment: http://stackoverflow.com/comment/39933787

http://stackoverflow.com/q/25626532
has comment: http://stackoverflow.com/comment/41694531
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/17871825
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40037289
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/27166703
type: UnansweredQuestion
tagged with: android
tagged with: java
has title: Android - Sugar lib NullPointerException
has comment: http://stackoverflow.com/comment/41671521
score: 2
has body: I am using the Sugar lib for android and checked the example on their site: hier UserData udata; udata = new UserData(fname.getText() .toString(), lname.getText() .toString(), email.getText() .toString(), country.getText() .toString(), aboutu.getText() .toString(), pass.getText() .toString()); udata.save(); //here is the NullPointerException UserData ud = UserData.findById(UserData.class, 1); Exception: 09-02 16:42:55.399: E/AndroidRuntime(25162): FATAL EXCEPTION: main 09-02 16:42:55.399: E/AndroidRuntime(25162): java.lang.NullPointerException 09-02 16:42:55.399: E/AndroidRuntime(25162): at com.orm.SugarRecord.save(SugarRecord.java:47) 09-02 16:42:55.399: E/AndroidRuntime(25162): at com.arssoft.exp.dialog.RegisterDialog$2.onClick(RegisterDialog.java:114) 09-02 16:42:55.399: E/AndroidRuntime(25162): at android.view.View.performClick(View.java:4475) 09-02 16:42:55.399: E/AndroidRuntime(25162): at android.view.View$PerformClick.run(View.java:18786) 09-02 16:42:55.399: E/AndroidRuntime(25162): at android.os.Handler.handleCallback(Handler.java:730) 09-02 16:42:55.399: E/AndroidRuntime(25162): at android.os.Handler.dispatchMessage(Handler.java:92) 09-02 16:42:55.399: E/AndroidRuntime(25162): at android.os.Looper.loop(Looper.java:176) 09-02 16:42:55.399: E/AndroidRuntime(25162): at android.app.ActivityThread.main(ActivityThread.java:5419) 09-02 16:42:55.399: E/AndroidRuntime(25162): at java.lang.reflect.Method.invokeNative(Native Method) 09-02 16:42:55.399: E/AndroidRuntime(25162): at java.lang.reflect.Method.invoke(Method.java:525) 09-02 16:42:55.399: E/AndroidRuntime(25162): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) 09-02 16:42:55.399: E/AndroidRuntime(25162): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) 09-02 16:42:55.399: E/AndroidRuntime(25162): at dalvik.system.NativeStart.main(Native Method) The androidManifest: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="15" android:targetSdkVe…
upvote count: 2

http://stackoverflow.com/comment/40169852
has text: BTW: reversing a string is already implemented in java: [StringBuilder.reverse()](http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html#reverse%28%29). See also [SO question: "Reverse a string in Java"](http://stackoverflow.com/q/7569335/2991525)
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25699418

http://stackoverflow.com/q/25602382
score: 61
type: Question
upvote count: 63
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25602519
favorite count: 0
has body: All I have been reading lots of blogs on this subject but still I could not get clear idea when to use one over another hashset or tree set. Taken an example: I have a comparable objects. I have put them in HashSet. Now when (only when I want) i want to set to be sorted based on compareTo logic, I can call Collections.sort(object) whereas Treeset by default always use the compareTo or compare(obj1, obj2) all the time. Hence performance will be hit with TreeSet but output will be same as #1 (Collections.sort). Is this understanding correct?
has answer: http://stackoverflow.com/a/25602519
downvote count: 2
has title: Java: Hashset Vs TreeSet - when should I use over the other?
has comment: http://stackoverflow.com/comment/39992932
duplicate of: http://stackoverflow.com/q/1463284
tagged with: collections
answer count: 1
linked to: http://stackoverflow.com/q/1463284

http://stackoverflow.com/q/25613879
favorite count: 0
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40014178
accepted answer: http://stackoverflow.com/a/25614105
has title: Class project auto-grader says "standard output is not what was expected"
upvote count: 2
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/40014097
has comment: http://stackoverflow.com/comment/40014089
downvote count: 0
has comment: http://stackoverflow.com/comment/40014195
has comment: http://stackoverflow.com/comment/40014220
has answer: http://stackoverflow.com/a/25613993
possible better answer: http://stackoverflow.com/a/25613993
has comment: http://stackoverflow.com/comment/40014026
has body: I am new to java and am doing a project for my class but I keep getting an error. Project Write an application that reads values representing a time duration in hours, minutes, and seconds and then prints the equivalent total number of seconds. (For example, 1 hour, 28 minutes, and 42 seconds is equivalent to 5322 seconds.) SPECIFICATION OF PROMPTS, LABELS AND OUTPUT: Your code should use these prompts: "hours: ", "minutes: ", "seconds: ". The prompts should not force the user to type the required input on the next line. After all the inputs, the output should consist of a single line consisting of an integer (the total number of seconds) followed by a space followed by a label for the units: seconds. For example: hours: 2 minutes: 10 seconds: 7 7807 seconds SPECIFICATION OF NAMES: Your application class should be called Seconds These are the errors MyProgrammingLab keeps giving me: My Code: import java.util.Scanner; public class Seconds { public static void main (String[] args){ Scanner stdin = new Scanner(System.in); int hours; System.out.print("hours: "); hours = stdin.nextInt(); int minutes; System.out.print("minutes: "); minutes = stdin.nextInt(); int seconds; System.out.print("seconds: "); seconds = stdin.nextInt(); int hourSeconds = (hours * 60) * 60; int minuteSeconds = (minutes * 60); int secondsTotal = hourSeconds + minuteSeconds + seconds; System.out.println(secondsTotal + " seconds"); } }
has comment: http://stackoverflow.com/comment/40014172
tagged with: java
has answer: http://stackoverflow.com/a/25614105

http://stackoverflow.com/q/25653650
has comment: http://stackoverflow.com/comment/40086762
answer count: 2
downvote count: 0
has title: What is the best way to pre-load data with the application?
score: 1
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25653792
type: Question
tagged with: android
tagged with: java
linked to: http://stackoverflow.com/q/11352396
tagged with: preload
has body: So, I have an app that I want to store a large series of Strings with, and I want it to ship with the application. In Android's onCreate method, should I just have a huge (couple of hundred lines) String[] initializer? Is there a better way to do this? I was thinking of creating my own object of these (they are grouped up a little bit) and storing it that way, but that still includes an instantiation of lots of Strings into an array. Is there some way that I can have this already created? Is there a better way to do this?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25653811

http://stackoverflow.com/q/25568261
type: AnsweredQuestion
tagged with: spring-boot
has body: I have custom authentication filter which creates PreAuthenticatedAuthenticationToken and stores it in security context. This all works fine. Here is the config: @Configuration @EnableWebMvcSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private SsoAuthenticationProvider authenticationProvider; @Autowired private SsoAuthenticationFilter ssoAuthenticationFilter; @Override protected void configure(HttpSecurity http) throws Exception { http.addFilterAfter(ssoAuthenticationFilter, SecurityContextPersistenceFilter.class); } } Now my ssoAuthenticationFilter is part of the FilterChainProxy, on the right position. Smooth. But as the ssoAuthenticationFilter is Filter it gets picked up by Boot and included as a filter. So my filter chain really looks like: ssoAuthenticationFilter (included because being Filter) filterChainProxy (spring autoconfiguration) ... SecurityContextPersistenceFilter ssoAuthenticationFilter (included by http.addFilterAfter(...)) ... some other filters Obviously I would like to get rid of the autoregistration of the ssoAuthenticationFilter here (the first one listed). Any tips much appreciated.
tagged with: java
has title: Spring security and custom AuthenticationFilter with Spring boot
has answer: http://stackoverflow.com/a/25568834
accepted answer: http://stackoverflow.com/a/25568834
score: 12
upvote count: 12
downvote count: 0
answer count: 1
tagged with: spring
tagged with: spring-security
favorite count: 0
type: Question

http://stackoverflow.com/a/25606447
score: 16
type: Answer
has body: I've had a similar problem using Eclipse Luna on my ubuntu 12.04, then I found this blog page http://blog.vogella.com/2014/02/21/using-eclipse-luna-on-ubunbu/ which gave me a solution. Just create a script: touch eclipse.sh Fill it with this content: #!/bin/bash export SWT_GTK3=0 export UBUNTU_MENUPROXY=0 ./eclipse -showlocation Put this script in your eclipse directory then make it executable chmod +x eclipse.sh and finally run it. Hope that helps.
upvote count: 16
answers question: http://stackoverflow.com/q/25606052
downvote count: 0

http://stackoverflow.com/comment/40156409
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25691944
type: AnswerComment
has text: Nevermind, I got it working. Stupid little mistakes on my part. Thank you so much!

http://stackoverflow.com/q/25699578
downvote count: 3
answer count: 1
tagged with: mysql
upvote count: 1
has comment: http://stackoverflow.com/comment/40170099
favorite count: 0
has comment: http://stackoverflow.com/comment/40169944
has title: How to establish MySQL connection using JDBC?
score: -2
accepted answer: http://stackoverflow.com/a/25699628
tagged with: java
tagged with: jdbc
has body: I'm trying to learn JDBC and MySQL , and I'm stuck at establishing connection between JDBC and the driver. I have already copied the driver to my project, and this is my code: public static void main(String[] args) { try { System.out.println("Connection to server..."); Class.forName("com.mysql.jdbc.driver").newInstance(); System.out.println("Connection succesful"); }catch(Exception ex) { System.out.println("Error: " + ex.getMessage()); } } But it always throws an exception. I did some research about this and it seems I need to use a DriverManager, but there are many code samples but no explanations. So I'd like some help understanding how is this working, I don't want to just copy and paste code.
has comment: http://stackoverflow.com/comment/40169965
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/25699628

http://stackoverflow.com/q/25592776
score: 1
has comment: http://stackoverflow.com/comment/39975525
has answer: http://stackoverflow.com/a/25592859
tagged with: java
has answer: http://stackoverflow.com/a/25592831
has body: So we have an array of strings with the names of fruits. Lets say you want to know in which place in the array the word "Peach" is (returned as an integer). How would you achieve this? I tried finding a related article to this but could not find one. fruits = new String[] {"Peach", "Orange", "Banana", "Plum", "Apple", "Strawberry", "Mango", "Kiwi"};
downvote count: 0
upvote count: 1
tagged with: string
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25592869
tagged with: arrays
accepted answer: http://stackoverflow.com/a/25592831
has answer: http://stackoverflow.com/a/25592834
linked to: http://stackoverflow.com/q/25492381
has answer: http://stackoverflow.com/a/25592801
possible better answer: http://stackoverflow.com/a/25592801
answer count: 6
has answer: http://stackoverflow.com/a/25592856
duplicate of: http://stackoverflow.com/q/25492381
has title: Get location of a word in an array of strings
type: AnsweredQuestion

http://stackoverflow.com/q/25679289
type: Question
has comment: http://stackoverflow.com/comment/40133240
has comment: http://stackoverflow.com/comment/40133026
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40150964
accepted answer: http://stackoverflow.com/a/25679640
has title: Uri.parse give the null value
has answer: http://stackoverflow.com/a/25679640
type: AnsweredQuestion
tagged with: null
has body: I have successfully fetch data from another database and can print it on a TextView. But when I try to pass the data into Uri.pase() like this below it gives me null. public void gotosite(View v) { s = responseTextView.getText().toString(); Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://"+s+"")); startActivity(i); } this method give the TextView print of my expected data. I wanna set the data at Uri.parse() public void setTextToTextView(JSONArray jsonArray) { String s = ""; for (int i = 0; i &lt; jsonArray.length(); i++) { JSONObject json = null; try { json = jsonArray.getJSONObject(i); s = s + json.getString("adUrl"); } catch (JSONException e) { e.printStackTrace(); } } this.responseTextView.setText(s); }
score: 0
answer count: 1

http://stackoverflow.com/a/25655747
upvote count: 7
downvote count: 1
has body: Ok, so 5 dice rolls, each with 6 options. if they are un-ordered you have a range of 5-30 as mentioned above - never sufficient for 1-100. You need to assume an order, this gives you a scale of 1,1,1,1,1 - 6,6,6,6,6 (base 6) assuming 1 --> 0 value, you have a 5 digit base 6 number generated. As we all know 6^5 = 7776 unique possibilities. ;) For this I am going to give you a biased random solution. int total = 0; int[] diceRolls; for (int roll : diceRolls) { total = total*6 + roll - 1; } return total % 100 + 1; thanks to JosEdu for clarifying bracket requirement Also if you wanted to un-bias this, you could divide range by the maxval given in my description above, and subsequently multiply by your total (then add offset), but you would still need to determine what rounding rules you used.
has comment: http://stackoverflow.com/comment/40090580
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/40090506
has comment: http://stackoverflow.com/comment/135493263
answers question: http://stackoverflow.com/q/25655366
accepted answer of: http://stackoverflow.com/q/25655366
type: AcceptedAnswer

http://stackoverflow.com/a/25617892
has comment: http://stackoverflow.com/comment/40021696
has comment: http://stackoverflow.com/comment/40022967
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25617276
downvote count: 0
has body: Advice given by JoshuaBloch also applies for c# and advice given for c# also applies for java(upto an extent as they talk about static classes). Why use static members? They don't need an instance to call them In c# they use call opcode, which doesn't needs to check for null(which is a micro optimization) as opposed to instance methods(which uses callvirt opcode). I believe similar thing will be there in java also. They don't prevent something from GC if instance is not used. Also no overhead of passing this reference to all the methods hidden. If you are used to Resharper productivity tool for visual studio, It will give the same advice as JoshuaBloch given for java, in c# saying that Method can be made static which is justified in the given link. Why not use static members? They are not testable(easily). They can't implement interface member. They can't be injected via Dependency Injection. They don't participate in polymorphism (which is very much needed in object oriented languages). In c#, static classes can't be passed around as references. So, both advices are good if you understand them and they apply for both the languages. Use them when they are appropriate and avoid them when they are not.
has comment: http://stackoverflow.com/comment/40021680
score: 9
has comment: http://stackoverflow.com/comment/40021666
accepted answer of: http://stackoverflow.com/q/25617276
upvote count: 9
has comment: http://stackoverflow.com/comment/40021636
type: Answer
has comment: http://stackoverflow.com/comment/40022038

http://stackoverflow.com/comment/39990916
score: 3
has text: This require advanced math and programming knowledge. And even with those, this will not be an easy task. Anyway, I suggest that you go through the research section of the Sphinx project: http://cmusphinx.sourceforge.net/wiki/research/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25601097

http://stackoverflow.com/comment/40092411
comment on: http://stackoverflow.com/a/25653455
score: 0
type: AnswerComment
has text: Thanks, once I worked out I was missing the other type mapping I ended up with something similar :)
type: Comment

http://stackoverflow.com/comment/40038948
has text: You should just vote to close as a duplicate.
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/25627406
type: Comment

http://stackoverflow.com/q/25605835
answer count: 1
tagged with: epub
favorite count: 0
type: Question
tagged with: android
has title: How i can create paging in my page for epub ? android
has body: How i can create paging for my WebView that fill from Epub. My MainActivity.java : public class MainActivity extends ActionBarActivity implements OnClickListener { WebView webView; Handler hand; String data = null; LinearLayout books; int pagecount = 1; Book book; @SuppressLint("SetJavaScriptEnabled") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); hand = new Handler(); webView = new WebView(this); books = (LinearLayout) findViewById(R.id.book); AssetManager assetManager = getAssets(); try { InputStream epubInputStream = assetManager.open("mybook.epub"); book = (new EpubReader()).readEpub(epubInputStream); Log.i("Log_one", "author(s): " + book.getMetadata().getAuthors()); Log.i("Log_two", "title: " + book.getTitle()); Bitmap coverImage = BitmapFactory.decodeStream(book.getCoverImage().getInputStream()); Log.i("Log_three", "Coverimage is " + coverImage.getWidth() + " by " + coverImage.getHeight() + " pixels"); logTableOfContents(book.getTableOfContents().getTocReferences(), 0); Spine spine = book.getSpine(); List&lt;SpineReference&gt; spineList = spine.getSpineReferences(); int count = spineList.size(); Button btnnext = (Button) findViewById(R.id.btnNext); Button btnPreviuse = (Button) findViewById(R.id.btnPreviuse); btnnext.setOnClickListener(this); btnPreviuse.setOnClickListener(this); } catch (IOException e) { Log.e("Log_four", e.getMessage()); } } private void logTableOfContents(List&lt;TOCReference&gt; tocReferences, int depth) { if (tocReferences == null) { return; } for (TOCReference tocReference : tocReferences) { StringBuilder tocString = new StringBuilder(); for (int i = 0; i &lt; depth; i++) { tocString.append("\t"); } tocString.append(tocReference.getTitle()); Log.i("Log_five", tocString.toString()); logTableOfContents(tocReference.getChildren(), depth + 1); } } @Override public void onClick(View v) { if (v.getId() == R.id.btnNext) { try { int i = pagecount + 7; web…
tagged with: webview
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25607265
accepted answer: http://stackoverflow.com/a/25607265
downvote count: 0
score: 1
upvote count: 1
tagged with: java

http://stackoverflow.com/a/25568662
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39930754
has comment: http://stackoverflow.com/comment/39930683
type: Answer
has body: Sorry I apologize! I added the BMI variable when I shouldn't have since an answer is suppose to be outputted into the TextFieldBMI rather than .getText() from it so it was always empty. Problem solved!
accepted answer of: http://stackoverflow.com/q/25568205
answers question: http://stackoverflow.com/q/25568205
downvote count: 0

http://stackoverflow.com/comment/39999337
has text: Can you give me please an example?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25590842
type: Comment

xml-namespaces
type: Tag
tags question: http://stackoverflow.com/q/25560774
tag name: xml-namespaces

http://stackoverflow.com/q/25631591
upvote count: 1
tagged with: java
downvote count: 3
tagged with: methods
tagged with: instance-variables
has answer: http://stackoverflow.com/a/25631816
favorite count: 0
possible better answer: http://stackoverflow.com/a/25631816
has title: Confusion over method parameter and instance variable having same name
has answer: http://stackoverflow.com/a/25631781
type: Question
has body: class Employee { public String name = "John"; public void modifyName(String name) { name = name; // I know using 'this' would be helpful, but I dont want to } System.out.println(name); } class Someclass { public static void main(String[] args) { Employee e1 = new Employee(); System.out.println(e1.modifyName("Dave")); System.out.println(e1.name); // Does this outputs John or Dave? } } Does the method modifyName behave like a setter and change the instance variable name to be "Dave"? Do methods only behave like a setter when they follow the naming convention setProperty? modifyName is not working, will it work if it is named setName?
has answer: http://stackoverflow.com/a/25631618
accepted answer: http://stackoverflow.com/a/25632153
score: -2
has comment: http://stackoverflow.com/comment/40047152
answer count: 6
has comment: http://stackoverflow.com/comment/40047231
tagged with: method-parameters
has answer: http://stackoverflow.com/a/25632026
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25631625
has answer: http://stackoverflow.com/a/25632153

http://stackoverflow.com/comment/39989262
score: 1
type: Comment
type: QuestionComment
has text: In that link, they say "the fix is to either inject a reference to the same object (for stateless or singleton), or to use SessionContext.getEJBLocalObject, getEJBObject, or getBusinessObject (possibly with getInvokedBusinessInterface) to get a proxy to the current object."
comment on: http://stackoverflow.com/q/25599017

http://stackoverflow.com/q/25668144
tagged with: java
has answer: http://stackoverflow.com/a/25668996
has answer: http://stackoverflow.com/a/25668716
downvote count: 2
accepted answer: http://stackoverflow.com/a/25668716
linked to: http://stackoverflow.com/q/363681
has comment: http://stackoverflow.com/comment/40112429
favorite count: 0
has comment: http://stackoverflow.com/comment/40112684
type: Question
has comment: http://stackoverflow.com/comment/40113130
tagged with: binary
has title: How to create random number within bounds in Java displayed as a binary value?
has answer: http://stackoverflow.com/a/25668570
has answer: http://stackoverflow.com/a/25669313
possible better answer: http://stackoverflow.com/a/25668570
answer count: 5
has comment: http://stackoverflow.com/comment/40112474
has answer: http://stackoverflow.com/a/25668934
has comment: http://stackoverflow.com/comment/40112796
has comment: http://stackoverflow.com/comment/40113051
has body: I am able to generate Random Numbers with Random method. But I want to create random numbers that are displayed in a binary format. The numbers must be within a specific range. Random numbers should be between 5 and 10 digits, inclusive. E.g.: 011110, 0111100, 010110101.
has comment: http://stackoverflow.com/comment/40112983
has comment: http://stackoverflow.com/comment/40112583
has comment: http://stackoverflow.com/comment/40112740
score: 2
upvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40112501
tagged with: random
has comment: http://stackoverflow.com/comment/40112875

class
tags question: http://stackoverflow.com/q/25711008
tags question: http://stackoverflow.com/q/25574707
tags question: http://stackoverflow.com/q/25709948
tags question: http://stackoverflow.com/q/25619281
tags question: http://stackoverflow.com/q/25676878
tags question: http://stackoverflow.com/q/25692407
type: Tag
tags question: http://stackoverflow.com/q/25693347
tags question: http://stackoverflow.com/q/25561873
tags question: http://stackoverflow.com/q/25708421
tags question: http://stackoverflow.com/q/25691756
tags question: http://stackoverflow.com/q/25592628
tags question: http://stackoverflow.com/q/25585393
tags question: http://stackoverflow.com/q/25667960
tags question: http://stackoverflow.com/q/25636108
tags question: http://stackoverflow.com/q/25613172
tags question: http://stackoverflow.com/q/25688330
tag name: class
tags question: http://stackoverflow.com/q/25676101
tags question: http://stackoverflow.com/q/25596061
tags question: http://stackoverflow.com/q/25702624
tags question: http://stackoverflow.com/q/25588325
tags question: http://stackoverflow.com/q/25696211
tags question: http://stackoverflow.com/q/25635868
tags question: http://stackoverflow.com/q/25640768
tags question: http://stackoverflow.com/q/25704585
tags question: http://stackoverflow.com/q/25595342
tags question: http://stackoverflow.com/q/25605113
tags question: http://stackoverflow.com/q/25623685
tags question: http://stackoverflow.com/q/25597424
tags question: http://stackoverflow.com/q/25688046
tags question: http://stackoverflow.com/q/25591287
tags question: http://stackoverflow.com/q/25695159
tags question: http://stackoverflow.com/q/25562443
tags question: http://stackoverflow.com/q/25695998
tags question: http://stackoverflow.com/q/25560612
tags question: http://stackoverflow.com/q/25604692

http://stackoverflow.com/q/25679793
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40134384
has comment: http://stackoverflow.com/comment/40134627
linked to: http://stackoverflow.com/q/18910773
has comment: http://stackoverflow.com/comment/40134525
has comment: http://stackoverflow.com/comment/40134335
tagged with: synchronized
has title: Why inner class method cannot synchronized the object in outer class?
has comment: http://stackoverflow.com/comment/40134708
score: 0
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40134119
has comment: http://stackoverflow.com/comment/40134259
has comment: http://stackoverflow.com/comment/40134306
upvote count: 1
has comment: http://stackoverflow.com/comment/40134286
downvote count: 1
has body: I encountered a problem:Will inner class method cannot synchronized the object in outer class? A answer from stackoverflow told me : No. But I really want to know the reason. For example: I designed a thread pool with at most 5 threads to do work. public class ThreadPool{ // Ignore the Task class private LinkedList&lt;Task&gt; tasks; Executor[] executors = new Executor[5]; private static ThreadPool pool = null; private ThreadPool() { tasks = new LinkedList&lt;Task&gt;(); for (int i = 0; i &lt; 5; i++) { executors[i] = new Executor(i); } } public static ThreadPool getInstance() { if (pool == null) { pool = new ThreadPool(); } return pool; } public void addTask(Task task) { /** igore code here*/ } private class Executor extends Thread { private int i; public Executor(int i) { this.i = i; start(); } public void run() { Task task = null; synchronized (tasks) { if (tasks.size() == 0) { System.out.println("tasks's size is : " + tasks.size()); try { while (tasks.size() == 0) { tasks.wait(); } } catch (Exception e) { e.printStackTrace(); } } if (tasks.size() &gt; 0) task = tasks.removeFirst(); } if (task != null) { /** ignore code here */ } } } } Unfortunately, the synchronized doesn't work. But when I put the synchronized block into synchronized (ThreadPool.this) { ... } it works. So, i want to know why inner class method cannot synchronized the object in outer class. Hope for a detailed answer.
favorite count: 0

http://stackoverflow.com/q/25578638
tagged with: java
tagged with: arguments
tagged with: command-line
type: Question
has answer: http://stackoverflow.com/a/25578902
accepted answer: http://stackoverflow.com/a/25578902
has answer: http://stackoverflow.com/a/25578643
possible better answer: http://stackoverflow.com/a/25578643
has title: How does the Java program know how to access the file?
has body: I have been reading this book Algorithms 4th Edition. Its code examples take an input from the command line String[] a = StdIn.readAllStrings(); and sorts them. The source code for StdIn.java is given in http://introcs.cs.princeton.edu/java/stdlib/StdIn.java . Source for heap sort is in http://algs4.cs.princeton.edu/24pq/Heap.java but really isn't relevent. The main function looks like this: public static void main(String[] args) { String[] a = StdIn.readAllStrings(); Heap.sort(a); show(a); } There is no explicit reference to the args. Yet when i pass in a text file as an argument in the command line it works as advertised: % more tiny.txt S O R T E X A M P L E % java Heap &lt; tiny.txt A E E L M O P R S T X Can someone enlighten me how the program reads in the input when no reference has been given. Many thanks in advanced! Edit: changed the link for stdin java. My bad.
type: AnsweredQuestion
tagged with: stdin
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25578658

http://stackoverflow.com/a/45914270
upvote count: 0
score: -2
downvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25567806
has comment: http://stackoverflow.com/comment/78787033
has body: You should add jersey-spring3.jar first like the document in jersey website. For this step by step learning source to integration Spring DI with Jersey, you can do like this when you start up you application debug the application. Find ServletContainer.class and set a breakpoint in init() function, as this you can find this step by step.

http://stackoverflow.com/comment/40096313
comment on: http://stackoverflow.com/q/25658966
type: Comment
has text: You don't want to increase memory, you want to refactor your code. This better suits for [codereview.stackexchange.com](http://codereview.stackexchange.com)
type: QuestionComment
score: 2

http://stackoverflow.com/a/25699248
accepted answer of: http://stackoverflow.com/q/25699170
type: Answer
has comment: http://stackoverflow.com/comment/40169697
has comment: http://stackoverflow.com/comment/40169738
has body: (?=(\w-\w)) Try this.see demo. http://regex101.com/r/oC3nN4/12
has comment: http://stackoverflow.com/comment/40169703
has comment: http://stackoverflow.com/comment/40169857
has comment: http://stackoverflow.com/comment/40170035
has comment: http://stackoverflow.com/comment/40170008
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40169963
answers question: http://stackoverflow.com/q/25699170
score: 1

http://stackoverflow.com/comment/47957756
has text: Edited my post to explain what dependencies were added.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25722977
type: AnswerComment

http://stackoverflow.com/comment/40148970
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25687176
has text: @Unihedron `.*?` should stay in line (without `s` modifier) or `[^B\n]*`. If it's a single-line input `[^B]*B` is fine!

http://stackoverflow.com/q/25688771
type: Question
has comment: http://stackoverflow.com/comment/40149608
has answer: http://stackoverflow.com/a/25688858
accepted answer: http://stackoverflow.com/a/25688970
has body: import java.util.Scanner; class test15{ public static void main(String ...NR){ int sum=0; Scanner sc = new Scanner(System.in); int x,y,z; System.out.println("Enter the number"); int num = sc.nextInt(); num = z; while(num!=0){ x = num%10; sum = sum + x*x*x; num = num/10; } if(sum == z){ System.out.println("no is armstrong"); } else{ System.out.println("no is not armstrong"); } } } // getting error local variable Z may not have been initialized so how to make a variable which user input equals to another then ? i am new to java.
has title: armstrong no. program ( local variable z may not have been initiated )
type: AnsweredQuestion
score: 0
answer count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/25688808
has answer: http://stackoverflow.com/a/25688808
has answer: http://stackoverflow.com/a/25688970

http://stackoverflow.com/comment/40158890
has text: [Java Curses](http://sourceforge.net/projects/javacurses/) can do it.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25693351
score: 0

http://stackoverflow.com/comment/40070101
comment on: http://stackoverflow.com/q/25644182
type: Comment
type: QuestionComment
score: 0
has text: do you need to set a path.data so that data is persistent to the same spot in between runs?

http://stackoverflow.com/comment/40087476
score: 1
comment on: http://stackoverflow.com/q/25654013
type: Comment
type: QuestionComment
has text: This doesn't look like any formula for calculating π that I've ever seen.

http://stackoverflow.com/a/25676378
answers question: http://stackoverflow.com/q/25675832
score: 1
downvote count: 0
upvote count: 1
type: Answer
has body: Make sure all dates are rounded to the nearest week. Then use a getWeek(stat) function and insert the stat into the map there. A simple HashMultimap will do. You need to deal with the issue of hash codes and equality. Say I have a data type class Pair { public int x; public int y; // obvious constructor } Observe: new Pair(1,2) == new Pair(1,2) // false new Pair(1,2).equals(new Pair(1,2)) // false And if you use them as keys in a hash map they will be different keys. You need to override equals and hashCode to overcome this. For Date we observe: public boolean equals(Object obj) { return obj instanceof Date &amp;&amp; getTime() == ((Date) obj).getTime(); } Hashcode will be defined correspondingly. So if you key off of Date you will only get what you want if the dates agree to the milliscecond. Therefore a HashMultimap&lt;Date, Stat&gt; map; Is fine, but you should programmatically observe the convention that all dates are rounded down to the nearest week. Then do: Date key = roundToWeek(stat); map.insert(key, stat); And you should be good.

http://stackoverflow.com/comment/40177998
has text: Ok it is now working but I could not understand ...when I try a old row to delete first then a new row...old row is not deleted first why?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25702939

http://stackoverflow.com/comment/40007741
type: QuestionComment
has text: If you run the app in the foreground, do you get detections? What IDE are you using? If using Eclipse, can you verify that manifest merging is enabled in project.properties?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25610245

http://stackoverflow.com/a/25587320
has comment: http://stackoverflow.com/comment/40023841
has comment: http://stackoverflow.com/comment/40065188
has comment: http://stackoverflow.com/comment/40022153
has comment: http://stackoverflow.com/comment/39965570
has comment: http://stackoverflow.com/comment/39972823
has comment: http://stackoverflow.com/comment/39992501
answers question: http://stackoverflow.com/q/25585601
has comment: http://stackoverflow.com/comment/39990675
has comment: http://stackoverflow.com/comment/40024095
has comment: http://stackoverflow.com/comment/40021906
has comment: http://stackoverflow.com/comment/40024484
type: Answer
has comment: http://stackoverflow.com/comment/39972615
has comment: http://stackoverflow.com/comment/39993715
has comment: http://stackoverflow.com/comment/40067281
score: 0
has comment: http://stackoverflow.com/comment/39965451
has body: So, i would say the "other" you mentioned, has an different problem. Even when the "Last-Shown-Exception" is the same as yours. But as you can see in your stacktrace, the "source" is a SecurityException. The *Cannot load configuration class*-Error is a aftereffect I assume there is something wrong with the "code signation" in your project or, due to ByteCode-Manipulation, the signation is broken. PS: Sometimes this also can happen, when you reference "SignedLibs" and "UnsignedLibs" in your project. in this case remove the signation from the signed libs.

http://stackoverflow.com/comment/40162504
type: QuestionComment
type: Comment
has text: @HotLicks I've provide a working example, now the OP's questions from the last two lines, paraphrased: "*Why* isn't a generic E[] used?", "Is it using Object[] for performance?", and "Does the compiler insert implicit casts *anyway* if E[] were to be used?" All this other stuff about E not really existing is simply a distraction, IMOHO.
comment on: http://stackoverflow.com/q/25695011
score: 0

http://stackoverflow.com/comment/42095492
score: 1
type: Comment
has text: Sorry, I have to reopen this. I finally found the time to check this again. But having included the `jboss-web.xhml` I now have changed the message from `Forbidden` to `Not Found`. What place does Wildfly exactly look for now having the jboss-web.xml? I have an `Index.xhmtl` as main page. Changed it as a test to `index.xhtml`, but didn't change a thing.
type: AnswerComment
comment on: http://stackoverflow.com/a/25727212

http://stackoverflow.com/comment/39957704
has text: Thank you so much!!! That was the problem and I thank you for all the explanations you give me!!!
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25583009
type: AnswerComment

http://stackoverflow.com/comment/40174950
has text: i was expecting : 1. "a" 2. "found the number + b " but i only got "a"
comment on: http://stackoverflow.com/q/25702413
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25553233
tagged with: memory-fences
answer count: 3
has title: Java equivalent to Thread.MemoryBarrier
downvote count: 0
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25553490
tagged with: c#
has answer: http://stackoverflow.com/a/25553354
has body: In Java, how can I explicitly trigger a full memory fence/barrier, equal to the invocation of System.Threading.Thread.MemoryBarrier(); in C#? I know that since Java 5 reads and writes to volatile variables have been causing a full memory fence, but maybe there is an (efficient) way without volatile.
tagged with: java
has answer: http://stackoverflow.com/a/29298271
possible better answer: http://stackoverflow.com/a/29298271
has comment: http://stackoverflow.com/comment/39901734
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25553490
upvote count: 3
score: 3

http://stackoverflow.com/comment/39940643
type: AnswerComment
has text: Because `b` is of type `Object`, `a` is inaccessible. `b` needs to be declared as type `ConfirmDialog` for `a` to become accessible - otherwise `b.a` will fail.
comment on: http://stackoverflow.com/a/25573777
score: 1
type: Comment

http://stackoverflow.com/comment/39966548
has text: As a beginner, you shouldn't stick to your solution, which might not be the best, but rather try to understand better solutions from other people. I have edited my post, is it clearer ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25587720
type: AnswerComment

http://stackoverflow.com/comment/40158441
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25679152
has text: Yes you can. Just try :)
type: Comment

http://stackoverflow.com/comment/40072521
score: 0
has text: What if function may call functions that are in other java classes? I have functions that call "header" or "footer" functions that can be situated in different classes..
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25645760

http://stackoverflow.com/q/25625569
has comment: http://stackoverflow.com/comment/40036602
answer count: 2
has title: Java Thread drives CPU to 100%
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/40035583
tagged with: java
has comment: http://stackoverflow.com/comment/40035465
has answer: http://stackoverflow.com/a/25626571
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40036928
has answer: http://stackoverflow.com/a/25655176
has body: I have rewritten this many times but I could not find a solution to this problem for a while. Some other Class writes gps.log file with lines like: 2014-09-02 10:23:13 35.185604 33.859077 2014-09-02 10:23:18 35.185620 33.859048 I am trying to read the last line of the file and update a text field in the user interface. The Thread below is overdriving the CPU into 85-100%. I keep the file very tiny (100 lines - &lt; 5KB). I have been working with CSV for a long time, and I think reading this file every 3 seconds should not have this footprint on the CPU. Although I have been reading huge CSV files in the past it is the first time I have this issue now that I try to update the User Interface every couple seconds. Am I doing something wrong with how I am updating the text field? Any ideas? Thanks for looking. new Thread(new Runnable() { public void run() { while (true) { Display.getDefault().asyncExec(new Runnable() { public void run() { try { try { Thread.sleep(3000); } catch (Exception e) { } BufferedReader gpslog = new BufferedReader(new FileReader("log/gps.log")); String line = ""; String lastLine = ""; int i=0; while (line != null) { i++; lastLine = line; line = gpslog.readLine(); } //System.out.println(lastLine); gpslog.close(); if (lastLine != null) { txtGPSStatus.setText(lastLine); } //If more than 100 gps entries, flush the file if (i&gt;100) { PrintWriter writer = new PrintWriter("log/gps.log"); writer.close(); } } catch (IOException e1) { log.error(e1); } } }); } } }).start();
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40035868
has comment: http://stackoverflow.com/comment/40035448
upvote count: 1
has comment: http://stackoverflow.com/comment/40037154
has comment: http://stackoverflow.com/comment/40036945
has comment: http://stackoverflow.com/comment/40035454
has comment: http://stackoverflow.com/comment/40035389
score: 0

http://stackoverflow.com/q/25636108
has body: A class have a static variable, but I cannot use it outside the class. Here is the code. I cannot use Cache.login.hget("a", "b"), it says Cannot access hset(...) in com.example.cache.HashCache Cache.java: public class Cache { public static HashCache login; public Cache(String redisUrl) { Jedis redis = new Jedis(redisUrl); Cache.login = new HashCache(redis, "name"); } } HashCache.java: class HashCache { private Jedis jedis; private String key; public HashCache(Jedis jedis, String key) { this.jedis = jedis; this.key = key; } public String hget(String field) { return jedis.hget(key, field); } public void hset(String field, String value) { jedis.hset(key, field, value); } }
type: AnsweredQuestion
tagged with: oop
has comment: http://stackoverflow.com/comment/40054742
tagged with: java
has answer: http://stackoverflow.com/a/25636625
downvote count: 3
type: Question
tagged with: static
answer count: 2
possible better answer: http://stackoverflow.com/a/25636625
score: -2
has comment: http://stackoverflow.com/comment/40054769
accepted answer: http://stackoverflow.com/a/25636175
has title: Cannot use static variable's method
has comment: http://stackoverflow.com/comment/40054684
upvote count: 1
has comment: http://stackoverflow.com/comment/40054725
has answer: http://stackoverflow.com/a/25636175
favorite count: 0
tagged with: class

http://stackoverflow.com/q/25622625
has body: which j2ee pattern is used for centralizing the process of looking up services:- interface factory intercepting filter business delegate service locator
upvote count: 0
has comment: http://stackoverflow.com/comment/40030107
has title: j2ee pattern for centralizing the process of looking up services
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/40030380
has answer: http://stackoverflow.com/a/25623173
accepted answer: http://stackoverflow.com/a/25623173
type: AnsweredQuestion
score: -5
tagged with: java
downvote count: 5
tagged with: servlets
favorite count: 0
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/39928385
type: Comment
type: QuestionComment
score: 0
has text: Why can't you cast `value` to `JTreePanelNode`?
comment on: http://stackoverflow.com/q/25567436

http://stackoverflow.com/a/25678176
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25678140
has comment: http://stackoverflow.com/comment/40131116
has comment: http://stackoverflow.com/comment/40131169
type: Answer
accepted answer of: http://stackoverflow.com/q/25678140
has body: define the PrintWriter as an instance variable in your main calss not sure what are you trying to use this for but make it public to get it working or don't use any modifier if you are working in the same class so your code should be public class MyClass { public PrintWriter outputFile; ..... } and then instantiate the instance when you get to the method outputFile = new PrintWriter(fw);

http://stackoverflow.com/q/25698620
has comment: http://stackoverflow.com/comment/40169506
has comment: http://stackoverflow.com/comment/40168989
has comment: http://stackoverflow.com/comment/40169343
has comment: http://stackoverflow.com/comment/40168439
has comment: http://stackoverflow.com/comment/40193347
has comment: http://stackoverflow.com/comment/40169609
tagged with: illegalmonitorstateexcep
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40168585
tagged with: java-native-interface
tagged with: java
has comment: http://stackoverflow.com/comment/40169948
answer count: 1
has comment: http://stackoverflow.com/comment/40192906
has comment: http://stackoverflow.com/comment/40169995
has comment: http://stackoverflow.com/comment/40169030
favorite count: 0
tagged with: synchronization
has answer: http://stackoverflow.com/a/25712133
type: Question
has comment: http://stackoverflow.com/comment/40169240
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40169195
has title: IllegalMonitorStateException when creating an object
has body: I'm getting IllegalMonitorStateException when I'm trying to create an instance of an object. The code looks like the following: public int signIn(parameters...) { ...check some stuff... new Thread(... just a simple log here...).start();//IllegalMonitorStateException return result; } MORE INFO: The actual application consists of 2 programs (C++ and java) interacting via JNI). The scenario in which I'm getting exception is as follows. The c++ program asks java to connect to a server. (this is a non blocking operation) Java program informs c++ about connection success. (in a new thread so that java can continue doing other tasks) When receiving connection success, c++ program asks java to login Exception occurs. I should note that this exception only happens in this special scenario and if I call login sometime after connection success everything works fine. What I've tried: In the beginning informing connection success was not in a new thread, but creating the thread did not solve the problem. The java login code had some synchronization stuff but removing them and replacing it with a simple log still produces the problem. EDIT: Here's the stacktrace: Phoenix.client.ClientAPI.NativeInterface.NativeAPIEventListener.onConnectingFinished(Native Method) Phoenix.client.ClientAPI.NativeInterface.NativeAPIEventListener.access$000(NativeAPIEventListener.java:12) Phoenix.client.ClientAPI.NativeInterface.NativeAPIEventListener$1.run(NativeAPIEventListener.java:30) java.lang.Thread.run(Unknown Source)

generator
type: Tag
tag name: generator
tags question: http://stackoverflow.com/q/25696205
tags question: http://stackoverflow.com/q/25596839

http://stackoverflow.com/comment/40098363
comment on: http://stackoverflow.com/q/25660193
type: Comment
type: QuestionComment
has text: I guess that problem is in your code that probably reads from stdout of created process. Please show your code, otherwise it is impossible to recommend you something valuable.
score: 2

http://stackoverflow.com/q/25702744
tagged with: jaxb
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion
has title: How does JAXB decide which type to create when it marshals XML that can match both types?
has answer: http://stackoverflow.com/a/25724018
upvote count: 1
has body: I have an XML schema whose topmost element is Document &lt;xsd:element name="Document" type="Document"/&gt; It contains one element of type ZZ_Customer which is restriction of Customer. Both of these elements contain children of the same name but with slightly different types. &lt;xsd:complexType name="Document"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="CstmrCdtTrfInitn" type="ZZ_Customer"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;xsd:complexType name="ZZ_Customer"&gt; &lt;xsd:complexContent&gt; &lt;xsd:restriction base="Customer"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="GrpHdr" type="ZZ_Group"/&gt; &lt;xsd:element name="PmtInf" type="ZZ_Payment" maxOccurs="unbounded"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:restriction&gt; &lt;/xsd:complexContent&gt; &lt;/xsd:complexType&gt; &lt;xsd:complexType name="Customer"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="GrpHdr" type="Group"/&gt; &lt;xsd:element name="PmtInf" type="Payment" maxOccurs="unbounded"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; When JAXB unmarshalls an XML file will it create an instance of ZZ_Customer or will it create an instance of Customer? Likewise when will it create an instance of Group or ZZ_Group? I've noticed is that JAXB will instances of ZZ_* for certain parts of the XML but uses their base counter parts for other parts of the XML. On what basis does it makes its decisions? It does not appear obvious which criteria that JAXB is using. Unfortunately I have no control over the schema and its design.
score: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40195662
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/40014321
score: 0
comment on: http://stackoverflow.com/q/25613986
has text: I would put the Scanners in the main method, and get your values there, instead of calling a function passing an undefined variable as a parameter, which shouldn't even work
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25654751
has comment: http://stackoverflow.com/comment/40142265
accepted answer of: http://stackoverflow.com/q/25643266
has comment: http://stackoverflow.com/comment/40104811
has body: Maybe some regex would be better in this occasion. import org.jsoup.Jsoup; import org.jsoup.nodes.Document; public class Main { public static void main(String[] args) { try { String html = " " + " " + " " + " Introduction " + " " + " " + " " + " Introduction " + " This book is about creating a great career. You might be saying to yourself, \"I don't want to talk about a career, much less a great career. Right now I just need a job. I need to eat!\" Well, if you're looking, we're going to show you how to get that great job now. That's the first, short-term step. But the day will come when you'll want to do more than just eat. And beyond that day will come another day when you look back at your life and take measure of your entire professional contribution to the world. This book is about today and tomorrow. It's about getting a great job now and enjoying a great career for life. When we say a person has had a great career, what do we mean? That he or she made a lot of money? moved spectacularly up the corporate ladder? became famous or renowned in his or her profession? What about the familiar comment from every movie star on every talk show: \"I can't believe I get paid for doing this!\" Are only a few people entitled to feel that way, but not the rest of us? And what about you? Are you looking forward to a great career? Would you describe your current career as \"great\"? When you get to the end of your productive life, will you be looking back on a mediocre career? a good career? a great career? And how will you know? Furthermore, just how do you create a great career for yourself? As coauthors of this book, we are fascinated by these provocative questions. We have been associated in our work for many years as avid students of what it takes to build a great life and career. And we bring two different sets of experiences to the issue, so occasionally, we will speak to you directly in our own voices. We'll share with you our discoveries and provide tools and insight…
answers question: http://stackoverflow.com/q/25643266
type: Answer
has comment: http://stackoverflow.com/comment/40103233
has comment: http://stackoverflow.com/comment/40248410
has comment: http://stackoverflow.com/comment/40099629
score: 0
has comment: http://stackoverflow.com/comment/40097388
has comment: http://stackoverflow.com/comment/40205567
has comment: http://stackoverflow.com/comment/40131485
has comment: http://stackoverflow.com/comment/40103311
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40106802

http://stackoverflow.com/q/25706233
type: Question
has comment: http://stackoverflow.com/comment/40185801
tagged with: java
has comment: http://stackoverflow.com/comment/40182223
has body: I wrote some code that asked the user to enter values, had a sentinel value of -99 and then displayed the largest and smallest value. It was working but displaying -99 as the smallest value. So I fiddled with it putting in a &amp;&amp; != -99 for the smallest value but then I got an infinite loop happening, so I took that code out. But I must have deleted something vital because now it doesn't give me the largest and smallest it just goes into an infinite loop. Could you please give me some pointers? Here is my code; public class Practice { public static void main(String[] args) { int smallest = 0; int largest = 0; int integer; // Create a Scanner object for keyboard input. Scanner input = new Scanner(System.in); System.out.println("Enter an integer: "); System.out.println("Enter -99 when finished."); System.out.println(); int n = input.nextInt(); integer = input.nextInt(); smallest = integer; while (integer != -99) { for(int i = 2; i &lt; n; i++) { integer = input.nextInt(); if(integer &gt; largest) { largest = integer; } if(integer &lt; smallest) { smallest = integer; } } } System.out.println("The largest number is:" + largest); System.out.println("The smallest number is : " + smallest); } }
has comment: http://stackoverflow.com/comment/40182263
has comment: http://stackoverflow.com/comment/40182444
has comment: http://stackoverflow.com/comment/40184807
has answer: http://stackoverflow.com/a/25708090
has answer: http://stackoverflow.com/a/25706362
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25707828
upvote count: 1
type: UnansweredQuestion
tagged with: sentinel
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/19671453
has title: Infinite loop with sentinel value and trying to get largest and smallest in java

http://stackoverflow.com/q/25627817
tagged with: jakarta-ee
answer count: 0
type: UnansweredQuestion
tagged with: maven
tagged with: glassfish
has body: I have a project IIFS-ejb (EJB project) and IIFS-common (jar file) com.islandfurniture IIFS-common 0.0.1-SNAPSHOT compile I define the dependency as shown above However, receive an error saying when i try to deploy the ejb project together with iifs-common to glassfish 4.0. The iifs-common project can be deployed while the ejb failed with the following error severe: java.lang.NoClassDefFoundError: iifs/common/exceptions/UserRoleNotFoundException Please help thank you
has comment: http://stackoverflow.com/comment/40045636
score: 0
has comment: http://stackoverflow.com/comment/40136867
has comment: http://stackoverflow.com/comment/40041182
tagged with: java
has title: Maven Dependency Project Not Found While Deploy to Glassfish 4
type: Question

http://stackoverflow.com/q/25571921
has comment: http://stackoverflow.com/comment/39938203
tagged with: whatsapp
has title: onActivityResult in fragment not called
type: AnsweredQuestion
score: 0
has body: I am trying to attach an image on whatsapp through my app. My app contains two activities A: It contains many fragments B: Just an activity When I had put an intent filter on my Mainactivity which contains fragments for picking images. So here is what happens: Tried to attach an picture to whatsapp -> Open Mainactivity(Fragment1) Click on Gridview Item -> Goes to Activity B When I click on button in B to send the data back to Whatsapp, it went back to Mainactivity which doesn't even call Fragment's OnActivityResult method. I have to send data back to whatsapp. I have looked into every question related to this problem. But nothing works! :/ Code I am using: Mainactivity.java(that contains fragments) @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); } Fragment1.java mGrid.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View view, int position, long id) { // TODO Auto-generated method stub Intent i = new Intent(getActivity(), FullImageActivity.class); // passing array index i.putExtra("im",fileList); i.putExtra("pos", position); i.putExtra("folder", folder); i.putExtra("req", isinint); startActivityForResult(i, Activity.RESULT_OK); } }); Fragment1.java(Onactivityresult) @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); if(resultCode == Activity.RESULT_OK){ Log.i("called","called"); getActivity().setResult(Activity.RESULT_OK, data); getActivity().finish(); } } Activity B: send.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Log.i("called","btncalled"); Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND, Uri.parse(Environment.getExternalStorageDirectory() + "/Smileys/" + imageUrls[pagerPosition].r…
tagged with: android-fragments
tagged with: android
tagged with: java
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25572518
accepted answer: http://stackoverflow.com/a/25572518

http://stackoverflow.com/q/25607935
tagged with: jtextfield
favorite count: 0
duplicate of: http://stackoverflow.com/q/513832
type: Question
tagged with: listener
type: UnansweredQuestion
score: -2
has answer: http://stackoverflow.com/a/25608011
has title: DocumentListener isn't printing a message
has body: I was trying to write a program which would give me a message when something (xx) in this case is typed, but it doesn't print a message. Can you please tell me why that happens ? I've also checked the code if it's equal to xx when I type it, and it is. import javax.swing.*; import java.awt.*; import javax.swing.text.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; class acc { public static void main(String[] args) { ramka ramka = new ramka(); panel panel1 = new panel(); ramka.show(); ramka.add(panel1); } } class ramka extends JFrame { public ramka() { setSize(800, 600); setTitle("Super duper programer"); Container kontener = getContentPane(); textfield pole = new textfield(); kontener.add(pole); setDefaultCloseOperation(EXIT_ON_CLOSE); sluchacz listener = new sluchacz(); pole.getDocument().addDocumentListener(listener); } } class panel extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); } } class textfield extends JTextField { } class sluchacz implements DocumentListener { @Override public void changedUpdate(DocumentEvent e) {} @Override public void removeUpdate(DocumentEvent e){} @Override public void insertUpdate(DocumentEvent e) { try { String input = e.getDocument().getText(0, e.getDocument().getLength()).trim(); if(input == "xx") { String message = JOptionPane.showInputDialog("You've just typed ''xx''"); } } catch(BadLocationException ex) { } } }
has comment: http://stackoverflow.com/comment/40003213
linked to: http://stackoverflow.com/q/513832
upvote count: 0
tagged with: java
downvote count: 2
answer count: 1
tagged with: swing

http://stackoverflow.com/a/25680444
has comment: http://stackoverflow.com/comment/40134635
has body: You need to validate session in all your pages to avoid un-authorized access or direct access. &lt;% request.getSession(); String ses=(String) session.getAttribute("usr"); if (session != null &amp;&amp; !session.isNew()) { } else if(!session.equals(ses)) { response.sendRedirect("loginPage.jsp"); } %&gt; But it is not recommended to do so as it creates code duplication in all pages , You can intercept your requests to the servlet Another thing you can do is ServletFilters To prevent direct access to the .jsp pages, you can put them under WEB-INF which needs to intercept the requests from servlet
has comment: http://stackoverflow.com/comment/40203914
upvote count: 2
score: 2
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25680401
has comment: http://stackoverflow.com/comment/40166340
accepted answer of: http://stackoverflow.com/q/25680401
type: Answer

logging
tags question: http://stackoverflow.com/q/25712068
tags question: http://stackoverflow.com/q/25604914
tags question: http://stackoverflow.com/q/25635180
tags question: http://stackoverflow.com/q/25679963
tags question: http://stackoverflow.com/q/25669636
tags question: http://stackoverflow.com/q/25563882
tags question: http://stackoverflow.com/q/25657341
tag name: logging
tags question: http://stackoverflow.com/q/25694782
tags question: http://stackoverflow.com/q/25597916
tags question: http://stackoverflow.com/q/25639828
tags question: http://stackoverflow.com/q/25662505
tags question: http://stackoverflow.com/q/25679914
tags question: http://stackoverflow.com/q/25692963
tags question: http://stackoverflow.com/q/25704527
tags question: http://stackoverflow.com/q/25686813
type: Tag
tags question: http://stackoverflow.com/q/25642388
tags question: http://stackoverflow.com/q/25674175
tags question: http://stackoverflow.com/q/25673532

http://stackoverflow.com/q/25645392
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/25645586
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25645586
downvote count: 0
tagged with: selenium
upvote count: 1
has title: What is the last version of Selenium for Java 5?
favorite count: 0
type: Question
tagged with: maven
possible better answer: http://stackoverflow.com/a/25645573
has body: I'm obliged to use Java 5 to implement Selenium tests (precisely JDK 1.5.22) and classes of the last version of Selenium (2.42.2) are compiled in Java 6 or more. What is the last version of Selenium I can use? For information, I use Selenium through Maven: org.seleniumhq.selenium selenium-java 2.42.2 test
has answer: http://stackoverflow.com/a/25645573

http://stackoverflow.com/q/25707636
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40186332
tagged with: algorithm
has body: I have been struggling to figure out the a simple decryption algorithm for the following encryption method in Java: /** * Returns the encryption of the given card number using the given keys. * Precondition: it can be assumed that cardNum is a valid numeric string, * k1 is a positive integer at most 9, and * k2 is a positive integer at most 9. * Postcondition: the string returned is the encryption of cardNum using keys * k1 and k2 */ public static String encrypt (String cardNum, int k1, int k2) { int currentNum; long encryptedNum; String cryptogram = ""; for (int i = 0; i &lt; cardNum.length(); i++) { currentNum = Character.getNumericValue(cardNum.charAt(i)); encryptedNum = (k1 * currentNum + k2) % 10;//the encryption algorithm cryptogram += encryptedNum;//add the encrypted number to the cryptogram } return cryptogram; } The previous encryption method is used to encrypt a Credit Card number of up to 16 digits and the aim is to create a method to reverse the algorithm and to retrieve the original card number. I am also aware that for certain values of k1 and k2 there is no possible decryption due to the using of modulo 10 at the end of the encryption, because of this it is also part of the assignment to figure out which values of k1 and k2 can be decrypted. Then, write a method to decrypt the cardNum assuming a valid value of k1 and k2 are used The following is as far as I have managed to get with the decrypt method and I have also not been able to determine what the valid values of k1 and k2 are. /** * Returns the decryption of the given cryptogram using the given keys. * Precondition: it can be assumed that cryptogram is a valid numeric string, * k1 is a valid first encryption key, * k2 is a valid second encryption key. * Postcondition: the string returned is the decryption of cryptogram * using keys k1 and k2 */ public static String decrypt (String cryptogram, int k1, int k2) { int currentNum; long decryptedNum; String cardNum = ""; for (int i = 0; i &lt; cryptogr…
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25708556
has answer: http://stackoverflow.com/a/25708556
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40229166
has title: Trying to Determine a simple Decryption algorithm in Java
tagged with: modulo
answer count: 1
tagged with: encryption
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25671524
score: 1
downvote count: 0
upvote count: 1
has body: You can use the javax.xml.xpath APIs in Java SE to extract the text of a element. Demo Code import javax.xml.xpath.*; import org.xml.sax.InputSource; public class Demo { public static void main(String[] args) throws Exception { InputSource inputSource = new InputSource("input.xml"); XPath xPath = XPathFactory.newInstance().newXPath(); String text = xPath.evaluate("/note/body", inputSource); System.out.println(text); } } Output Don't forget me this weekend!
type: Answer
answers question: http://stackoverflow.com/q/25670757

http://stackoverflow.com/a/32546863
has body: Try to initialize you code in onLoad() widget life cycle method. @Override protected void onLoad() { radioButton = DOM.getElementById("radio_green_id_1").cast(); radioButton.setId(DOM.createUniqueId()); Event.sinkEvents(ulPanel, Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT); Event.setEventListener(ulPanel, this.eventListener); }
answers question: http://stackoverflow.com/q/25634257
score: 0
type: Answer

http://stackoverflow.com/q/25711103
has answer: http://stackoverflow.com/a/25711135
tagged with: combobox
has answer: http://stackoverflow.com/a/25711463
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25712972
downvote count: 0
answer count: 3
tagged with: java
tagged with: javafx
favorite count: 0
has comment: http://stackoverflow.com/comment/40191943
accepted answer: http://stackoverflow.com/a/25711463
has body: I am using the JavaFX Combobox for the first time... and I have over 2000 icons in the combobox (they can be filtered via AutoCompleteComboBoxListener that I found from StackOverflow). I am planning to use the ExecutorService to fetch the images from a zip-file. Now, the problem is that how can I figure out the currently visible items in the Combobox? I am setting a custom ListCellFactory for the ComboBox, and I have a custom ListCell class, that also displays the icon. Can I somehow check from within the ListCell object whether the item "is showing" ? Thanks.
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40191215
has title: JavaFx Combobox lazy loading images
has answer: http://stackoverflow.com/a/25712972
has comment: http://stackoverflow.com/comment/40191030

http://stackoverflow.com/a/25603626
upvote count: 1
answers question: http://stackoverflow.com/q/25603022
has comment: http://stackoverflow.com/comment/40468851
downvote count: 0
has comment: http://stackoverflow.com/comment/39996234
type: Answer
has comment: http://stackoverflow.com/comment/40468799
has comment: http://stackoverflow.com/comment/39996256
has comment: http://stackoverflow.com/comment/39996927
score: 1
has comment: http://stackoverflow.com/comment/39996334
has comment: http://stackoverflow.com/comment/39996072
has comment: http://stackoverflow.com/comment/39995876
has body: Steps do achieve what you are aiming : 1) Create different themes corresponding to each item in the spinner in styles.xml. Let these themes define the different textcolors you want to set. 2) Then, when an item is selected from the spinner, use the following line of code to change the theme of your activity : this.setTheme(R.style.yourcorrespondingtheme);

activejdbc
tag name: activejdbc
tags question: http://stackoverflow.com/q/25670554
type: Tag

min
type: Tag
tag name: min
tags question: http://stackoverflow.com/q/25557972

http://stackoverflow.com/q/25687994
type: AnsweredQuestion
tagged with: java
tagged with: dependencies
tagged with: gradle
score: 0
has body: I'm working on a project: https://github.com/Romain-P/Jumbo Jumbo-API Jumbo-Common Jumbo-Login (main project) Jumbo-Login use API &amp; Commons dependencies, but common depends on API &amp; API on common. So gradle want to do that: Compile API.jar + Common.jar Compile Common.jar + Api.jar Compile login.jar + API.jar + Common.jar We've so a stackoverflow exception.. So i thought to do not adding dependencies to API &amp; Common because they will be in the same .jar after (in the Login.jar) But Gradle doesn't want ! He return to me an error, and it say i MUST declare my dependencies to compile the global project. Do you have the solution ? Thank you
tagged with: api
has answer: http://stackoverflow.com/a/25688416
accepted answer: http://stackoverflow.com/a/25688416
answer count: 1
tagged with: compilation
type: Question
has title: Java - How to use a dependency without compile it with the Gradle project

http://stackoverflow.com/a/25560835
downvote count: 2
score: 5
upvote count: 7
has body: The android documentation for a SparseArray says "It is generally slower than a traditional HashMap". Yes,it's right. But when you have only 10 or 20 items , the performance difference should be insignificant. If you write code using HashMaps rather than SparseArrays your code will work with other implementations of Map and you will be able to use all of the java APIs designed for Maps I think most often we only use HashMap to search a value associated with a key while SparseArray is really good at this. If you write code using HashMaps rather than SparseArrays your code will work in non-android projects. The source code of SparseArray is fairly simple and easy to understand so that you only pay little effort moving it to other platforms(through a simple COPY&amp;Paste). Map overrides equals() and hashCode() whereas SparseArray doesn't All I can say is, (to most developers)who care? Another important aspect of SparseArray is that it only uses an array to store all elements while HashMap uses Entry, so SparseArray costs significant less memory than a HashMap, see this
type: Answer
answers question: http://stackoverflow.com/q/25560629

http://stackoverflow.com/comment/39948047
score: 0
has text: @dave_thompson_085 There is a default truststore, but there is no default keystore at all.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25562494

http://stackoverflow.com/q/25687270
has comment: http://stackoverflow.com/comment/40146761
has answer: http://stackoverflow.com/a/25689430
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25687559
answer count: 4
has title: Getting a Java.io.FileNotFoundException; in a program and don't know how to fix
has answer: http://stackoverflow.com/a/25687562
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25687419
has comment: http://stackoverflow.com/comment/40147021
type: Question
tagged with: exception
has body: Building a small game by myself as a little project, I'm not very good with error handling and suchlike, so I'm getting a java.io.FileNotFoundException error and I'm not sure how to proceed. This is my first post here so I apologize for being so vague, I'm guessing I need to throw the exception or catch it in some way? import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) public class GameOver extends Actor { public static Counter highScore; public static int currentScore; /** * Act - do whatever the gameOver wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { displayScore(); if(Greenfoot.isKeyDown("space")) { Greenfoot.setWorld(new City()); } } //This is where I am getting the error private void displayScore() { highScore = new Counter ("HIGHSCORE: "); getWorld().addObject(highScore, 700, 50); //Add width/height highScore.setLocation(City.WIDTH/2, City.HEIGHT/4); currentScore = (0+City.score); int topScore; //The error is coming from this block of code BufferedReader saveFile = new BufferedReader(new FileReader("TextSave.txt")); topScore = Integer.parseInt(saveFile.readLine()); saveFile.readLine(); saveFile.close(); if (topScore &lt; currentScore) { FileWriter writer = new FileWriter("topScore.txt"); writer.write(currentScore); writer.close(); } highScore.setValue(topScore); } }

http://stackoverflow.com/comment/40076943
has text: Yep, geometry shader could be used here pretty nicely.
type: Comment
comment on: http://stackoverflow.com/q/25647799
score: 0
type: QuestionComment

http://stackoverflow.com/q/25566734
tagged with: events
has comment: http://stackoverflow.com/comment/39927178
has comment: http://stackoverflow.com/comment/39926792
has answer: http://stackoverflow.com/a/25566887
tagged with: swing
favorite count: 0
has body: I have a program which uses a JTable. I have given it a RowSorter so that when you click on the column headings the table sorts by that column. I want to capture the user clicking on the column header and output a debug message. e.g. System.out.println("You have sorted by first name ascending"); System.out.println("You have sorted by first name descending"); System.out.println("You have sorted by last name ascending"); So I need to respond to the sort event. I have searched for examples online but I can't find any.
type: Question
has comment: http://stackoverflow.com/comment/39926843
has comment: http://stackoverflow.com/comment/39926754
score: 3
has title: Does JTable have a sort event?
tagged with: sorting
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39933438
upvote count: 3
accepted answer: http://stackoverflow.com/a/25566887
tagged with: java
has comment: http://stackoverflow.com/comment/39927124
downvote count: 0
answer count: 1

http://stackoverflow.com/q/25607320
has body: I use: org.apache.avro avro-mapred 1.7.4 hadoop2 Question: How to attach sources to that classes?
tagged with: java
has title: Hadoop mapred: attach sources howto
answer count: 1
type: Question
tagged with: hadoop
type: UnansweredQuestion
tagged with: maven
score: 0
has answer: http://stackoverflow.com/a/25608144

http://stackoverflow.com/comment/40088928
has text: I have firebug, how can check it? In html tab I can see the value.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25654455
score: 0

http://stackoverflow.com/a/25603714
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39997689
answers question: http://stackoverflow.com/q/25603463
has comment: http://stackoverflow.com/comment/39996109
score: 3
has body: JSONArray newArray = new JSONArray(s); newArray.get(0); newArray.get(1);
upvote count: 3
has comment: http://stackoverflow.com/comment/39996074

http://stackoverflow.com/a/25662719
has comment: http://stackoverflow.com/comment/40135265
answers question: http://stackoverflow.com/q/25662415
has comment: http://stackoverflow.com/comment/40102688
type: Answer
has comment: http://stackoverflow.com/comment/40136510
has comment: http://stackoverflow.com/comment/40134163
has comment: http://stackoverflow.com/comment/40129330
score: 0
has comment: http://stackoverflow.com/comment/40103717
has body: You could use the Push Notifications API to notify users of updated property pages? Push Notifications in Android Platform

http://stackoverflow.com/q/25601393
has comment: http://stackoverflow.com/comment/39994153
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39991932
has body: There was a mySql DB connection in my application, i need to crate another connection for different mySql DB for that i replicate the already created connection's steps with some different name in order to create the new mySQL DB connection but im facing the following exception, can any one help me by giving some hint where did i make the mistake. 01 Sep 2014 01:34:41,931 ERROR [localhost-startStop-1] context.ContextLoader:227 - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcTemplatePivotDB' defined in class path resource [application-context-dao.xml]: Cannot resolve reference to bean 'dataSourcePivotDBJNDI' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourcePivotDBJNDI' defined in class path resource [application-context-dao.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [${jdbc.pivotDB.jndi.name}] is not bound in this Context. Unable to find [${jdbc.pivotDB.jndi.name}]. at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:616) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean…
has comment: http://stackoverflow.com/comment/39991316
score: 1
has comment: http://stackoverflow.com/comment/39991237
tagged with: java
has answer: http://stackoverflow.com/a/25602244
possible better answer: http://stackoverflow.com/a/25602244
has answer: http://stackoverflow.com/a/25603147
accepted answer: http://stackoverflow.com/a/25603147
upvote count: 1
favorite count: 0
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39991165
downvote count: 0
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39991334
tagged with: spring
has title: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name defined in class path resource

http://stackoverflow.com/a/25647316
upvote count: 2
downvote count: 0
has body: According to Apache Wink documentation found here, it seems that BufferedInMultiPart stores complete file into memory, so try to replace BufferedInMultiPart with InMultiPart: import org.apache.wink.common.model.multipart.InMultiPart; @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) @Path("/upload") public RestResult upload(InMultiPart bimp) { List&lt;InPart&gt; parts = new ArrayList&lt;InPart&gt;(); while(bimp.hasNext()) { parts.add(bimp.next()); } // .... }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40074844
score: 2
accepted answer of: http://stackoverflow.com/q/25645299
type: Answer
answers question: http://stackoverflow.com/q/25645299
has comment: http://stackoverflow.com/comment/40076488

http://stackoverflow.com/comment/40029968
type: QuestionComment
has text: Try int y=Gdx.graphics.getHeight() - Gdx.input.getY() - 1;
score: 0
comment on: http://stackoverflow.com/q/25620774
type: Comment

http://stackoverflow.com/q/25619859
has title: Error when I load RDF triples on Virtuoso TripleStore
favorite count: 0
type: Question
tagged with: virtuoso
tagged with: http://stackoverflow.com/tag/rdf
tagged with: jena
score: -2
has body: I have a question. I'm following the sample8 on http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtJenaProvider. In particular, I have this code: package ExampleVirtuoso; import com.hp.hpl.jena.query.*; import com.hp.hpl.jena.rdf.model.RDFNode; import virtuoso.jena.driver.*; public class ExampleVirtuoso { public static void main(String[] args) { /* STEP 1 */ VirtGraph set = new VirtGraph("jdbc:virtuoso://localhost:1111", "dba", "dba"); /* STEP 2 */ System.out.println("\nexecute: CLEAR GRAPH &lt;http://test1&gt;"); String str = "CLEAR GRAPH &lt;http://test1&gt;"; VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(str, set); vur.exec(); System.out.println("\nexecute: INSERT INTO GRAPH &lt;http://test1&gt; { &lt;aa&gt; &lt;bb&gt; 'cc' . &lt;aa1&gt; &lt;bb1&gt; 123. }"); str = "INSERT INTO GRAPH &lt;http://test1&gt; { &lt;aa&gt; &lt;bb&gt; 'cc' . &lt;aa1&gt; &lt;bb1&gt; 123. }"; vur = VirtuosoUpdateFactory.create(str, set); vur.exec(); /* STEP 3 */ /* Select all data in virtuoso */ System.out.println("\nexecute: SELECT * FROM &lt;http://test1&gt; WHERE { ?s ?p ?o }"); Query sparql = QueryFactory.create("SELECT * FROM &lt;http://test1&gt; WHERE { ?s ?p ?o }"); /* STEP 4 */ VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create(sparql, set); ResultSet results = vqe.execSelect(); while (results.hasNext()) { QuerySolution rs = results.nextSolution(); RDFNode s = rs.get("s"); RDFNode p = rs.get("p"); RDFNode o = rs.get("o"); System.out.println(" { " + s + " " + p + " " + o + " . }"); } System.out.println("\nexecute: DELETE FROM GRAPH &lt;http://test1&gt; { &lt;aa&gt; &lt;bb&gt; 'cc' }"); str = "DELETE FROM GRAPH &lt;http://test1&gt; { &lt;aa&gt; &lt;bb&gt; 'cc' }"; vur = VirtuosoUpdateFactory.create(str, set); vur.exec(); System.out.println("\nexecute: SELECT * FROM &lt;http://test1&gt; WHERE { ?s ?p ?o }"); vqe = VirtuosoQueryExecutionFactory.create(sparql, set); results = vqe.execSelect(); while (results.hasNext()) { QuerySolution rs = results.…
has answer: http://stackoverflow.com/a/25619988
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25619988
tagged with: triplestore
upvote count: 0
tagged with: java
downvote count: 2
answer count: 1

http://stackoverflow.com/comment/39976842
type: Comment
has text: +1, an array/`ArrayList` is simpler to work with. If for some reason it really is necessary to return a `Map`, you could create a class that wraps the array and implements the `Map` interface.
type: AnswerComment
comment on: http://stackoverflow.com/a/25593363
score: 0

http://stackoverflow.com/q/25622939
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40038931
has comment: http://stackoverflow.com/comment/40030397
has answer: http://stackoverflow.com/a/25623351
downvote count: 3
has comment: http://stackoverflow.com/comment/40032724
has answer: http://stackoverflow.com/a/25623513
answer count: 4
has answer: http://stackoverflow.com/a/25623070
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25623008
has comment: http://stackoverflow.com/comment/40060773
has answer: http://stackoverflow.com/a/25623008
has body: I want to record a HashMap's state in a point of time. Then user might or might not change it, and when they click a button, I want to compare the HashMap's state to the previously saved state and see whether there has been any changes. Can I do String firstState = map.toString(); then String secondState = map.toString(); and then compare whether they are equal? EDIT: By state I mean something that will change if anything about the HashMap changes
score: 0
has comment: http://stackoverflow.com/comment/40030484
has comment: http://stackoverflow.com/comment/40031764
has title: Java how to detect whether a hashmap has changed after some time or operations?
has comment: http://stackoverflow.com/comment/40032052
has comment: http://stackoverflow.com/comment/40030363
has comment: http://stackoverflow.com/comment/40030675
has comment: http://stackoverflow.com/comment/40046914
has comment: http://stackoverflow.com/comment/40032433
has comment: http://stackoverflow.com/comment/40032392
has comment: http://stackoverflow.com/comment/40030463
has comment: http://stackoverflow.com/comment/40031590
has comment: http://stackoverflow.com/comment/40030526
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25623351

http://stackoverflow.com/a/25591366
upvote count: 4
has comment: http://stackoverflow.com/comment/39974518
accepted answer of: http://stackoverflow.com/q/25591169
downvote count: 0
type: AcceptedAnswer
score: 4
has body: Generally speaking you won't be able to launch an external application from an applet. The Java sandbox in which an untrusted applet is executed is not permitted to launch external applications. If you: add the required permissions to your JAR's manifest, signed your applet, and convinced the end user / browser to trust the applet. you could potentially work around this restriction. The following references discuss this: http://docs.oracle.com/javase/tutorial/deployment/jar/intro.html http://www.oracle.com/technetwork/java/javase/tech/java-code-signing-1915323.html http://www.digicert.com/code-signing/java-7-update-51-code-signatures-required.htm http://www.java.com/en/download/help/jcp_security.xml However, this presupposes that you can convince the end users (or their system admin / security staff) to enable a Java plugin at all. A lot of people won't ... for obvious reasons. IMO, you need to think of a way to edit files that doesn't involve using applets at all.
answers question: http://stackoverflow.com/q/25591169
type: Answer

http://stackoverflow.com/comment/40057432
has text: Hmm.. The protocol specification I'm implementing seems to imply the order of checking (hostname check and then certificate validation). So I think an implementation of `TrustManager` interface is the right place to do this check in my case.
comment on: http://stackoverflow.com/a/25634147
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25583241
has comment: http://stackoverflow.com/comment/40016358
upvote count: 3
score: 3
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25583122
has body: Such an URL is used for getting a customer that you already know. Not for searching customers. For searching customers, you would typically use an URL like http://www.example.com/customers?name=Doe&amp;firstname=John This would list all the customers named John Doe, and the list would contain, for every customer, the ID of the found customer. The client would then use this ID to invoke the URL in your question and get detailed information about this customer. You can of course use any query criteria you want, or allow accessing customers by other means. If you think about it, that's exactly how web searchingworks. You don't know the URL of a page, you search for this page by keywords on Google, which returns a list of results containing the title, description and URL of thepage, then you use the URL to actually access the page.
type: Answer
accepted answer of: http://stackoverflow.com/q/25583122

http://stackoverflow.com/a/25585473
type: Answer
answers question: http://stackoverflow.com/q/25585391
downvote count: 1
has comment: http://stackoverflow.com/comment/39964226
has body: You can't change the hash key after it's put in the map and expect the map to continue to work correctly. When you want to change a key, you must remove the item, change the key, and reinsert. From the Java documentation: Note: great care must be exercised if mutable objects are used as map keys. The behavior of a map is not specified if the value of an object is changed in a manner that affects equals comparisons while the object is a key in the map.
score: 1
has comment: http://stackoverflow.com/comment/39962130
has comment: http://stackoverflow.com/comment/39962607
upvote count: 2

http://stackoverflow.com/q/25624424
has comment: http://stackoverflow.com/comment/41972660
favorite count: 0
has comment: http://stackoverflow.com/comment/40034601
type: Question
has comment: http://stackoverflow.com/comment/40033609
has comment: http://stackoverflow.com/comment/40034238
has body: I'm currently trying to integrate Facebook into my Android application. I've had no problems getting the app to connect and authenticate. But I'm having a little trouble understanding how I can handle data once the onCompleted(Response response) callback method is executed. The method below works: private void onSessionStateChange(Session session, SessionState state, Exception exception) { if (state.isOpened()) { Log.i(TAG, "Logged in..."); new Request(session, "/me", null, HttpMethod.GET, new Request.Callback() { @Override public void onCompleted(Response response) { GraphObject graphObject = response.getGraphObject(); JSONObject data = graphObject.getInnerJSONObject(); Log.i(TAG, "My DETAILS: "); try { Log.i(TAG, "ID: " + data.getLong("id")); Log.i(TAG, "Name: " + data.getString("name")); Log.i(TAG, "Email: " + data.getString("email")); Log.i(TAG, "Gender: " + data.getString("gender")); } catch (JSONException e) { e.printStackTrace(); } } }).executeAsync(); } else if (state.isClosed()) { Log.i(TAG, "Logged out..."); } } When I run my application, Facebook authenticates, the data is retrieved and successfully outputs to the Logcat window. However, I'm at a loss to understand how I can pass the JSONObject back to my fragment for further processing. Most examples I've looked at online simply set the JSONObject content to views in the fragment, or even less helpful simply say /* Handle response here */ or something similar. I have another similar method where I want to get a profile image url and download the image, but I can't get the url back to my fragment for further processing. Should I do something like develop a runnable class that accepts a JSONObject as a parameter and start a separate thread from the onCompleted() method to process it the way I want? My current goal is to get a list of the users friends who use my app and save their profile pictures for use within the app. Am I going about this the wrong way?
has title: How can I pass data returned from Facebook when Request.callback onCompleted() method is called, to my fragment in Android?
tagged with: android
tagged with: facebook
has answer: http://stackoverflow.com/a/26755808
accepted answer: http://stackoverflow.com/a/26755808
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40034036
downvote count: 0
tagged with: android-fragments
upvote count: 1
score: 1
tagged with: java
answer count: 1

http://stackoverflow.com/q/25642989
has answer: http://stackoverflow.com/a/25643093
has title: How to get next day and previous day of a given date?
linked to: http://stackoverflow.com/q/428918
has comment: http://stackoverflow.com/comment/40081207
has answer: http://stackoverflow.com/a/25643023
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40096682
has answer: http://stackoverflow.com/a/25643367
score: -2
downvote count: 2
has body: How to get next day and previous day in Java when we know some date? For example, suppose getBatchDate() = 2014-08-21. How to get previous day and next day with lesser code?
upvote count: 0
answer count: 3
tagged with: java
tagged with: datetime
favorite count: 0
has comment: http://stackoverflow.com/comment/40066830
type: Question

http://stackoverflow.com/comment/87011176
has text: This question should be reopened, as it clearly states its use case being different from the marked duplicate.
comment on: http://stackoverflow.com/q/25680258
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40088439
comment on: http://stackoverflow.com/a/25654509
type: Comment
score: 0
type: AnswerComment
has text: The issue is not that the class cannot be found, it's that the class can be found twice. I don't think this addresses the issue because there will still be a namespace collision.

http://stackoverflow.com/q/25566375
answer count: 1
tagged with: embedded-resource
tagged with: java-web-start
has answer: http://stackoverflow.com/a/25569195
has comment: http://stackoverflow.com/comment/39926156
score: 0
has title: load class from another class within same jar in java web start fails
has body: I've a javafx application which is run by web start. In my fx application, I try to load the classes using ClassLoader as in below code. The parameter passed is a package name like "com.example.project.abcd" public final static List&lt;Class&lt;?&gt;&gt; find(final String scannedPackage) { final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); final String scannedPath = scannedPackage.replace(DOT, SLASH); final Enumeration&lt;URL&gt; resources; try { resources = classLoader.getResources(scannedPath); } catch (IOException e) { throw new IllegalArgumentException(String.format(BAD_PACKAGE_ERROR, scannedPath, scannedPackage), e); } final List&lt;Class&lt;?&gt;&gt; classes = new LinkedList&lt;Class&lt;?&gt;&gt;(); while (resources.hasMoreElements()) { final File file = new File(resources.nextElement().getFile()); classes.addAll(find(file, scannedPackage)); } return classes; } Now I'm not able to get all the classes present inside "com.example.project.abcd" package when I run it thru java web start but through IDE it is working fine. I'm using JDK 7, JavaFX 2. As per http://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersguide/faq.html#s211 Thread.currentThread().getContextClassLoader() should work fine but it is not!. Tried searching on net/googling but in vain. Checked http://lopica.sourceforge.net/faq.html#customcl as well and tried using URLClassLoader as suggested. But that didn't work as well (Though did not know what should be passed to the parameter 'urls') Any help is much apreciated.
tagged with: jnlp
tagged with: java
has comment: http://stackoverflow.com/comment/39927102
tagged with: javafx-2
type: Question
has comment: http://stackoverflow.com/comment/39927957
type: UnansweredQuestion

http://stackoverflow.com/comment/40140603
score: 0
has text: If you're adding to an envelope, that's just another property of the entity. If you're adding them directly, the method is the trivial-to-find ResponseBuilder#link().
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25670236

xcode
tag name: xcode
tags question: http://stackoverflow.com/q/25698550
type: Tag

http://stackoverflow.com/comment/39949530
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25578334
score: 0
has text: @AndrewThompson i was refering to a "way to say something" jejeje sorry

http://stackoverflow.com/comment/40044683
score: 3
type: Comment
comment on: http://stackoverflow.com/a/25630393
type: AnswerComment
has text: Or Clojure's ratios in some cases.

http://stackoverflow.com/q/25573245
answer count: 1
tagged with: servlets
type: Question
type: UnansweredQuestion
has body: I see this error very common in the blogs and SO but I could not somehow resolve it.. Error: exception javax.servlet.ServletException: Error instantiating servlet class DemoServlet org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:701) root cause java.lang.ClassNotFoundException: DemoServlet org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExec…
has title: Classnotfoundexception while running java servlet
tagged with: tomcat
has answer: http://stackoverflow.com/a/25573262
score: 0
tagged with: java

http://stackoverflow.com/q/25670054
has body: public class B extends A{ public int g(){ int x = super.x; int y = super.getOne(); return x+y; } public static void main(String args[]){ System.out.println(g()); } } Why do I get the error (on the left of the printing line): cannot make a static reference to the non-static method g() from the type B ?
has comment: http://stackoverflow.com/comment/40115882
upvote count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/40115902
answer count: 2
has title: static and non-static error
has answer: http://stackoverflow.com/a/25670255
favorite count: 0
tagged with: static
type: Question
tagged with: java
type: UnansweredQuestion
score: -2
has answer: http://stackoverflow.com/a/25670106

http://stackoverflow.com/a/25706052
type: Answer
has comment: http://stackoverflow.com/comment/40201121
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/40182127
has comment: http://stackoverflow.com/comment/40182248
downvote count: 1
has comment: http://stackoverflow.com/comment/40191291
answers question: http://stackoverflow.com/q/25705097
has body: Case 5: DataOutputStream writing to a ByteArrayOutputStream. Pro: it's already done; it's as fast as anything else you've mentioned here; all primitives are already implemented. The converse is DataInputStream reading from a ByteArrayInputStream. Con: nothing I can think of.

http://stackoverflow.com/q/25595001
has comment: http://stackoverflow.com/comment/39980899
favorite count: 0
has answer: http://stackoverflow.com/a/25595046
type: Question
upvote count: 2
answer count: 2
has body: I have created a unidirectional one-to-one relationship like this: @Entity(name="person") public class Person { @Id @GeneratedValue @Column(name = "pid", unique = true) // note 2 private int id; // more fields @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name="address_id", unique = true) // note 1 private Address address; // rest of class } @Entity(name="address") public class Address { @Id @GeneratedValue @Column(name = "aid", unique = true) private int id; // rest of class } note 1: If I don't specify the "address_id" column to be unique like this @JoinColumn(name="address_id") then it is not unique and I can have many persons refer to the same adress which is a many-to-one relation like this: Person person1 = new Person(); Person person2 = new Person(); Address address = new Address("21th street"); person1.setAddress(address); person2.setAddress(address); Shouldn't a one-to-one relation make the foreign key "address_id" unique by default? note 2: The id is not unique although I specify it. Why?
has title: Hibernate one to one allows many to one
type: UnansweredQuestion
tagged with: jpa
has comment: http://stackoverflow.com/comment/39982556
has answer: http://stackoverflow.com/a/25595044
score: 2
downvote count: 0
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/40171943
has text: I like this solution, because it generates elegant code. Is it inefficient? For a very large number of dice, perhaps, but you can solve that by wrapping it in a Class instead.
type: Comment
comment on: http://stackoverflow.com/a/25700481
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40065142
type: QuestionComment
has text: If the value contains \ ,it causes error in front end
comment on: http://stackoverflow.com/q/25641985
score: 0
type: Comment

http://stackoverflow.com/comment/40065886
has text: possible duplicate of [How to change the size of the font of a JLabel to take the maximum size](http://stackoverflow.com/questions/2715118/how-to-change-the-size-of-the-font-of-a-jlabel-to-take-the-maximum-size)
comment on: http://stackoverflow.com/q/25642632
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39938505
type: Comment
has text: I have set my x -axis as options2.xAxis.categories[index] = data["syList"][index] ["value1"]; By default it is showing me value1 as tool tip but I want to overide it and show agrAcronym"as the tool tip. any help woud be greatly appreciated
type: QuestionComment
comment on: http://stackoverflow.com/q/25572564
score: 0

http://stackoverflow.com/q/25581631
tagged with: jframe
has answer: http://stackoverflow.com/a/25581665
type: AnsweredQuestion
has title: New window inside a main window?
answer count: 2
accepted answer: http://stackoverflow.com/a/25581654
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25581654
has body: I am a beginner and I am trying to make a text editor and I want to create a pop up window for text format when I press a menu button where I can put all things like font face, font size , font style etc. Can you tell me how I can make this new window? Thanks for your patience! For example Notepad:
downvote count: 0
tagged with: jpanel
upvote count: 1
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25581665

http://stackoverflow.com/comment/40012818
type: Comment
comment on: http://stackoverflow.com/a/25611842
type: AnswerComment
score: 0
has text: @SamuelRonha: please clarify for those of us who put in the time and effort to study your code and try to understand your problem, what was wrong. Again, what were you trying to achieve???

http://stackoverflow.com/comment/40078893
has text: you may need to look into pivot tables
comment on: http://stackoverflow.com/q/25649575
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/25682347
has body: Try use listFilesAndDirs pointing to root folder or to d:\a\b\c.
has comment: http://stackoverflow.com/comment/40143845
has comment: http://stackoverflow.com/comment/40138761
has comment: http://stackoverflow.com/comment/40140648
type: Answer
answers question: http://stackoverflow.com/q/25682140
score: 0

http://stackoverflow.com/comment/40182518
comment on: http://stackoverflow.com/a/25704432
type: Comment
has text: A CDI producer method is also compatible with this technique, right?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39921576
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25563802
has text: https://www.youtube.com/watch?v=f7yE8TKUB_M, couldn't help myself. XP
type: Comment

while-loop
tags question: http://stackoverflow.com/q/25593008
type: Tag
tags question: http://stackoverflow.com/q/25706940
tags question: http://stackoverflow.com/q/25584562
tags question: http://stackoverflow.com/q/25697131
tags question: http://stackoverflow.com/q/25553250
tags question: http://stackoverflow.com/q/25672796
tags question: http://stackoverflow.com/q/25610290
tags question: http://stackoverflow.com/q/25684352
tags question: http://stackoverflow.com/q/25707347
tags question: http://stackoverflow.com/q/25575604
tags question: http://stackoverflow.com/q/25623265
tags question: http://stackoverflow.com/q/25657294
tags question: http://stackoverflow.com/q/25709103
tags question: http://stackoverflow.com/q/25695168
tags question: http://stackoverflow.com/q/25602634
tags question: http://stackoverflow.com/q/25587675
tags question: http://stackoverflow.com/q/25647747
tag name: while-loop

http://stackoverflow.com/comment/40155375
comment on: http://stackoverflow.com/q/25689871
score: 0
type: Comment
type: QuestionComment
has text: did you try putting a proxy in the middle (like charles proxy) to see what happens?

http://stackoverflow.com/a/25780779
has body: According to me, you want to check for alerts and if any alert is present you want to accept those alerts. See the below code for the same. public boolean alertPresence() { boolean presence = false; try { driver.switchTo().alert(); presence = true; alert.accept(); } catch (NoAlertPresentException Ex) { Ex.printStackTrace; presence = false; } }
has comment: http://stackoverflow.com/comment/40414125
type: Answer
answers question: http://stackoverflow.com/q/25710562
has comment: http://stackoverflow.com/comment/40395309
score: 0

http://stackoverflow.com/a/25660676
type: Answer
answers question: http://stackoverflow.com/q/25647925
has comment: http://stackoverflow.com/comment/40099858
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/40105926
upvote count: 5
has body: Looks like the allowed time differance is hard coded. See this source file look at the constant responseSkew. The default is 60 sec. I think your best option here is to try to set the same time on the servers.

http://stackoverflow.com/q/25645351
accepted answer: http://stackoverflow.com/a/25645514
has answer: http://stackoverflow.com/a/25645521
has comment: http://stackoverflow.com/comment/40071244
has title: Not sure how to create an object with Java Scanner and storing it inside an ArrayList
upvote count: 0
score: -2
downvote count: 2
has answer: http://stackoverflow.com/a/25645514
possible better answer: http://stackoverflow.com/a/25645521
tagged with: arraylist
tagged with: object
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/30242497
answer count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40071009
favorite count: 0
type: Question
has body: I'm currently trying to make an Object with Java Scanner input. This object CashCard contains the fields amount, name &amp; amountcardisused. But i'm not sure how i can get inputs from java Scanner and than move it inside my ArrayList CashCard. This is mycode so far, i'm not sure how to continue, hopefully you can help me out. Class Cashcard package cashcard; import java.util.ArrayList; public class CashCard { private double amount; private String name; private int amountcardisused; private ArrayList&lt;CashCard&gt; listofcashcards; public CashCard(String name, double amount, int amountcardisused){ this.amount = amount; this.name = name; this.amountcardisused = amountcardisused; listofcashcards = new ArrayList&lt;CashCard&gt;(); } public String setName(String name){ return name; } public double setAmount(double amount){ return amount; } public int setTimesCardIsUsed(int amountcardisused){ return amountcardisused; } } Class TestCashCard package cashcard; import java.util.*; public class TestCashCard { ArrayList&lt;CashCard&gt; listofcashcards = new ArrayList&lt;CashCard&gt;(); public static void main(String[] args) { Scanner in = new Scanner(System.in); String input; // Stop console when entering 0 in console System.out.println("0: Stop Program"); System.out.println("1: Add CashCard"); // Execute this code when entering 1 in console System.out.println(); System.out.print("Enter 0 or 1: "); input = in.nextLine(); if(input.equals("0")){ System.exit(0); } else if(input.equals("1")){ System.out.print("Enter name of the card owner: "); String yourname = in.nextLine(); System.out.println("Enter the amount you want to set on your cashcard: "); double youramount = in.nextDouble(); System.out.print("Enter The Amount This Card Is Already Used: "); int youramountcardisused = in.nextInt(); // Do Something to create an CashCard object by using the scanner its input // and than put the object inside the ArrayList CashCard. // Need help on this part } else{ System.out.print("No cho…
tagged with: java.util.scanner

http://stackoverflow.com/q/25649842
has title: Deleting complex object in Java list (for implementation on WSDL)
has body: I am following those three tutorials and I have completed it with success. http://oracleadfhowto.blogspot.in/2013/03/create-simple-web-service-using-oracle.html http://oracleadfhowto.blogspot.in/2013/03/consuming-web-service-using-web-service.html http://oracleadfmobile.blogspot.in/2013/03/consuming-soap-web-service-in-adf.html But then, as author haven't implemented removeCountries method I tried to create it. What I did initially was to just add to class Countries this method: public boolean removeCountry(Country country) { return countries.remove(country); } But although compiler wasn't complaining it didn't work. Actually it worked last night (before reboot) but not today. Must be some SOAP iterator/bindig thing or whatever. Or I thought that it worked but in fact it didn't. Here are original classes: //------------------------------- public class Country { String CountryId; String CountryName; public Country() { super(); } public Country( String id, String name ) { super(); this.CountryId = id; this.CountryName = name; } public void setCountryId(String CountryId) { this.CountryId = CountryId; } public String getCountryId() { return CountryId; } public void setCountryName(String CountryName) { this.CountryName = CountryName; } public String getCountryName() { return CountryName; } } //---------------------------------- public class Countries { List&lt;Country&gt; countries = new ArrayList&lt;Country&gt;(); public Countries() { super(); } public void setCountries(List&lt;Country&gt; countries) { this.countries = countries; } public List&lt;Country&gt; getCountries() { if ( countries.size() == 0 ) { countries.add( new Country("IT","ITALY")); countries.add( new Country("IN","INDIA")); countries.add( new Country("US","UNITED STATES")); } return countries; } public boolean addCountry( Country country ) { return countries.add( country ); } // I added this public boolean removeCountry( Country country ) { return countries.remove( country ); } } //----------------------…
type: AnsweredQuestion
score: 0
tagged with: list
tagged with: java
answer count: 1
tagged with: wsdl
has answer: http://stackoverflow.com/a/25667390
accepted answer: http://stackoverflow.com/a/25667390
type: Question
tagged with: iterator
tagged with: weblogic

http://stackoverflow.com/q/25669145
has title: Get all data from SQLite trough search
tagged with: java
accepted answer: http://stackoverflow.com/a/25669218
tagged with: sqlite
answer count: 1
has answer: http://stackoverflow.com/a/25669218
type: Question
tagged with: android
has body: I am trying to get all data from my SQLite using Query LIKE statement. But I don't know how to get it. I try to modified the Query that I use to get All the data without filtering, and its work fine. I already try to search this problem but I still don't get it. Here's my Search.java Intent search = getIntent(); String searchResult = search.getStringExtra("TAG_SEARCH"); DatabaseHandler db = new DatabaseHandler(this); /** * CRUD Operations * */ Log.d("Reading: ", "Reading all contacts.."); List &lt;AllItem&gt; allItems = new ArrayList&lt;AllItem&gt;(); allItems = db.getAllSearchResult(); ArrayList &lt;String&gt; allItems2 = new ArrayList&lt;String&gt;(); for (AllItem cn : allItems) { allItems2.add(cn.getItem_name()); allItems2.add(cn.getAreaNAme()); allItems2.add(cn.getPriceCategory()); allItems2.add(cn.getImageCount()); allItems2.add(cn.getID()); allItems2.add(cn.getCategory_name()); allItems2.add(cn.getKids()); allItems2.add(cn.getFreeTextForKids()); allItems2.add(cn.getDescription()); allItems2.add(cn.getPromotion()); allItems2.add(cn.getPromotionFreeText()); allItems2.add(cn.getPromotionStartDate() + " - "); allItems2.add(cn.getPromotionEndDate()); allItems2.add(cn.getYoutube()); allItems2.add(cn.getYoutubeLink()); allItems2.add(cn.getPhone()); allItems2.add(cn.getMobilePhone()); allItems2.add(cn.getReview()); allItems2.add(cn.getAddress()); allItems2.add(cn.getLatitude()); allItems2.add(cn.getLongitude()); allItems2.add(cn.getOpenDetail()); allItems2.add(cn.getFacebook()); allItems2.add(cn.getTwitter()); allItems2.add(cn.getInstagram()); allItems2.add(cn.getWebsite()); } CustomAdapterAccommodation adapter = new CustomAdapterAccommodation(Search.this, allItems2); listview.setAdapter(adapter); } I want to use the String from Intent to search the data on DATABASE. This is my DatabaseHandler.java // Getting All search result public List&lt;AllItem&gt; getAllSearchResult() { List&lt;AllItem&gt; allsearchResultList = new ArrayList&lt;AllItem&gt;(); // Select All Query…
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/40119283
type: Comment
comment on: http://stackoverflow.com/a/25671873
type: AnswerComment
has text: Sorry for the confusion. I said "removing" because I want to successively remove the blocks of characters from text. "Hello world." becomes " world" becomes "world" becomes "", and [] becomes ["Hello"] becomes ["Hello", " "] becomes ["Hello", " ", "world."]
score: 0

http://stackoverflow.com/a/25567904
type: Answer
has comment: http://stackoverflow.com/comment/44476332
upvote count: 2
has body: Try reading Passing Longitude and Latitude in Twitter Streaming API of Pakistan again. It clearly says In order to give the box co-ordinates correctly you need to have them in the format bottom-left-longitude, bottom-left-latitude, top-right-longitude, top-right-latitude. That means west, south, east north. You have: double locationsPakistan[][] = {{eastLongitude, southLatitude} ,{westLongitude, northLatitude}}; Try: double locationsPakistan[][] = {{westLongitude, southLatitude} ,{eastLongitude, northLatitude}}; Update As per your comment after your code edits you now have: double northLatitude = 35.2; double southLatitude = 25.2; double eastLongitude = 62.9; double westLongitude = 73.3; double bb[][] = {{eastLongitude, southLatitude},{westLongitude, northLatitude}}; You are mixing up East/West Left/Right. Your comments show this as you have "Eastern/left longitude. Marks the left-side bounds." East is the right side bound. Similarly West is the left side bound. West should be &lt; East. So do this: double northLatitude = 35.2; double southLatitude = 25.2; double westLongitude = 62.9; double eastLongitude = 73.3; double bb[][] = {{westLongitude, southLatitude},{eastLongitude, northLatitude}};
has comment: http://stackoverflow.com/comment/44475773
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25562574
has comment: http://stackoverflow.com/comment/39951879
has comment: http://stackoverflow.com/comment/44475869
has comment: http://stackoverflow.com/comment/39953579
score: 2
accepted answer of: http://stackoverflow.com/q/25562574
downvote count: 0

http://stackoverflow.com/a/25589753
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25589718
score: 1
type: Answer
has body: Looks like rogHelper in DamageTracker.java is null at this line: long id=rogHelper.insertData(armorhealthcheststr, healthcheststr, abvcheststr); You need to initialize it first, preferably at onCreate.
accepted answer of: http://stackoverflow.com/q/25589718
has comment: http://stackoverflow.com/comment/39970952
downvote count: 0

http://stackoverflow.com/q/25595811
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39982689
upvote count: 0
type: UnansweredQuestion
tagged with: double
downvote count: 5
tagged with: swing
tagged with: int
score: -5
has answer: http://stackoverflow.com/a/25596034
tagged with: java
has body: This is my code that I have so far. I need to convert the last if statement into a double public static void main(String[] args) { double skill = 0; double hours = 0; double overTime= 0.5; int insurance =0; String[] choices = {"Medical Insurance", "Dental Insurance", "Long-Term Disability Insurance"}; double MedicalInsuranceCount = 32.50; double DentalInsuranceCount = 20.00; double LongTermDisabilityInsuranceCount = 10.00 if (skill &gt;= 20.00 &amp;&amp; skill &lt;=22.00) insurance = JOptionPane.showOptionDialog( null // Center in window.// prompts the user to select a button , "Types of Insurance options" // Message , "Insurance option" // Title in titlebar , JOptionPane.YES_NO_OPTION // Option type , JOptionPane.PLAIN_MESSAGE // messageType , null // Icon (none) , choices // Button text as above. , "None of your business" // Default button's label ); switch (insurance) { case 0: MedicalInsuranceCount++; break; case 1: DentalInsuranceCount++; break; case 2: LongTermDisabilityInsuranceCount++; break; default: //... If we get here, something is wrong. Defensive programming. JOptionPane.showMessageDialog(null, "Unexpected response " + insurance); } // this is where the problem is I think. if(insurance == 0) insurance = Math.round((float)MedicalInsuranceCount); else if(insurance == 1) insurance = Math.round((float)DentalInsuranceCount); else if(insurance == 2) insurance = Math.round((float)LongTermDisabilityInsuranceCount); System.out.println(insurance); } } ive tried to use Double.PasreDouble but that failed and Math.round(float) is the only thing that works
has title: I need it to convert from an Int to a double
has answer: http://stackoverflow.com/a/25595862
has comment: http://stackoverflow.com/comment/39980997
has comment: http://stackoverflow.com/comment/39981048
favorite count: 0

http://stackoverflow.com/a/25689476
has comment: http://stackoverflow.com/comment/40155286
score: 0
type: AcceptedAnswer
has body: Follow following steps to add java facet to your project In the Project Explorer, right-click the project (newsindexer-1) and then select Properties, or right click on project and check Configure options Select the Project Facets page in the in the Properties window. This page lists the facets in the project and their versions. Check on java facet there Click on apply. see if J appears in your Project listing. (Like you have on you NewsIndexer project)
answers question: http://stackoverflow.com/q/25689107
type: Answer
accepted answer of: http://stackoverflow.com/q/25689107

http://stackoverflow.com/q/25682152
favorite count: 0
linked to: http://stackoverflow.com/q/3875184
has body: I am have a little trouble understanding the AsyncTask and whether or not i can actually do what i am trying to do. Within my onCreate method of my activity I am doing a few things, one of which is to create a GLSurfaceView and set my renderer. I want this process to be done by an AsyncTask in the background. Here is my code public class ActivityTest extends BaseGameActivity { /** Hold a reference to our GLSurfaceView */ private MYGLSurfaceView mGLSurfaceView; public MYGamePlay GamePlay; public GoogleApiClient mGoogleApiClient = null; private AdView adView; private static final String AD_UNIT_ID = "*******************************"; private Button RotateButton; private CreateRenderer mCreateRenderer; private TextView Score; private RelativeLayout layout; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Dialog loader_dialog = new Dialog(this,android.R.style.Theme_Black_NoTitleBar_Fullscreen); loader_dialog.setContentView(R.layout.loading_screen); loader_dialog.show(); // Create an ad. adView = new AdView(this); adView.setAdSize(AdSize.SMART_BANNER); adView.setAdUnitId(AD_UNIT_ID); // create the layout that holds the combined game layout layout = new RelativeLayout(this); layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); // Create an ad request. Check logcat output for the hashed device ID to // get test ads on a physical device. AdRequest adRequest = new AdRequest.Builder() .addTestDevice("***********************").build(); // Start loading the ad in the background. adView.loadAd(adRequest); Score = new TextView(this); Score.setText(" 0"); RelativeLayout.LayoutParams scoreParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); Score.setLayoutParams(scoreParams); Typeface tf = Typeface.createFromAsset(getAssets(),"Fonts/D3Euronism_b.ttf"); Score.setTextSize(getResources().getDimension(R.dimen.textsize)); Score.setTypeface(tf); Score.setTe…
type: AnsweredQuestion
score: 1
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25682284
tagged with: android-activity
tagged with: android-asynctask
type: Question
answer count: 3
has title: using AsyncTask to create a GLSurfaceView in the background
accepted answer: http://stackoverflow.com/a/25682657
linked to: http://stackoverflow.com/q/15489571
possible better answer: http://stackoverflow.com/a/25682284
has answer: http://stackoverflow.com/a/25688022
has answer: http://stackoverflow.com/a/25682657
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25579172
answer count: 1
downvote count: 0
has title: Extracting Nested Catch Blocks in Java Code
has answer: http://stackoverflow.com/a/25579358
has comment: http://stackoverflow.com/comment/39950910
tagged with: parsing
favorite count: 0
type: Question
has body: I want to extract all catch blocks from java code. I am able to extract normal try-catch block, but if catch blocks are nested in some other types of blocks such as "if", my code is to able to detect them. Following is the code I have written using AST parser: public static void methodVisitor(String content) { ASTParser metparse = ASTParser.newParser(AST.JLS3); metparse.setSource(content.toCharArray()); metparse.setKind(ASTParser.K_STATEMENTS); Block block = (Block) metparse.createAST(null); block.accept(new ASTVisitor() { public boolean visit(VariableDeclarationFragment var) { return false; } public boolean visit(SimpleName node) { return false; } public boolean visit(IfStatement myif) { System.out.println("myif=" + myif.toString()); return false; } public boolean visit(TryStatement mytry) { System.out.println("mytry=" + mytry.toString()); List catchClauses = mytry.catchClauses(); CatchClause clause = (CatchClause) catchClauses.get(0); SingleVariableDeclaration exception = clause.getException(); Type type = exception.getType(); System.out.println("catch=" + catchClauses.toString()); return false; } public boolean visit(CatchClause mycatch) { System.out.println("mycatch=" + mycatch.toString()); return false; } }); } This code is not able to extract catch clause in following conditions: if (base != null &amp;&amp; base.getClass().isArray()) { context.setPropertyResolved(base, property); try { int idx = coerce(property); checkBounds(base, idx); } catch (IllegalArgumentException e) { } } Does anyone knows how to extract nested catch blocks. Thanks! in advance!!
score: 2
type: AnsweredQuestion
tagged with: abstract-syntax-tree
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/25579358

http://stackoverflow.com/a/25561354
answers question: http://stackoverflow.com/q/25561307
has comment: http://stackoverflow.com/comment/39917241
downvote count: 0
has comment: http://stackoverflow.com/comment/39917024
has comment: http://stackoverflow.com/comment/39920164
type: Answer
score: 4
upvote count: 4
has body: Best if you could share the error you get in your logcat Intent intent = new Intent(MainActivity.this, Line.class); startActivity(intent); Because your program can crash because of a lot of reasons.

http://stackoverflow.com/comment/39967047
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25588151
has text: Please indent your code. And please only provide the code where you are getting error. I suggest you to please visit [how to ask](http://stackoverflow.com/help/how-to-ask) a question. You can write in better way then. Welcome to StackOverflow.

http://stackoverflow.com/q/25662726
answer count: 2
has answer: http://stackoverflow.com/a/25663629
downvote count: 0
upvote count: 1
tagged with: swing
tagged with: preference
type: AnsweredQuestion
has body: In my program there's requirement to read file content at the time of program startup. Right now file is loaded in the constructor. Since file is a bit huge and I/O is being performed so it takes a bit of time to show screen. My question is, can I use Preference API as an aternative of file I/O? Since content is not changed frequently so I want to avoid I/O unless it's asked by user. I would like to load content once if preference not set and as long as preference is not empty it fetches content from Preference rather than file. Share your thoughts.
possible better answer: http://stackoverflow.com/a/25663111
has title: Can Java Preference API be used as an alternaitve to avoid reading File?
score: 1
has answer: http://stackoverflow.com/a/25663111
tagged with: java
favorite count: 0
has comment: http://stackoverflow.com/comment/40104750
type: Question
accepted answer: http://stackoverflow.com/a/25663629

http://stackoverflow.com/comment/40042839
type: Comment
has text: I removed most of the code that was irrelevant to this issue. I really just need to make database calls from the switch case MotionEvent.ACTION_UP: event. Any ideas on how to do this?
type: QuestionComment
comment on: http://stackoverflow.com/q/25628494
score: 0

http://stackoverflow.com/q/25594197
score: 0
has title: First string from Client get's sent and shown by the Server. After that, the server doesn't get it?
tagged with: sockets
has answer: http://stackoverflow.com/a/25594227
answer count: 1
accepted answer: http://stackoverflow.com/a/25594227
type: Question
tagged with: java
has body: So I decided to try and create a simple chat room type of program. I've got most of the things working, when I send a message, it outputs on the server.. Except I can only send one message, after that nothing happens on the server.? i.e: input on client: "Hello world!" output on server: "Hello world!" I then try to send another message: input on client: "Mr. Server, why u so random?" output on server: null (it doesn't say null it just doesn't do anything at all) What could be the cause of this? Client: public class ClientSocket { final static int PORT = 5921; public static void main(String[] args) throws IOException { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 200); JPanel panel = new JPanel(); final JTextField field = new JTextField(20); JLabel l = new JLabel("Enter a message and see it on the server..."); panel.add(field); panel.add(l); frame.add(panel); frame.setVisible(true); final Socket sock = new Socket("90.231.151.132", PORT); final PrintStream ps = new PrintStream(sock.getOutputStream()); field.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { String txt = field.getText(); ps.println(txt); ps.close(); field.setText(""); } }); } } Server: public class ServerSocketTest { final static int PORT = 5921; public static void main(String[] args) throws Exception { ServerSocketTest t = new ServerSocketTest(); t.run(); } public void run() throws Exception { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 200); JPanel panel = new JPanel(); final JTextArea field = new JTextArea(5, 20); JButton button = new JButton("Close connection"); field.setEditable(false); JLabel l = new JLabel("Messages coming from the client is displayed here.."); panel.add(field); panel.add(l); panel.add(button); frame.add(panel); //frame.add(l); frame.setVisible(true); final ServerSocket servSock = new ServerSocket(PORT); while(true){ Socke…
tagged with: serversocket
type: AnsweredQuestion

http://stackoverflow.com/comment/40068787
type: Comment
has text: but how do i list and provide options to process install steps for example message like "Do you want to install the software yes/no"
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25640444

http://stackoverflow.com/comment/39927803
type: Comment
type: QuestionComment
score: 0
has text: @AndréSchild **freeze** that I mean *.. I can't do anythings or I didn't get any actions , events.*
comment on: http://stackoverflow.com/q/25561820

http://stackoverflow.com/comment/40079339
comment on: http://stackoverflow.com/q/25646113
score: 0
type: Comment
has text: if you have a bigfile > some Megabytes, you can combine Xpath + Dom4j and stream nodes, every parsed node should be detached from dom tree after processing to free the ram.
type: QuestionComment

http://stackoverflow.com/comment/40082427
score: 0
type: Comment
type: AnswerComment
has text: Okay that worked perfectly. Thanks, didn't realize had to do that but makes sense now since if I didn't I'm just adding more numbers into Lottery.
comment on: http://stackoverflow.com/a/25651536

http://stackoverflow.com/a/53802938
has body: Try : java -version , then if you see java 11 try to delete with terminal : cd /Library/Java/JavaVirtualMachines rm -rf openjdk-11.0.1.jdk if it doesn't try delete manually: 1) click on finder 2) go to folder 3) post /Library/Java/JavaVirtualMachines 4) delete java 11 . then try java version and you will see : java version "1.8.0_191"
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25609405

http://stackoverflow.com/comment/40017403
type: AnswerComment
comment on: http://stackoverflow.com/a/25599818
has text: instead of passing the bitmap pass `picturePath` and processed the bitmap in `onPostExecute`.
type: Comment
score: 0

http://stackoverflow.com/comment/40155959
type: Comment
comment on: http://stackoverflow.com/a/25691266
type: AnswerComment
score: 0
has text: Your activity should be created by Android and then you pass a reference to it into your `Server` class.

http://stackoverflow.com/a/25679703
has body: You can't use autowire with resteasy resources directly. You should tell spring that, particular class is going to use autowiring. Docs can be found here. You can do that using following code. @Component @Path("/trn") public class TrnResource extends SpringBeanAutowiringSupport { } You should have following dependencies i you pom.xml, org.springframework spring-core ${spring-framework.version} org.springframework spring-context ${spring-framework.version} org.springframework spring-web ${spring-framework.version} jar compile
answers question: http://stackoverflow.com/q/25677003
downvote count: 0
has comment: http://stackoverflow.com/comment/40133709
type: Answer
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/40133922

http://stackoverflow.com/q/25624625
has title: source code error in mobile backend starter of google app engine---android client
has body: I have followed the steps in mobile backend starter in google app engine, and use the sample "guestbook" provided, but after building all the projects, it shows several errors which seems to me the source code errors as follows: 1.Description Resource Path Location Type case expressions must be constant expressions GuestbookActivity.java /CloudBackendAndroidClient/src/com/google/cloud/backend/sample/guestbook line 146 Java Problem 2.Description Resource Path Location Type case expressions must be constant expressions IntroFirstFragment.java /CloudBackendAndroidClient/src/com/google/cloud/backend/sample/guestbook line 50 Java Problem 3.Description Resource Path Location Type case expressions must be constant expressions IntroSecondFragment.java /CloudBackendAndroidClient/src/com/google/cloud/backend/sample/guestbook line 53 Java Problem 4.Description Resource Path Location Type case expressions must be constant expressions IntroSecondFragment.java /CloudBackendAndroidClient/src/com/google/cloud/backend/sample/guestbook line 56 Java Problem 5.Description Resource Path Location Type case expressions must be constant expressions IntroThirdFragment.java /CloudBackendAndroidClient/src/com/google/cloud/backend/sample/guestbook line 60 Java Problem 6.Description Resource Path Location Type case expressions must be constant expressions IntroThirdFragment.java /CloudBackendAndroidClient/src/com/google/cloud/backend/sample/guestbook line 63 Java Problem 7.Description Resource Path Location Type case expressions must be constant expressions IntroThirdFragment.java /CloudBackendAndroidClient/src/com/google/cloud/backend/sample/guestbook line 66 Java Problem I definitely can't figure out what happends here, I don't know if there is any problem in its source code, so I need experts to help me to this problem. Thanks so much! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ok, the problem is fixed as suggested. But a final probl…
type: Question
tagged with: google-app-engine
tagged with: android
tagged with: java
type: AnsweredQuestion
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25626337
accepted answer: http://stackoverflow.com/a/25626337

http://stackoverflow.com/a/25656206
has comment: http://stackoverflow.com/comment/40091373
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25656189
type: Answer
score: 4
upvote count: 4
has body: Take int num = 1 and place it out side of the loop... int num = 1; while(sc.hasNext()) { System.out.print(num); System.out.print(" "); // Separate the line number from the text System.out.println(sc.nextLine()); num++; } This way it won't be reset every time the loop restarts...
accepted answer of: http://stackoverflow.com/q/25656189

http://stackoverflow.com/q/25700196
downvote count: 2
has comment: http://stackoverflow.com/comment/40170911
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25700475
has answer: http://stackoverflow.com/a/25700375
linked to: http://stackoverflow.com/q/237159
favorite count: 0
has comment: http://stackoverflow.com/comment/40170908
type: Question
has body: I'm working on a sort of test in Java, in which the user is given a question like this: " 4 + ? = 12". The numbers are randomised and so is the questionsmark. I need to make an error message for when the user input isn't an int. For example if the user types in the word "eight" instead of "8" an error message will show up. How can I do this?
has answer: http://stackoverflow.com/a/25700460
type: UnansweredQuestion
has title: Java. How to make an error message for when userInput is a string instead of an int?
tagged with: user-input
has comment: http://stackoverflow.com/comment/40172098
upvote count: 2
score: 0

http://stackoverflow.com/a/25564421
has comment: http://stackoverflow.com/comment/39972806
has comment: http://stackoverflow.com/comment/40053045
has body: You could use Flexjson Deserialize Deserialize
has comment: http://stackoverflow.com/comment/39971760
has comment: http://stackoverflow.com/comment/39969888
score: 0
answers question: http://stackoverflow.com/q/25564116
has comment: http://stackoverflow.com/comment/39970503
has comment: http://stackoverflow.com/comment/39971705
type: Answer

http://stackoverflow.com/q/25620852
has comment: http://stackoverflow.com/comment/40027784
type: Question
has comment: http://stackoverflow.com/comment/40026613
accepted answer: http://stackoverflow.com/a/25621053
has answer: http://stackoverflow.com/a/25621053
tagged with: registry
has title: Java: Find installation path from the registry
type: AnsweredQuestion
has body: Im going to create a launcher for a mod (for C&amp;C Generals: Zero Hour), and i am implementing an updater within the launcher. The problem is, how to find the installation path of that game? just by looking at the registry?
has comment: http://stackoverflow.com/comment/40027512
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/comment/40070847
has text: I'm refering to the part when you recomend pre-processing the file and send it to the java compiler. The 'new' keywords would be converted to the 'old' keywords, but the 'old' keywords would still be 'keywords'. So that wouldn't give the OP exactly that what he wanted.
type: Comment
comment on: http://stackoverflow.com/a/25623751
score: 0
type: AnswerComment

http://stackoverflow.com/q/25671827
type: Question
has title: Parsing string with multiple regex's
has answer: http://stackoverflow.com/a/25671873
possible better answer: http://stackoverflow.com/a/25671873
tagged with: regex
type: AnsweredQuestion
tagged with: token
downvote count: 0
answer count: 3
score: 1
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/25672147
accepted answer: http://stackoverflow.com/a/25672147
tagged with: string
has answer: http://stackoverflow.com/a/25672182
has body: Let's say I have two Java Patterns, one for finding whitespace at the beginning of the line, and the other for finding non-whitespace at the beginning of the line: Pattern ws = Pattern.compile("^\\s+"); Pattern nws = Pattern.compile("^\\S+"); String text = "\tSome \n\t text \n that needs \t parsing."; I want to loop through the text, separating it blocks of whitespace and blocks of non-whitespace, removing each token from the beginning of text: while(text.length() &gt; 0) { String nextToken = ""; try { //TODO: detect grouping and move it to nextToken. } catch (Exception e) { //TODO: error handling } if(nextToken.length() &gt; 0) _tokens.add(nextToken); } I don't just want to replace stuff. "\tSome \n\t text \n that needs \t parsing." should split to ["\t", "Some", "\n\t ", "text", ...] How would you accomplish something like this?
favorite count: 0
tagged with: pattern-matching

http://stackoverflow.com/q/25694669
upvote count: 1
has title: Looking in array method
downvote count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: recursion
has body: I need guidance in understanding recursion. Here is what I have: public class ArrayMember { public static void main(String[] args) { int index = 0; int [] arr = {1, 5, 6, 2}; System.out.println(member(arr, index)); } public static String member(int [] arr, int index) { if(index == arr.length) return str; str = index + "\t" + str + "\n"; return str + member(arr, index+1); } } As you can see, this will never go all the way up to 20 and always prints "No". And I'm pretty sure having a for loop defeats the purpose, but I can't think of any other way to do it. Any help would be appreciated.
tagged with: java
has comment: http://stackoverflow.com/comment/40161371
has comment: http://stackoverflow.com/comment/40161242
has answer: http://stackoverflow.com/a/25694876
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/25694876
answer count: 1
tagged with: arrays

http://stackoverflow.com/comment/40025461
comment on: http://stackoverflow.com/q/25619867
type: Comment
type: QuestionComment
score: 0
has text: check answer i posted

http://stackoverflow.com/a/25662141
answers question: http://stackoverflow.com/q/25661665
score: 2
upvote count: 2
has body: When using synchronized (object) the current Thread will obtain the monitor lock of the provided object (and release it when it exits the block or waits on the object). If the monitor lock is already held by a different thread, then the thread will queue for that lock and wait until it becomes available. In other words using synchronized provides exclusive access with object as mutex. Note that using synchronized also provides certain memory visibility guarantees. When using synchronized (myInstance) you lock on the provided instance. All synchronized blocks using the same instance and the synchronized instance methods of this instance will use the same mutex. When you use synchronized (NetworkManager.class) you lock on the Class instance of NetworkManager. All synchronized blocks using NetworkManager.class (assuming they are all from the same ClassLoader) and static synchronized methods of NetworkManager will use the same mutex. So using synchronized (NetworkManager.class) does not lock on all instances. The only real difference between locking on an instance or on the Class object is that the former includes locking with regard to synchronized methods of the instance, while the latter includes locking with regard to synchronized static methods of the class; in all other ways they work the same: you lock on the provided object. You might also want to read up on the Java Concurrency tutorial.
downvote count: 0
has comment: http://stackoverflow.com/comment/40103656
type: Answer
has comment: http://stackoverflow.com/comment/40102066

http://stackoverflow.com/comment/40180781
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25680343
type: Comment
has text: The problem is that tcp could be too slow for a real time multiplayer game but if there isn't a way to use UDP i'll try websocket, thank you.

http://stackoverflow.com/a/25725037
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25690095
has body: Well, I found the solution, the problem was that the annotation @ComponentScan didn't find the package where the controller was. I resolve the problem indicating to the annotation the package where the controller is. @ComponentScan(basePackages={"com.purposes.controllers"})
type: Answer
answers question: http://stackoverflow.com/q/25690095

http://stackoverflow.com/a/25566708
type: Answer
answers question: http://stackoverflow.com/q/25566232
type: AcceptedAnswer
has body: public static String[] getSubStrings(String string){ List&lt;String&gt; result = new ArrayList&lt;String&gt;(); int i, c, length; length = string.length(); for( c = 0 ; c &lt; length ; c++ ) { for( i = 1 ; i &lt;= length - c ; i++ ) { result.add(string.substring(c, c+i)); } } return result.toArray(new String[result.size()]); }
score: 0
accepted answer of: http://stackoverflow.com/q/25566232

http://stackoverflow.com/comment/40038806
has text: This assignment `z= new int[5];` is not visible from the caller because of the fact that java is pass by value.
score: 0
comment on: http://stackoverflow.com/q/25626247
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39987917
score: 0
has text: So if x is 505 it moves right 5 then left 5, essentially staying still. Is that what you want?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25599616

http://stackoverflow.com/q/25676682
accepted answer: http://stackoverflow.com/a/25676693
has answer: http://stackoverflow.com/a/25680345
linked to: http://stackoverflow.com/q/5915156
has comment: http://stackoverflow.com/comment/40127935
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40127988
answer count: 3
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40132824
tagged with: java
possible better answer: http://stackoverflow.com/a/25680345
linked to: http://stackoverflow.com/q/25489720
has title: Is this appropriate use of Thread.interrupt()?
has comment: http://stackoverflow.com/comment/40127978
linked to: http://stackoverflow.com/q/4264355
has answer: http://stackoverflow.com/a/25676861
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40127908
has comment: http://stackoverflow.com/comment/40127950
has body: I want a piece of code to run as long as the thread isn't interrupted. Currently what I'm doing is this: while(!Thread.interrupted()){ // .. some code try { Thread.sleep(4000); } catch(InterruptedException ex){ break; } // .. some more code } My question is: is this good practice? Is it appropriate use of interrupt?
tagged with: multithreading
has answer: http://stackoverflow.com/a/25676693

http://stackoverflow.com/comment/40175022
type: AnswerComment
comment on: http://stackoverflow.com/a/25698707
score: 0
type: Comment
has text: Learn to hand code before trying to use design editors. See [the official tutorial](http://docs.oracle.com/javase/tutorial/uiswing/).

http://stackoverflow.com/a/25678329
score: 1
type: AcceptedAnswer
has body: You need a slight modification to store the high value: double highestNum = 0.0; // 0 set to the default lowest value String highestKey = ""; // used to save the key assosciated w/ highest value for (String key : quantityHash.keySet()) { double value = quantityHash.get(key); // ADDED LINE if (value &gt; highestNum) { // MODIFIED LINE highestKey = key; highestNum = value; // ADDED LINE } } This will loop through and look at all the values. Your code will loop through too, but you'll only have the key for the highest value; you didn't update highestNum, so it remains at 0.0.
type: Answer
accepted answer of: http://stackoverflow.com/q/25678284
has comment: http://stackoverflow.com/comment/40130889
answers question: http://stackoverflow.com/q/25678284
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/46019209
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25573350
type: QuestionComment
has text: This old so I won't try to diagnose this, but as the author of the PureJavaComm I suggest asking for help in the github at https://github.com/nyholku/purejavacomm is more likely to provide useful help…

http://stackoverflow.com/comment/40703190
has text: Why doesn't the section "5.5. Explaining the score: using score calculation outside the Solver" suffice?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25665813
score: 0

http://stackoverflow.com/q/25625630
possible better answer: http://stackoverflow.com/a/25625686
favorite count: 0
has answer: http://stackoverflow.com/a/25625686
has title: Enhanced for loop empty check optimization
tagged with: for-loop
type: Question
score: 4
upvote count: 4
has body: I know with java one shouldn't bother with things like this but I just can't resist, which is the faster?: ArrayList &lt;Integer&gt; keke = new ArrayList(); ArrayList &lt;Integer&gt; kuku = new ArrayList(); if(!keke.isEmpty()){ for(Integer num : keke){ System.out.println(num); } } //or just: for(Integer num : kuku){ System.out.println(num); } The enhanced for loop does an empty check before it starts to do anything right? So using an enclosing if(empty) is totally useless?
accepted answer: http://stackoverflow.com/a/25625690
type: AnsweredQuestion
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/25625690
downvote count: 0
has comment: http://stackoverflow.com/comment/40035441

http://stackoverflow.com/a/25593739
has comment: http://stackoverflow.com/comment/39977250
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39977345
upvote count: 1
answers question: http://stackoverflow.com/q/25593719
accepted answer of: http://stackoverflow.com/q/25593719
score: 1
type: Answer
has body: Don't use a GridLayout since this forces every cell to be the same size. So if one cell is very large, it will make all the cells very large. Instead use other layouts or combinations of layouts to make a better more pleasing GUI. Don't forget to put your JTextArea into a JScrollPane. For example, a BoxLayout could work, but if you do this, you must recognize that you're actually setting the layout of the contentPane and not the JFrame: //!! setLayout(new GridLayout(5, 1, 0, 0)); // Set BorderLayout setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS)); // Note getContentPane() Edit You ask: Setting it as BoxLayout really fixed the issue however, I am trying to undestand the logic used by getContentPane(), and then the PAGE_AXIS? BoxLayout is unlike GridLayout, FlowLayout, and BorderLayout in that when you call the constructor, you have to pass in a reference to the component that you're adding the layout to. It looks like you're adding it to the JFrame since the class extends JFrame, and you're calling setLayout(...) on the JFrame itself, but if you pass in this, meaning the current JFrame instance, you'll get a runtime exception, because the setLayout(...) method of the JFrame in fact sets the layout of the JFrame's contentPane. So to fix this, you need to pass in the JFrame's contentPane. For more on that, please read the tutorial on JFrames. For the second part of your question, on why the second parameter to the BoxLayout constructor, BoxLayout.PAGE_AXIS, it's for orienting your layout either horizontally or vertically. For more please read the BoxLayout tutorial and API. This reference will get you to the pertinent Swing tutorials: Swing Info

c++
tags question: http://stackoverflow.com/q/25587578
tags question: http://stackoverflow.com/q/25627370
tags question: http://stackoverflow.com/q/25667778
tags question: http://stackoverflow.com/q/25618315
tags question: http://stackoverflow.com/q/25669518
tags question: http://stackoverflow.com/q/25588310
tags question: http://stackoverflow.com/q/25697506
tags question: http://stackoverflow.com/q/25558200
tags question: http://stackoverflow.com/q/25689186
tags question: http://stackoverflow.com/q/25620286
tags question: http://stackoverflow.com/q/25655597
tags question: http://stackoverflow.com/q/25595019
tags question: http://stackoverflow.com/q/25707202
tags question: http://stackoverflow.com/q/25689994
type: Tag
tags question: http://stackoverflow.com/q/25551719
tags question: http://stackoverflow.com/q/25563706
tags question: http://stackoverflow.com/q/25576966
tags question: http://stackoverflow.com/q/25679546
tags question: http://stackoverflow.com/q/25622002
tags question: http://stackoverflow.com/q/25683514
tag name: c++
tags question: http://stackoverflow.com/q/25711799
tags question: http://stackoverflow.com/q/25702722

http://stackoverflow.com/comment/40019217
comment on: http://stackoverflow.com/a/25616139
type: Comment
has text: Good! +1 for correct answer and for mentioning to not use the `public` keyword for interface members.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39988776
has text: @k9yosh: don't set all your variables public. Declare them as private and add mutators (setters and getters) to your classes.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25599989

http://stackoverflow.com/a/25699732
accepted answer of: http://stackoverflow.com/q/25694832
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/25694832
has body: You have to use JsonAnySetter annotation and your ZooAnimals class should look like this: @XmlAccessorType(XmlAccessType.FIELD) @JsonInclude(JsonInclude.Include.NON_DEFAULT) @JsonTypeName("ZooAnimals") class ZooAnimals { @XmlAttribute @JsonProperty("@size") private String size; @XmlElement(name = "Animal", required = false) private List&lt;Animal&gt; animalList; @JsonAnySetter public void setAny(String propertyName, Map&lt;String, Animal&gt; map) { animalList = new ArrayList&lt;Animal&gt;(map.values()); } // getters, setters, toString } You do not have to change Animal class at all. Below program: ObjectMapper mapper = new ObjectMapper(); mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); ZooAnimals zooAnimals = mapper.readValue(XML, ZooAnimals.class); System.out.println(zooAnimals); prints: ZooAnimals{size='2', animalList=[Animal{name='elephant', size='huge'}, Animal{name='termite', size='verysmall'}]}
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40222867
type: Answer

http://stackoverflow.com/q/25679354
downvote count: 1
score: -1
tagged with: android-activity
has comment: http://stackoverflow.com/comment/40134830
favorite count: 0
has body: I'm a beginner and new in android .I searched but not found any way to resolve my problem across the similar my problem... I have below Error when click the button that created in main_activity to show details in detail_activity... . can help me anybody? what i do wrong ? this is full error: 09-05 16:07:16.420: D/AndroidRuntime(1238): Shutting down VM 09-05 16:07:16.431: E/AndroidRuntime(1238): FATAL EXCEPTION: main 09-05 16:07:16.431: E/AndroidRuntime(1238): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.workwithdata/com.example.workwithdata.DetailsActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class textView 09-05 16:07:16.431: E/AndroidRuntime(1238): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306) 09-05 16:07:16.431: E/AndroidRuntime(1238): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358) 09-05 16:07:16.431: E/AndroidRuntime(1238): at android.app.ActivityThread.access$600(ActivityThread.java:156) 09-05 16:07:16.431: E/AndroidRuntime(1238): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340) 09-05 16:07:16.431: E/AndroidRuntime(1238): at android.os.Handler.dispatchMessage(Handler.java:99) 09-05 16:07:16.431: E/AndroidRuntime(1238): at android.os.Looper.loop(Looper.java:153) 09-05 16:07:16.431: E/AndroidRuntime(1238): at android.app.ActivityThread.main(ActivityThread.java:5299) 09-05 16:07:16.431: E/AndroidRuntime(1238): at java.lang.reflect.Method.invokeNative(Native Method) 09-05 16:07:16.431: E/AndroidRuntime(1238): at java.lang.reflect.Method.invoke(Method.java:511) 09-05 16:07:16.431: E/AndroidRuntime(1238): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 09-05 16:07:16.431: E/AndroidRuntime(1238): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 09-05 16:07:16.431: E/AndroidRuntime(1238): at dalvik.system.NativeStart.main(Native Method) 09-05 16:07:16.431: E/AndroidR…
tagged with: http://stackoverflow.com/tag/xml
type: Question
upvote count: 0
answer count: 2
has title: android.view.InflateException: Binary XML file line #9: Error inflating class textView
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40134062
has answer: http://stackoverflow.com/a/69351756
has comment: http://stackoverflow.com/comment/40132951
has answer: http://stackoverflow.com/a/25727884
tagged with: java

http://stackoverflow.com/comment/39933177
comment on: http://stackoverflow.com/a/25567647
score: 0
has text: Thanks a lot guys. I didn't realize that "value" is the node representation which i can cast back to my own class.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25581445
has comment: http://stackoverflow.com/comment/65291183
has title: Distance/proximity matrix in hierachical clustering
tagged with: machine-learning
has body: I'm new to Weka and I am trying to do hierachical clustering. I have a symmetric distance/proximity matrix like this: a b c d a 0 0.1 0.3 0.2 b 0.1 0 0.7 0.4 c 0.3 0.7 0 0.9 d 0.2 0.4 0.9 0 I want to do hierarchical agglomerative clustering with these instances(a,b,c,d,..). I installed Weka3.6.11 but I couldn't find any part for passing this distance/proximity matrix in cluster Tab. can anyone help me? Is there any easy way in other environments for this purpose? Thanks in advance.
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/65313578
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/65136125
tagged with: java
tagged with: hierarchical-clustering
has comment: http://stackoverflow.com/comment/65273197
has comment: http://stackoverflow.com/comment/65233887
upvote count: 2
score: 2
tagged with: weka
downvote count: 0
has answer: http://stackoverflow.com/a/25584497
answer count: 1

http://stackoverflow.com/q/25689162
possible better answer: http://stackoverflow.com/a/25708656
score: 3
upvote count: 3
tagged with: java
tagged with: user-interface
downvote count: 0
tagged with: mysql
accepted answer: http://stackoverflow.com/a/25689574
favorite count: 0
type: Question
has title: Creating empty objects in db or saving them later
has answer: http://stackoverflow.com/a/25708656
tagged with: database
tagged with: spring
has body: I have the following table in my db: CREATE TABLE document ( id INT PRIMARY KEY AUTOINCREMENT, productModelId INT NOT NULL, comment VARCHAR(50), CONSTRAINT FK_product_model FOREIGN KEY (productModelId) REFERENCES product_model(id), ) Of course, real table is much more complicated, but this is enough to understand the problem. Our users want to see the number of the document when they click button "new". So, in order to do that, we have to create object in db and send to client that object. But, there is a problem. We need to know productModelId before we save the object in db. Otherwise we will have an sql exception. I see two possible variants (both are ugly, really): To show modal list with product models to user and after that create object in database with productModelId chosen by user. To create a temporary number and after that to save the object in db when user finishes editing the document and saves id. We also need to remove NOT NULL case and validate this somwhere in code. The first way is bad because we have too much modals in our application. Our UI is too heavy with them. The second variant is ugly because our database is not consistent without all the checks. What can you suggest we do? Any new solutions? What do you do in your apps? May be some UI tips. We are using the first variant at the moment.
has answer: http://stackoverflow.com/a/25689574
type: AnsweredQuestion
answer count: 2

http://stackoverflow.com/comment/39980563
comment on: http://stackoverflow.com/a/25595401
type: AnswerComment
score: 0
has text: FYI,..I have generated the xml files containing testsuite results and this xml file is used to generate unit test percentage in sonar.But the coverage is not coming?how to do this?
type: Comment

http://stackoverflow.com/q/25661386
score: 3
upvote count: 3
downvote count: 0
tagged with: environment-variables
tagged with: java
answer count: 1
tagged with: hudson
has body: Is there any possibility to get a map of environment variables that are used in Jenkins? I am trying to develop my own plugin and need to access the variable BUILD_USER_ID, which is provided by the build user vars plugin. There is a class called EnvVars, which inherits from TreeMap, but it is obviously empty, if you create an object of this. EnvVars env = new EnvVars(); Where are these variables stored , so that I can get them and use them in my plugin?
tagged with: jenkins-plugins
has title: Jenkins plugin development - environment variables
type: Question
tagged with: jenkins
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27611703
favorite count: 0

http://stackoverflow.com/comment/40174934
has text: There are no exceptions to catch inside your try-block---except some unchecked exceptions like `NullPointerException`. There is no point in catching those; rather, you have to fix your code.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25702351

http://stackoverflow.com/comment/65926868
has text: In my case I needed a single jar to execute from linux cron, no several jars , folders, etc. Your snippet works for me. Thank you!
type: Comment
comment on: http://stackoverflow.com/a/25601601
score: 0
type: AnswerComment

http://stackoverflow.com/a/25602519
has comment: http://stackoverflow.com/comment/108454991
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25602382
score: 148
has body: HashSet is Implemented using a hash table. Elements are not ordered. The add, remove, and contains methods have constant time complexity O(1). TreeSet is implemented using a tree structure(red-black tree in algorithm book). The elements in a set are sorted, but the add, remove, and contains methods has time complexity O(log (n)). It offers several methods to deal with the ordered set like first(), last(), headSet(), tailSet(), etc. 1) First major difference between HashSet and TreeSet is performance. HashSet is faster than TreeSet and should be preferred choice if sorting of element is not required. 2) Second difference between HashSet and TreeSet is that HashSet allows null object but TreeSet doesn't allow null Object and throw NullPointerException, Why, because TreeSet uses compareTo() method to compare keys and compareTo() will throw java.lang.NullPointerException. 3) Another significant difference between HashSet and TreeSet is that , HashSet is backed by HashMap while TreeSet is backed by NavigableMap in Java. 4) One more difference between HashSet and TreeSet which is worth remembering is that HashSet uses equals() method to compare two object in Set and for detecting duplicates while TreeSet uses compareTo() method for same purpose. if equals() and compareTo() are not consistent, i.e. for two equal object equals should return true while compareTo() should return zero, than it will break contract of Set interface and will allow duplicates in Set implementations like TreeSet 5) Now most important difference between HashSet and TreeSet is ordering. HashSet doesn't guaranteed any order while TreeSet maintains objects in Sorted order defined by either Comparable or Comparator method in Java. 6) TreeSet does not allow to insert Heterogeneous objects. It will throw classCastException at Runtime if trying to add hetrogeneous objects, whereas HashSet allows hetrogeneous objects.
has comment: http://stackoverflow.com/comment/108380217
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/96771195
has comment: http://stackoverflow.com/comment/101182149
answers question: http://stackoverflow.com/q/25602382
upvote count: 148

http://stackoverflow.com/comment/40134997
comment on: http://stackoverflow.com/a/25680352
has text: I think this ways is more convenient. It shows where's error and class causes exception!
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25712136
accepted answer: http://stackoverflow.com/a/25712264
type: AnsweredQuestion
score: 0
tagged with: android
tagged with: java
answer count: 1
has body: I have a list view where each row displays the name of some inventory item, its quantity available, and a spinner to select the amount of the item to buy (when clicking make purchase at the bottom of the page, the selected amount of each spinner is grabbed and processed). I currently have a loop that iterates over the rows and grabs the spinner by its identifier. It uses the position of the row to access another array that contains the corresponding qty of the item show in this position. It uses this qty as a stopping point for another nested loop that creates an ArrayList of numbers up to the given qty (so a user cannot select more than what is available). The ArrayList is then popped into a custom ArrayAdapter as the data field but for some reason the ArrayAdapter is not populating the spinner. What's missing?? Heres the relevant code public class PlaceOrder extends Activity { ArrayList&lt;Item&gt; items; ArrayList&lt;Customer&gt; customers; int position; ListView orderList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_place_order); Intent data = getIntent(); items = data.getParcelableArrayListExtra("items"); customers = data.getParcelableArrayListExtra("customers"); position = data.getIntExtra("position", 0); orderList = (ListView) findViewById(R.id.purchaseList); PurchasedItemAdapter itemAdapter = new PurchasedItemAdapter(this, R.layout.purchase_table_row, items); orderList.setAdapter(itemAdapter); for (int i = 0; i &lt; orderList.getCount(); i++) { View view = orderList.getAdapter().getView(i, null, null); Spinner spinner = (Spinner) view.findViewById(R.id.purchase_table_spinner); int stop = items.get(i).qtyAvailable; ArrayList&lt;String&gt; stringList = new ArrayList&lt;String&gt;(); for (int k = 0; k &lt;= stop; k++) { stringList.add(String.format("%d", k)); } SpinnerAdapter spinnerAdapter = new SpinnerAdapter(this, R.layout.simple_spinner_item, stringList); spinner.setAdap…
has comment: http://stackoverflow.com/comment/40192999
tagged with: listview
type: Question
has title: populating Spinner nested in ListView Rows (Android)
has answer: http://stackoverflow.com/a/25712264

http://stackoverflow.com/q/25559771
has answer: http://stackoverflow.com/a/25559817
score: 1
tagged with: java
has title: Find two groups in array that have an exact portion
downvote count: 0
answer count: 1
tagged with: derivative
upvote count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: arrays
has comment: http://stackoverflow.com/comment/39936098
has body: I need help to find 2 groups in array that have an exact portion. e.g. arr = {8, 1, 4, 9, 3} and difference = 1, the groups will be {8, 1, 3} (12) and {4, 9} (13) and finally, print the groups without print another options that the code tried before, like: 8, 1, 3 9, 4 I don't know how to solve it, because each number in a group can be placed in different place, I tried to do it recursively but it didn't work. A java code will be helpful!
tagged with: recursion

openal
type: Tag
tag name: openal
tags question: http://stackoverflow.com/q/25700075

http://stackoverflow.com/comment/40090404
type: Comment
comment on: http://stackoverflow.com/a/25655638
type: AnswerComment
score: 1
has text: I have missed far more obvious mistakes :) Make the debugger work for you, practice stepping through code and checking values - it will be very, very helpful. On a line of code, ask yourself "what do I expect this value to be? What do I expect to happen next?". If you're wrong, take the time to figure it out.

http://stackoverflow.com/q/25671855
score: 2
upvote count: 2
downvote count: 0
type: UnansweredQuestion
tagged with: dictionary
has answer: http://stackoverflow.com/a/25672080
answer count: 1
tagged with: arraylist
type: Question
tagged with: java
has title: Error: The method convertProspectIds(Map<String,String>) in the type CompassADFAdaptor is not applicable for the arguments (List<String>)
has body: First, my apologies as I am a brand new Java developer and have been tasked to work on a massive application, so I am very out of my league. I currently have this code. Basically, it looks for some values on the URL of a web application, and then passes the name of the URL variable and the value of the URL variable into the application, where it will then be added to an output stream of text. So the variables would look like "&LeadID=123" which would translate to the "LeadId" and "123". At that point, we reformat it into an XML value, such as 123 This is the code that is responsible for checking for the variables, and then putting them into a Map, and then (in theory) passing them to the code which will format them: List<Map<String, String>> list = new ArrayList<Map<String, String>>(); Map<String, String> ProspectTrackingKeys = new HashMap<String, String>(); if (recipSettings.containsKey("leadId")) { ProspectTrackingKeys.put("LeadId", recipSettings.get("leadId")); } if (recipSettings.containsKey("wtk")) { ProspectTrackingKeys.put("wtk", recipSettings.get("wtk")); } if (recipSettings.containsKey("efd")) { ProspectTrackingKeys.put("efd", recipSettings.get("efd")); } if (recipSettings.containsKey("aid")) { ProspectTrackingKeys.put("aid", recipSettings.get("aid")); } if (recipSettings.containsKey("oth")) { ProspectTrackingKeys.put("oth", recipSettings.get("oth")); } list.add(ProspectTrackingKeys); prospect.setProspect(adaptor.convertProspectIds((Map<String, String>) prospectIds)); However, the last line of code (above) is generating these errors: The method setProspect(ArrayList) is undefined for the type Prospect The method convertProspectIds(Map) in the type CompassADFAdaptor is not applicable for the arguments (List) This is in reference to this code, which is where the values should be passed into, and then formatted as the XML text: public ArrayList<ProspectId> convertProspectIds( Map<String, String> recipientSettings) { ArrayList<ProspectId> prospectIdList = new A…
favorite count: 0

http://stackoverflow.com/a/25552962
has comment: http://stackoverflow.com/comment/39903307
has body: Try this it works fine Edit org.mortbay.jetty maven-jetty-plugin 6.1.8 /app First thing http:localhost:8080/app is wrong it should be http://localhost:8080/app if you give this url then you must have a landing page that you can specify in web.xml Like this index.jsp So simply try to access the url http://localhost:8080/app/index.jsp where there must be some index.jsp under the web-content folder
has comment: http://stackoverflow.com/comment/39903181
type: Answer
answers question: http://stackoverflow.com/q/25552692
has comment: http://stackoverflow.com/comment/39902902
has comment: http://stackoverflow.com/comment/39903550
accepted answer of: http://stackoverflow.com/q/25552692
upvote count: 4
has comment: http://stackoverflow.com/comment/39903000
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39937631
downvote count: 0
has comment: http://stackoverflow.com/comment/39903343
score: 4
has comment: http://stackoverflow.com/comment/39903065
has comment: http://stackoverflow.com/comment/39938033
has comment: http://stackoverflow.com/comment/39902237

http://stackoverflow.com/comment/39960915
comment on: http://stackoverflow.com/a/25584539
type: AnswerComment
has text: use this String Text = spinner.getSelectedItem().toString();
score: 0
type: Comment

http://stackoverflow.com/a/25566248
upvote count: 6
has body: If the date is in past then alarm will trigger immediately. However you may try to use setInexactRepeating instead of setRepeating: alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, startDate, setInexactRepeating , alarmIntent); From the setInexactRepeating() docs: Schedule a repeating alarm that has inexact trigger time requirements; for example, an alarm that repeats every hour, but not necessarily at the top of every hour.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25566173
score: 6
answers question: http://stackoverflow.com/q/25566173
type: Answer

http://stackoverflow.com/q/25573927
has answer: http://stackoverflow.com/a/25574016
has title: how to refer a jar(this jar is part of other war file) file in .war manifest.mf file
tagged with: weblogic
score: 1
tagged with: java
favorite count: 0
has body: I have a war file, this war contains multiple jar files. Now my requirement is I have another war file which has dependency on jar files of first war. So Could any one help me how to refer the first war's jar files in MANIFEST file of the second war.
type: Question
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25574473
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/40029430
comment on: http://stackoverflow.com/q/25622344
type: Comment
type: QuestionComment
score: 2
has text: Show us what have you tried

http://stackoverflow.com/a/25661055
has body: There is a definition of Jenkins URL in Jenkins management, what is the value there? with port 80?
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25660937
has comment: http://stackoverflow.com/comment/40099792
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25660937

http://stackoverflow.com/comment/44536134
comment on: http://stackoverflow.com/a/25587452
has text: I'm using android.util.Base64
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40144359
has text: `pubDateFormat = pubDate.substring(0, 23);` should be `pubDateFormat = pubDate.substring(0, 22);` (the string is only 22 characters long), but I couldn't make my ideone.com example fail by adding an extra character at the end, so...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25685926
score: 0

http://stackoverflow.com/a/25668733
score: 0
has body: Use the parametric equation of the line: P = (1-t).A + t.B (P, A, and B are points, defined by pairs of coordinates). If you set t=0, you get A; if you set t=1, you get B; if you set other values, you get points along the line AB. Now the distance issue: you want P to be at distance d of A. Then d² = AP² = t²AB², or t = d/AB. Programmatically: ABx= Bx - Ax; ABy= By - Ay; AB= Sqrt(ABx * ABx + ABy * ABy); t= d / AB; Xc= Xa + t * ABx; Yc= Ya + t * ABy;
type: Answer
answers question: http://stackoverflow.com/q/25666067

http://stackoverflow.com/a/25683702
score: 11
has comment: http://stackoverflow.com/comment/43283794
upvote count: 11
has comment: http://stackoverflow.com/comment/77194151
downvote count: 0
has body: Try this: Exclude spring-boot-starter-logging e.g. org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-logging Add dependencies for your logging interface e.g. slf4j org.apache.logging.log4j log4j-slf4j-impl 2.0.2 Add other logging implementations pointing to chosen logging interface e.g. org.slf4j jcl-over-slf4j org.slf4j jul-to-slf4j org.slf4j log4j-over-slf4j Add your target logging implementation e.g. org.apache.logging.log4j log4j-api 2.0.2 org.apache.logging.log4j log4j-core 2.0.2 And it should work.
type: Answer
answers question: http://stackoverflow.com/q/25683210

http://stackoverflow.com/comment/40094388
type: Comment
comment on: http://stackoverflow.com/q/25657880
type: QuestionComment
score: 0
has text: New System is storing Alphanumeric ids length 18

http://stackoverflow.com/comment/40143781
has text: Edited my answer and added listcomposite declaration
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25685522

http://stackoverflow.com/comment/39999554
type: Comment
has text: That doesn't solve his problem of putting this value as a key in a HashMap. Try coming up with an implementation of `hashCode` that incorporates an epsilon and I'll upvote.
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25605948

http://stackoverflow.com/comment/40140842
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25683942
type: Comment
has text: HelpFul For u http://droidwalk.blogspot.in/2012/11/android-calendar-sample.html

http://stackoverflow.com/comment/40039094
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25627377
has text: Went with the 2nd option, removed both after the for loop.

http://stackoverflow.com/q/25565193
accepted answer: http://stackoverflow.com/a/25569873
score: 2
upvote count: 2
type: AnsweredQuestion
downvote count: 0
has body: I need to identify a String if the character on it includes only numbers, with alphabet (a custom string, name, code, or whatever) or its a GAE Key. Here is my code: try { Class clazz = Class.forName(typeName); Object one = null; if(key.matches("[0-9]+")){ // Long one = store.get(clazz, Long.valueOf(key)); } else if(key.matches("^[0-9A-Za-z._-]{1,500}$")) { // GAE datastore key one = store.get(clazz, KeyFactory.stringToKey(key)); } else { one = store.get(clazz, String.valueOf(key)); } jsonString =new Gson().toJson(one); } catch (Exception e){ setStatus(Status.SERVER_ERROR_INTERNAL); e.printStackTrace(); } The problem here is that the second statement in the if-else catches even String "aaa" I need to have some way of differentiating a GAE datastore key from a regular strings that is not really a GAE key format.
has comment: http://stackoverflow.com/comment/39924121
answer count: 1
has comment: http://stackoverflow.com/comment/39932874
favorite count: 0
has answer: http://stackoverflow.com/a/25569873
type: Question
linked to: http://stackoverflow.com/q/475074
has comment: http://stackoverflow.com/comment/39980553
has comment: http://stackoverflow.com/comment/39924619
tagged with: google-app-engine
has title: Regex to differentiate String keys
tagged with: java
tagged with: regex
linked to: http://stackoverflow.com/q/15864116

http://stackoverflow.com/comment/40218774
has text: I'm guessing you are using pretty complex transforms to implement that, this is pretty new functionality in the pipelines of both iOS and Android so we might have minor incompatibilities there. My best suggestion is trial and error, try to isolate elements to see what works/fails.
comment on: http://stackoverflow.com/a/25712350
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40111335
comment on: http://stackoverflow.com/a/25664978
score: 0
type: AnswerComment
has text: Reflection works, and quite a lot of frameworks use it behind the scenes, especially XML to aid in de/serialization. JNI for example uses the same plugs as the Reflection API; but I agree, Reflection is ugly/crap.
type: Comment

http://stackoverflow.com/a/25586650
has body: Idiomatic Java: interface ShiftByNStrategy { int shift(int num, int n); } final class ShiftByNOnce extends ShiftingStrategy { @Override public int shift(int num, int n) { return num &lt;&lt; n; } } final class RepeatedShiftByNStrategy implements ShiftByNStrategy { private final ShiftByNStrategy strategy; private final int times; RepeatedShiftByNStrategy(ShiftByNStrategy strategy, int times) { this.strategy = strategy; this.times = times; } @Override public int shift(int num, int n) { for (int i = 0; i &lt; times; i++) num = strategy.shift(n); return num; } } final class ShiftByNStrategyFactory { private ShiftByNStrategyFactory() {} static ShiftByNStrategy shiftByNMultipleTimes(int times) { return new RepeatedShiftByNStrategy(new ShiftByNOnce(), times); } } So then you have public int shift4N(int num, int n) { return ShiftByNStrategyFactory.shiftByNMultipleTimes(4).shift(num, n); } ;)
type: Answer
answers question: http://stackoverflow.com/q/25586519
score: 0

http://stackoverflow.com/a/25626437
score: 0
has body: Here is an example for doing the loop. public class Scan { public static void main(String[] args) { ArrayList&lt;String&gt; arrayList = new ArrayList&lt;String&gt;(); Scanner sc = new Scanner(System.in); boolean testContinue = true; while (testContinue) { System.out.println("Input a string :"); String str = sc.next(); if (str.equals("quit")) testContinue = false; else { /* * add to arrayList */ arrayList.add(str); testContinue = sc.hasNextLine(); } } /* * Display arrayList */ for(int i = 0; i&lt;arrayList.size(); i++) { System.out.println(arrayList.get(i)); } } }
type: Answer
answers question: http://stackoverflow.com/q/25625669

http://stackoverflow.com/comment/39911718
type: Comment
type: AnswerComment
has text: well...problem solved...made everything instance and [extended](https://stackoverflow.com/questions/5854171/how-to-call-method-of-another-class-in-android) my class with a different class to get that method.
score: 0
comment on: http://stackoverflow.com/a/25555193

http://stackoverflow.com/comment/39991033
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25600383
has text: @MadProgrammer Yes, that sounds like a reasonable general rule of thumb.

http://stackoverflow.com/a/25658340
answers question: http://stackoverflow.com/q/25658301
has body: You can use ThreadLocal variables.
type: Answer
has comment: http://stackoverflow.com/comment/40095552
has comment: http://stackoverflow.com/comment/40131663
score: 0

http://stackoverflow.com/a/25671891
score: 0
upvote count: 1
downvote count: 1
has body: Save the image locally (ex. c:\my_image.jpg), which is not in the .jar file Use Runtime.getRuntime().exec("cmd your_command_here_to_open_image"); here is a link for cmd command on windows: http://www.sevenforums.com/software/180378-where-windows-photo-viewer-default-location.html
has comment: http://stackoverflow.com/comment/40119142
type: Answer
answers question: http://stackoverflow.com/q/25669874

http://stackoverflow.com/a/25650470
type: Answer
answers question: http://stackoverflow.com/q/25647786
has body: Follow Tim's advice and print the ports, running: ls /dev/tty.* in Terminal. This should allow you to double check if "/dev/tty.usbserial-AM01VBFC" is actually the correct name. If nothing prefixed by tty.usbserial while your device is connected try this: Install the FTDI VCP driver Only if 1 doesn't work and you're using Mavericks try to unload Apple's FTDI driver: sudo kextunload -b com.apple.driver.AppleUSBFTDI (note that this need to be done once per OSX boot)
score: 0

http://stackoverflow.com/comment/40027559
has text: Let me check this thing.
type: Comment
comment on: http://stackoverflow.com/a/25620973
type: AnswerComment
score: 0

http://stackoverflow.com/q/25587603
tagged with: eclipse
has comment: http://stackoverflow.com/comment/49926918
score: 7
tagged with: java
answer count: 1
downvote count: 0
tagged with: selenium
upvote count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/61184700
type: Question
linked to: http://stackoverflow.com/q/7737710
type: UnansweredQuestion
tagged with: maven
has title: Maven error "Archetype catalog is empty" while creating Maven project for WebDriver with TestNG
has body: I couldn't able to add maven artifact "ru.stqa.selenium" in eclipse. I downloaded the catalog file from : "https://github.com/barancev/webdriver-testng-archetype" Steps I followed is Eclipse-> Window-> Preference -> Maven-> ArchTypes-> Add Local Catalog. On Local Archtype catalog popup I have put Catalog file location: Address of pom file from local as "D:\Software\Selenium\webdriver-testng-archetype-master\src\main\resources\archetype-resources". Description : Some name Now I am getting this warning message " Archetype catalog is empty". If I go with Add Remote catalog with remote location as "http://repo1.maven.org/maven2/archetype-catalog.xml" , it works fine. Curious to know the reason for this strange behavior.

http://stackoverflow.com/comment/40124107
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25674283
type: Comment
has text: should I use tomcat:run or another goals ?

http://stackoverflow.com/comment/40025265
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25619988
has text: I think that I don't start the Virtuoso Server. How I can do it?

http://stackoverflow.com/a/25556347
answers question: http://stackoverflow.com/q/25556309
downvote count: 0
score: 1
upvote count: 1
has body: You are using forward slash characters to escape the ( and ) special characters. You need to use backslashes: String output = input.replaceAll("\\(.*?\\)", "");
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25556309

http://stackoverflow.com/q/25692520
has comment: http://stackoverflow.com/comment/40157151
has body: Basically, the program given to me is to add the sum of the array's rows and columns and give it back into the same array if m = 3 , n = 4 Eg: 3 4 5 6 18 1 2 3 4 10 4 3 3 2 12 8 9 11 12 (The last 12 is the sum of 6 + 4 +2) So, this is the code for it void summatrix() { for(int i=0;i&lt;m-1;i++) // m - 1 because total array size is m but values only placed till m-1 { int sum = 0; for(int j=0;j&lt;n-1;j++) { sum += mat[i][j]; mat[i][n] = sum; // Pretty sure the problem is here } System.out.println("Sum of "+ i + " " + (n) + " is "+ sum); } for(int j=0;j&lt;n-1;j++) // n-1 beacuse total array size is n, values only placed till n-1 { int sum=0; for(int i=0;i&lt;m-1;i++) { sum+=mat[i][j]; mat[m][j] = sum; // Pretty sure the problem is here } System.out.println("Sum of "+ (m) + " " + j + " is "+ sum); } show_mat(); // prints the array Input and output : The matrix is : 1 2 3 0 1 2 3 0 1 2 3 0 0 0 0 0 Sum of 0 4 is 6 Sum of 1 4 is 6 Sum of 2 4 is 6 Sum of 4 0 is 3 Sum of 4 1 is 6 Sum of 4 2 is 9 The matrix is : 1 2 3 0 1 2 3 0 1 2 3 0 0 0 0 0 My printing code: void show_mat() { System.out.println("The matrix is : "); for(int i=0;i&lt;m;i++) { for(int j=0;j&lt;n;j++) { System.out.print(mat[i][j] + " "); } System.out.println(); } } I can post all of my code or anymore whatever is needed if wanted. Sorry if my coding looks bad.. still relatively new to this.
has comment: http://stackoverflow.com/comment/40157302
accepted answer: http://stackoverflow.com/a/25692796
linked to: http://stackoverflow.com/q/25385173
tagged with: java
has comment: http://stackoverflow.com/comment/40157496
score: -1
has title: Something is going wrong while placing values into array, Sum of arrays
has comment: http://stackoverflow.com/comment/40157264
has comment: http://stackoverflow.com/comment/40157012
possible better answer: http://stackoverflow.com/a/25692817
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/25692817
has comment: http://stackoverflow.com/comment/40157424
tagged with: matrix
has comment: http://stackoverflow.com/comment/40157489
has answer: http://stackoverflow.com/a/25692796
has comment: http://stackoverflow.com/comment/40156959
downvote count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/25692918
has comment: http://stackoverflow.com/comment/40157399
has comment: http://stackoverflow.com/comment/40157475
has comment: http://stackoverflow.com/comment/40157394
has comment: http://stackoverflow.com/comment/40157444
has comment: http://stackoverflow.com/comment/40157207
favorite count: 0
has comment: http://stackoverflow.com/comment/40157375
has comment: http://stackoverflow.com/comment/40157104
type: Question
has comment: http://stackoverflow.com/comment/40157201
has comment: http://stackoverflow.com/comment/40160516
answer count: 3
has comment: http://stackoverflow.com/comment/40157338

clr
type: Tag
tags question: http://stackoverflow.com/q/25679546
tag name: clr

http://stackoverflow.com/comment/39944050
has text: What is *meant* by the question: that is, what is the *difference* between the two options provided?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25575483

http://stackoverflow.com/a/25680826
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25678348
type: Answer
answers question: http://stackoverflow.com/q/25678348
upvote count: 1
has body: Indeed, the Apache HttpClient is a better replacement of URLConnection. The HttpClient has been integrated into Android API and it is more friendly to developer. More can be seen at http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html
score: 1

http://stackoverflow.com/a/25676502
has body: Initialize your variable outside the if. public String front3(String str){ String front; if (str.length() &lt; 3){ front = str; } else { front = str.substring(0, 3); } return front + front + front; }
type: Answer
has comment: http://stackoverflow.com/comment/40127615
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25676481

http://stackoverflow.com/comment/40200007
score: 0
comment on: http://stackoverflow.com/q/25706741
type: QuestionComment
has text: @user3196301 if you did not get your answer, lemme know so I can help you :)
type: Comment

http://stackoverflow.com/q/25558200
has answer: http://stackoverflow.com/a/25558330
downvote count: 1
score: 1
tagged with: java
tagged with: eclipse
favorite count: 0
type: Question
tagged with: c++
answer count: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39911219
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39911239
has answer: http://stackoverflow.com/a/25558939
has title: How do I change Eclipse from Java IDE to C++ IDE?
has body: I am using a PC running Windows 8, and I have been coding in Eclipse prior to getting this laptop, but I cannot remember how to change the code to C++. Thanks!

http://stackoverflow.com/comment/40228244
has text: Definition of mapper : protected static DynamoDBMapper mapper; SDK version is 1.8.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25693125
score: 0

http://stackoverflow.com/comment/68718177
score: 4
has text: You'll want to catch a WebDriverTimeoutException
type: AnswerComment
comment on: http://stackoverflow.com/a/25810781
type: Comment

http://stackoverflow.com/a/25708605
accepted answer of: http://stackoverflow.com/q/25708452
has comment: http://stackoverflow.com/comment/40190012
answers question: http://stackoverflow.com/q/25708452
has comment: http://stackoverflow.com/comment/40186500
type: Answer
has body: Servlets are managed by the servlet container and not by spring. Spring will not inject servlets, because it does not instantiate them. If you want to get access to beans managed by spring within a servlet you must do it the same way as spring's DispatcherServlet does. E.g. to get the WebApplicationContext from the ServletContext do javax.servlet.ServletContext servletContext = ...; WebApplicationContextUtils.getWebApplicationContext(servletContext); This works because the ContextLoaderListener ensures that the WebApplicationContext is available as a ServletContext attribute. Since the WebApplicationContext is an ApplicationContext you can autowire beans that have been instantiated outside the spring container. For example ApplicationContext appContext = ...; AutowireCapableBeanFactory acbf = context.getAutowireCapableBeanFactory(); SomeBean someBean = new SomeBean(); acbf.autowireBean(someBean); Just put the @Autowired annotation on fields of SomeBean. A much easier way is to extend spring's org.springframework.web.servlet.FrameworkServlet and implement the doService method. Read the javadoc of the FrameworkServket for details.
score: 2
upvote count: 2
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/q/25578089
has answer: http://stackoverflow.com/a/25578201
type: AnsweredQuestion
score: 3
upvote count: 3
has body: I am getting an error in http connection java.lang.IllegalArgumentException: Illegal character in query at index 76. Tried all the 3 examples.Unable to fix it .Tried url_encode but its not taking the components:locality part into consideration.How do I make this url work .Thanks in Advance. BufferedReader in = null; HttpClient httpclient = new DefaultHttpClient(); HttpGet request = new HttpGet(); URI website = new URI("http://maps.googleapis.com/maps/api/geocode/json?components=locality:Spokane|country=us|administrative_area:washington&amp;address="+newText+"&amp;sensor=false"); request.setURI(website); HttpResponse response = httpclient.execute(request); in = new BufferedReader(new InputStreamReader( response.getEntity().getContent())); String line = in.readLine(); data = line; suggest = new ArrayList&lt;String&gt;(); And String uri =("http://maps.googleapis.com/maps/api/geocode/json?components=locality:Spokane|country=us|administrative_area:washington&amp;address="+newText+"&amp;sensor=false"); uri=URLEncoder.encode(uri,"UTF-8"); HttpClient hClient = new DefaultHttpClient(); HttpGet hGet = new HttpGet(uri); ResponseHandler&lt;String&gt; rHandler = new BasicResponseHandler(); data = hClient.execute(hGet,rHandler); suggest = new ArrayList&lt;String&gt;(); And String urlstr="http://maps.googleapis.com/maps/api/geocode/json?"; String str_parameters = "components=locality:Spokane|country=us|administrative_area:washington"; String encodedparams = URLEncoder.encode(str_parameters,"UTF-8")+"&amp;address="+URLEncoder.encode(newText, "UTF-8")+"&amp;sensor="+URLEncoder.encode("false", "UTF-8"); String str_finalurl=urlstr+encodedparams;
downvote count: 0
tagged with: http-get
tagged with: java
answer count: 1
has title: Error in http connection java.lang.IllegalArgumentException: Illegal character in query at index 76
accepted answer: http://stackoverflow.com/a/25578201
favorite count: 0
type: Question
tagged with: uri
tagged with: android

http://stackoverflow.com/comment/40092321
type: AnswerComment
comment on: http://stackoverflow.com/a/25651536
has text: @user2782582 that should be fine. Also one suggestion on the naming conventions :- All the variables and method names in Java start with smaller case.
type: Comment
score: 0

http://stackoverflow.com/q/25635472
has answer: http://stackoverflow.com/a/25635585
has comment: http://stackoverflow.com/comment/40053753
has comment: http://stackoverflow.com/comment/40053695
tagged with: operations
possible better answer: http://stackoverflow.com/a/25635567
type: Question
tagged with: parameters
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25635567
answer count: 3
has body: Okay, so I just started this homework lab and I'm having a little bit of trouble. I've searched for any solutions but they all seem way more complex than what I can comprehend. I'm looking for the dollars needed and change needed to buy something. I just came up with some numbers and when i run the file i get an error. Can anyone help me find how to complete the equations to get the sum value. Also dollarsNeeded needs to be int and not double. The changeNeeded can be double. Any help would be greatly appreciated. java:30: error: possible loss of precision findDollars = xboxOne + newGame; ^ required: int found: double 1 error public class MoneyNeeded { public static void main(String[] args) { double xboxOne, newGame, moneyNeeded; xboxOne = 320.41; newGame = 64.36; moneyNeeded = findMoney(xboxOne, newGame); System.out.println(moneyNeeded); int dollarsNeeded; dollarsNeeded = findDollars(xboxOne, newGame); System.out.println(dollarsNeeded); double changeNeeded; changeNeeded = findChange(xboxOne, newGame); System.out.println(changeNeeded); } public static double findMoney(double xboxOne, double newGame) { double findMoney; findMoney = xboxOne + newGame; return findMoney; } public static int findDollars(double xboxOne, double newGame) { int findDollars; findDollars = xboxOne + newGame; return findDollars; } public static double findChange(double findDollars, double findMoney) { double findChange; findChange = findMoney % findDollars; return findChange; } }
tagged with: java
accepted answer: http://stackoverflow.com/a/25635597
has comment: http://stackoverflow.com/comment/40053714
has answer: http://stackoverflow.com/a/25635597
tagged with: methods
has comment: http://stackoverflow.com/comment/40053887
has comment: http://stackoverflow.com/comment/40053860
has title: Fixing a method and parameter error

http://stackoverflow.com/comment/39931868
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25569236
has text: @parakmiakos thanks, downloading it now. will try it]
score: 0

timezone
tags question: http://stackoverflow.com/q/25583408
type: Tag
tag name: timezone
tags question: http://stackoverflow.com/q/25607733
tags question: http://stackoverflow.com/q/25657554

http://stackoverflow.com/comment/40001214
comment on: http://stackoverflow.com/q/25606728
score: 2
type: Comment
has text: What happened when you tried?
type: QuestionComment

enumeration
tag name: enumeration
type: Tag
tags question: http://stackoverflow.com/q/25571389
tags question: http://stackoverflow.com/q/25648852

http://stackoverflow.com/comment/40015680
type: AnswerComment
score: 0
has text: Thank you so much for your reply sir, but I got this error "java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.Date" any suggestion how to fix this sir? Thank you!
comment on: http://stackoverflow.com/a/25604928
type: Comment

http://stackoverflow.com/a/25624334
has body: Arrays.asList returns a fixed-size list. If you to want be able to add elements to the list, do: List&lt;String&gt; supportedTypes = new ArrayList&lt;&gt;(Arrays.asList("6500", "7600"}); supportedTypes.addAll(Arrays.asList(supportTypes.split(",")));
downvote count: 0
type: Answer
score: 16
answers question: http://stackoverflow.com/q/25624251
upvote count: 16

http://stackoverflow.com/q/25572009
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25572122
has body: I am working on a project in java and I would like to know: How to recognize if the path in my system uses "/" or "\" Recognize the version of the system I running the application I would appreciate code Sample.
has answer: http://stackoverflow.com/a/25572108
tagged with: path
answer count: 6
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25572107
score: 0
has answer: http://stackoverflow.com/a/25572123
accepted answer: http://stackoverflow.com/a/25572105
has title: In java how to recognize if I am on Unix base system or windows
has answer: http://stackoverflow.com/a/25572107
tagged with: java
has answer: http://stackoverflow.com/a/25572105
tagged with: version
has answer: http://stackoverflow.com/a/25572203
upvote count: 1
has comment: http://stackoverflow.com/comment/39937678
downvote count: 1

http://stackoverflow.com/comment/64836611
type: Comment
has text: Please help on this: http://stackoverflow.com/questions/38706919/funtion-to-convert-specific-date-range-to-hdfs-glob-pattern
type: QuestionComment
comment on: http://stackoverflow.com/q/25601779
score: 0

http://stackoverflow.com/q/25705235
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25705993
tagged with: android-async-http
has title: jsonHttpResponseHandler callbacks aren't invoked
type: Question
linked to: http://stackoverflow.com/q/12866353
tagged with: android
has body: I am making a GET request to: http://www.opensecrets.org/api/?method=getLegislators&amp;apikey=xxx&amp;output=json&amp;id=ny using android asynchttp 1.4.3. I set multiple breakpoints, but no exception is thrown and none of the following callbacks are being invoked: APIclient.getLegislators(this, enteredState, new JsonHttpResponseHandler() { @Override public void onSuccess(JSONArray arr) { String s= "hello"; } @Override public void onSuccess(JSONObject contactsJson) { ArrayList&lt;Contact&gt; contacts = Contact.fromJSON(contactsJson); } /*@Override public void onFailure(int statusCode, org.apache.http.Header[] headers, byte[] responseBytes, java.lang.Throwable throwable) { //super.onFailure(statusCode, headers, responseBytes, throwable); }*/ @Override public void onFailure(Throwable arg0, JSONArray arg1) { super.onFailure(arg0, arg1); Toast.makeText(getApplicationContext(), "Failed with JSONArray 2nd arg!", Toast.LENGTH_LONG).show(); } // If it fails it fails here where arg1 is the error message(dev inactive) @Override public void onFailure(Throwable arg0, String arg1) { super.onFailure(arg0, arg1); Toast.makeText(getApplicationContext(), "getTrailerUrl failed with String 2nd arg!", Toast.LENGTH_LONG).show(); } @Override public void onFailure(Throwable arg0, JSONObject arg1) { super.onFailure(arg0, arg1); Toast.makeText(getApplicationContext(), "Failed with JSONObject 2nd arg!", Toast.LENGTH_LONG).show(); } }); I tried to get an understanding of this by reviewing http://loopj.com/android-async-http/doc/com/loopj/android/http/JsonHttpResponseHandler.html Based on that javadoc, I entered the callback you see commented out. I commented it out because the compiler did not recognize any such parent onFailure signature. Yet the onFailure's I have that don't produce compiler errors are not shown in the official documentation. The solution in this SO post apparently was merged with the jar I have since that post was back in 2012: Loopj Android Async Http - onFailure not fire…
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25705993

http://stackoverflow.com/q/25641721
has answer: http://stackoverflow.com/a/44165506
has answer: http://stackoverflow.com/a/25641813
has comment: http://stackoverflow.com/comment/40064530
has comment: http://stackoverflow.com/comment/40064581
type: AnsweredQuestion
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40064705
tagged with: java
has body: -Experts. I'm instancing a general method(A) that returns a List type file. In my case, I know for sure that the file I'm going to obtain is a string and I would like to specify so in the method call. But, obviously, the programs show a type missmatch error. Just specifying List&lt;Object&gt; wouldn't be a solution because I need this file to be a string argument input for another method(B). The method(A) has the following definition: public &lt;T&gt; List&lt;T&gt; find(String queryString, Object param){} I instance the above-mentioned method(A) this way: String idioma; idioma = miDao.find("SELECT c.idioma FROM Idioma c WHERE c.palabra =:param",o1); The result is that idioma cannot be resolved as a variable. But my goal is to get the String idioma to use it as an input of a entity property: public void setIdioma(String idioma) { this.idioma = idioma; } Does anyone know how could I solve this missmatch file problem? Thank you in advance!
has comment: http://stackoverflow.com/comment/40064447
has comment: http://stackoverflow.com/comment/40064830
type: Question
possible better answer: http://stackoverflow.com/a/44165506
accepted answer: http://stackoverflow.com/a/25641813
has title: "List<Object>" and "String" cast declaration issue

http://stackoverflow.com/comment/40060900
score: 0
has text: But I need to recieve a list of pairs (date, sum) rather then I've done. May I not understand the result criteria has returned?
type: Comment
comment on: http://stackoverflow.com/a/25639062
type: AnswerComment

http://stackoverflow.com/comment/40133431
type: QuestionComment
comment on: http://stackoverflow.com/q/25679780
type: Comment
score: 0
has text: yes. You could use ProcessBuilder and Process.start() to start other program as seperate processes (not threads). Check [this](http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html)

http://stackoverflow.com/comment/40149143
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25687215
type: QuestionComment
has text: Notice the `standaloneSetup`. Check the other `MockMvcBuilders` methods.

http://stackoverflow.com/q/25640668
type: AnsweredQuestion
score: 0
tagged with: sockets
tagged with: android
tagged with: java
has body: Today I write a program.It works successfully and is almost finished.But I found when I close the Socket,BufferedReaderandPrintWriter,the program always shows ANR.I feel confused about that.Is there any sequence to close the program?? @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub try { mPrintWriter.println("192.168.2.131;"+mSocket.getLocalAddress().toString().replace("/", "")+";byebye"); mPrintWriter.close(); mBufferedReader.close(); mSocket.close(); net_.interrupt(); //This is the thread to send and receive data. } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } This is my question and I want to eliminate this bug to keep my program perfect.Thanks
has title: How to leave the program successfully
answer count: 1
tagged with: printwriter
tagged with: bufferedreader
accepted answer: http://stackoverflow.com/a/25641034
linked to: http://stackoverflow.com/q/704311
has answer: http://stackoverflow.com/a/25641034
type: Question

http://stackoverflow.com/comment/40245540
score: 0
has text: Paste the code you're using here. The argument you pass to the `Random` constructor makes no difference to the scale of the numbers generated. [Random Constructor](http://docs.oracle.com/javase/7/docs/api/java/util/Random.html#Random(long))
type: Comment
comment on: http://stackoverflow.com/a/25568829
type: AnswerComment

http://stackoverflow.com/comment/39941224
has text: Thanks, 1 & 2 were thumbs.db and desktop.ini, and the .png files started at 2
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25573966

http://stackoverflow.com/comment/40143796
score: 0
type: AnswerComment
has text: add tHis line `pubDateFormat ="Fri, 05 Sep 2014 06:01"; ` after this line `pubDateFormat = pubDate.substring(0, 23); ` in your code.
comment on: http://stackoverflow.com/a/25683918
type: Comment

http://stackoverflow.com/comment/40133922
has text: @dhalia - Yes, resteasy know, how to find there annotations, not spring annotations. BTW this is the easiest way, if you want to autowire in the resteasy resource.
comment on: http://stackoverflow.com/a/25679703
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25665362
type: Answer
downvote count: 0
has body: Using gson: package gson.sample.one; import com.google.gson.Gson; import com.google.gson.GsonBuilder; public class gsonsample { public class card { public String id; public String object; public String last4; public String brand; public String funding; public int exp_month; public int exp_year; public String fingerprint; public String country; public String name; public String address_line1; public String address_line2; public String address_city; public String address_state; public String address_zip; public String address_country; public String customer; } public class Response { public String id; public Boolean livemode; public int created; public String object; public String type; public card card; } public static void main(String [] args) { String json = "{ \"id\": \"tok_14WdJ02eZvKYlo2CyaZ49ZP7\", \"livemode\": false, \"created\": 1409272314, \"used\": false, \"object\": \"token\", \"type\": \"card\", \"card\": { \"id\": \"card_14WdJ02eZvKYlo2C5nE5XjtP\", \"object\": \"card\", \"last4\": \"4242\", \"brand\": \"Visa\", \"funding\": \"credit\", \"exp_month\": 8, \"exp_year\": 2015, \"fingerprint\": \"Xt5EWLLDS7FJjR1c\", \"country\": \"US\", \"name\": null, \"address_line1\": null, \"address_line2\": null, \"address_city\": null, \"address_state\": null, \"address_zip\": null, \"address_country\": null, \"customer\": null } }"; // Gson gson = new GsonBuilder().create(); Response response = gson.fromJson(json, Response.class); String id = response.card.id; System.out.println(id); } } Stripe also has these objects defined in the model definitions of their Java API and usage examples in their unit tests.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25656963

http://stackoverflow.com/comment/40191704
has text: Also this may work now because you can declare a new return type as you mentioned, but if i'll add more methods of which the generic (ManDetails/BabyDetails) is passed in the ctor or as a method param it will not work.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25711392
type: AnswerComment

http://stackoverflow.com/comment/39982890
comment on: http://stackoverflow.com/a/25596844
type: Comment
score: 0
type: AnswerComment
has text: Can you provide an example how would I accomplish this using Quartz? I was more incline towards java util packages class?

http://stackoverflow.com/q/25623458
tagged with: sql
has answer: http://stackoverflow.com/a/25643028
upvote count: 3
tagged with: java
tagged with: hibernate
tagged with: jpa
downvote count: 0
has title: JPA/Hibernate: Map many-to-many relationship when join table has own primary key
has comment: http://stackoverflow.com/comment/40037106
favorite count: 0
possible better answer: http://stackoverflow.com/a/25624731
type: Question
accepted answer: http://stackoverflow.com/a/25643028
has body: I have three tables with simple structure: pub [id, name] days [id, name] pub_days [id, pub_id, days_id] For some unholy reason, somebody thought that compound identity for pub_days table (that would be pub_id + days_id) is not enough and added own primary key. I can't change it now, other and larger system depends on that. #sigh I am trying to map this to Hibernate with standard @ManyToMany JPA annotation like so (I omitted getters, setters, @Entitiy annotations and other clutter): class Pub { @ManyToMany(cascade = {CascadeType.ALL}) @JoinTable(name = "pub_days", joinColumns = {@JoinColumn(name = "pub_id")}, inverseJoinColumns = {@JoinColumn(name = "days_id")}) @OrderBy("id") private List&lt;Day&gt; pubOpeningDays; } class Day { @Id Long id; String name. } when I execute following code: Day day = repository.find(Day.class, id); pub.getPubOpeningDays().add(day); repository.persist(pub); I get this error: ERROR: ORA-01400: cannot insert NULL into ("PUB"."pub_days"."id") Sadly, that makes perfect sense, because I haven't mapped that ID anywhere. The thing is, I don't even want to. I want it to be generated, but not sure how do I overcome this issue with @ManyToMany mapping. Any ideas?
has comment: http://stackoverflow.com/comment/40032465
has comment: http://stackoverflow.com/comment/40032629
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/40032591
has comment: http://stackoverflow.com/comment/40032715
has comment: http://stackoverflow.com/comment/40054940
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/40032411
answer count: 2
has answer: http://stackoverflow.com/a/25624731
has comment: http://stackoverflow.com/comment/40032304

http://stackoverflow.com/comment/40103392
type: Comment
comment on: http://stackoverflow.com/a/25639311
type: AnswerComment
has text: Almost exactly. Service continue it's work unless app is killed by user in task manager or by system to preserve memory
score: 0

http://stackoverflow.com/comment/40164249
type: AnswerComment
has text: If I do so, it tells me Map can't be resolved to a type.
score: 0
comment on: http://stackoverflow.com/a/25696174
type: Comment

http://stackoverflow.com/a/25570128
has body: The error message quoted indicates that the schema processor is interpreting <xs:any namespace="##other" .../> as allowing any element not in namespace first. That is, it's treating the group reference as if it were a simple macro expansion, and then creating the model group components in the context of the root schema document (where ##other would refer to any namespace other than the target namespace first), rather than creating them in the context of the child schema document (where ##other would refer to any namespace other than the target namespace second). A case could probably be made that section 3.10.2 of the XSD 1.0 spec requires that ##other be interpreted in the child.xsd context: when namespace="##other", the value of the {namespace constraint} property on the wildcard component is described as "a pair of not and the ·actual value· of the targetNamespace [attribute] of the <schema> ancestor element information item if present, otherwise ·absent·" -- for an xs:any element in child.xsd, that targetNamespace attribute has the value second, not first. A case could probably be made the other way: the spec is also clear that references to named model groups are not visible at the component level, that the scope of a local element declaration is determined by the location of the model-group reference, not the location of the model-group definition, etc., etc. Under those circumstances, it might seem positively irrational for the XSD spec to mean that ##other here should not have the interpretation "any namespace except first". On the whole, I lean toward the first interpretation, but I doubt very much that it would be possible to persuade the creators of your tool to change their interpretation of the spec: the rules for expansion of named model groups are too confusing and involve too much hand-waving to persuade anyone easily that their interpretation is wrong. [Oops. The following alleged 'workaround' is not a workaround at all: it's just another clearer wa…
answers question: http://stackoverflow.com/q/25568532
upvote count: 3
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/39990000
type: Answer

http://stackoverflow.com/comment/40091360
comment on: http://stackoverflow.com/q/25656102
type: Comment
type: QuestionComment
score: 0
has text: Yes, I did. Let me clarify, if I seek to 1000, it works fine. But if I seek to 1500, it goes to 2000.

http://stackoverflow.com/comment/40144381
has text: http://www.mysamplecode.com/2012/07/android-listview-cursoradapter-sqlite.html this sample looks little bit superfluous, but is's fine.
comment on: http://stackoverflow.com/a/25683836
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/25666173
score: 1
upvote count: 1
has body: Predicates can do exactly what you want and can work on as many attributes as you want them to. You just need to implement the evaluate() method with whatever criteria you want to test against. public class MyPredicate implements Predicate { private String testId; private String otherId; public MyPredicate(String testId,String otherId) { this.testId = testId; this.otherId = otherId; } public boolean evaluate( Object obj ) { boolean match = false; if( obj instanceof MyObject ) { if( testId.equalsIgnoreCase( ((MyObject)obj).getId()) &amp;&amp; otherId.equalsIgnoreCase( ((MyObject)obj).getOtherId()) ) { match = true; } } return match; } } So in your specific case, the evaluate method would look something like: public boolean evaluate( Object obj ) { boolean match = false; if( obj instanceof MyObject ) { if( "objectA".equals( ((MyObject)obj).typeOfObject ) &amp;&amp; 1 == ((MyObject)obj).anInteger ) { match = true; } } return match; }
type: Answer
accepted answer of: http://stackoverflow.com/q/25665663
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25665663
downvote count: 0

http://stackoverflow.com/q/25576869
has answer: http://stackoverflow.com/a/25576959
answer count: 4
tagged with: java
has title: How to set bitmap to ARGB_8888 in android?
downvote count: 0
has answer: http://stackoverflow.com/a/25576957
linked to: http://stackoverflow.com/q/6480182
favorite count: 0
type: Question
tagged with: alpha
has answer: http://stackoverflow.com/a/25577126
score: 5
linked to: http://stackoverflow.com/q/15058905
type: UnansweredQuestion
has body: In my android project, I load a bitmap from a image in the phone. I then do various image manipulations to it like cropping, resizing, editing pixel values. But the problem is the format of the bitmap is not ARGB_8888, so its not really storing the alpha values. Or rather its always keeping them at 255. How can I load the bitmap in ARGB_8888 format? This is my code to load and resize. How can I specify the format in any of these? Thanks private static Bitmap resize(Bitmap img, int newW, int newH) throws IOException { Bitmap resizedImg = Bitmap.createScaledBitmap(img, newW, newH, false); img.recycle(); Bitmap newresizedImg = resizedImg.copy(Bitmap.Config.ARGB_8888, true); resizedImg.recycle(); Pixel initialPixel = Function.getPixel(0, 0, newresizedImg, null); int a = initialPixel.getColor().getAlpha(); // -&gt; 255 newresizedImg.setPixel(0, 0, Pixel.getTransparentColor().getRGB()); initialPixel = Function.getPixel(0, 0, newresizedImg, null); int new_a = initialPixel.getColor().getAlpha(); // -&gt; 255 return newresizedImg; } private static Bitmap getImage(String from) throws IOException { File file = new File(from); if (file.exists()) { BitmapFactory.Options op = new BitmapFactory.Options(); op.inPreferredConfig = Bitmap.Config.ARGB_8888; Bitmap bufferedImage = BitmapFactory.decodeFile(from, op); return bufferedImage; } return null; } Pixel class public static Color getTransparentColor() { return new Color(0, 0, 0, 0); } Color class public int getRGB() { return ((A &lt;&lt; 24) | 0xFF) + ((R &lt;&lt; 16) | 0xFF) + ((G &lt;&lt; 8) | 0xFF) + (B | 0xFF); }
has answer: http://stackoverflow.com/a/50509987
tagged with: android
upvote count: 5
tagged with: bitmap

http://stackoverflow.com/q/25670677
tagged with: maven
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25670833
linked to: http://stackoverflow.com/q/7661559
score: 1
tagged with: android
tagged with: java
answer count: 1
has body: I'm very new with management dependencies with maven on android. Actually I achieved configure in the new Android Studio the management configuration dependencies with Gradle, but I not achieve configure the pom.xml to make deploy with this plugin. My pom.xml looks like 4.0.0 com.company my-project 1.0.0 apk ${project.artifactId} http://maven.apache.org org.springframework.maven.release Spring Maven Release Repository http://repo.springsource.org/release true false org.springframework.maven.snapshot Spring Maven Snapshot Repository http://repo.springsource.org/snapshot false true org.springframework.maven.milestone Spring Maven Milestone Repository http://repo.springsource.org/milestone false Central Repository http://repo.maven.apache.org/maven2 false <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.7</java.version> <android.sdk.platform>19</android.sdk.platform> com.google.android android 4.1.1.4 org.springframework.android spring-android-rest-template 1.0.1.RELEASE com.fasterxml.jackson.core jackson-databind 2.4.2 ${project.artifactId} app/src org.apache.maven.plugins maven-compiler-plugin 3.1 true ${java.version} ${java.version} org.apache.maven.plugins maven-eclipse-plugin 2.9 2.0 true true com.jayway.maven.plugins.android.generation2 android-maven-plugin 3.8.2 app/src/main/AndroidManifest.xml app/src/main/res app/src/main/assets ${env.ANDROID_HOME} ${android.sdk.platform} -Xms256m -Xmx512m Nexus4 auto <deleteConflictingFiles>true</deleteConflictingFiles> true true But each time that I run the command mvn clean package I get this error [ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:andr oid-maven-plugin:3.8.2:dex (default-dex) on project stock-control: MojoExecution Exception: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C "c:\Java\ jdk1.7.0_67\jre\bin\java -Xms256m -Xmx512m -jar X:\development\android-studio\sd …
tagged with: android-studio
type: Question
has title: Issue with Android Maven Plugin
type: UnansweredQuestion
downvote count: 0

http://stackoverflow.com/comment/40122116
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25672080
has text: I apologize, but I just don't quite understand how to change that. Assuming I need to pass the map, so I have the Key and Value pair, what do I change?

http://stackoverflow.com/comment/40068807
comment on: http://stackoverflow.com/q/25644116
score: 0
type: QuestionComment
type: Comment
has text: I have a game that multiple people can play so multiple instances of the same object will be created by the players, i want to know how to update a specific players instance

http://stackoverflow.com/comment/40949954
has text: can you add sample file content and the expected out?
comment on: http://stackoverflow.com/q/25685111
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25614879
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/25614858
type: Answer
has body: No, assigning to a field does not allocate memory. Objects are only created when you (directly or indirectly) call a constructor. Another question is does this line is passed by reference and does passed by reference is good in memory? Technically, everything in Java is passed by value. However, in the case of Objects, this value is a reference to the Object (not a copy of its contents). So passing an Object around is just the same as passing a long around as far as memory layout is concerned.
upvote count: 3

http://stackoverflow.com/comment/40088158
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25654035
type: Comment
has text: I can only get the exception from the AWT EventQueue thread, and that's where I got the information I posted above, there's no other exception thrown. I know it's a long shot without a distinct testcase, I'm working to see if I can recreate it (I'm working on a massively old piece of code that no-one knows about). What I'm looking for is pointers.

http://stackoverflow.com/comment/40169100
has text: Your Ant script makes the same as when you open Windows Explorer and double click on a batch file, it starts the `cmd.exe` as new process. Therefore exiting Windows Explorer or your Ant script (or killing them) does not have any effect on the separate command line interpreter process (batch execution) already running. If you want to kill all processes started by your Ant script, it would be needed to code a task kill for the started batch task executed on termination of the Ant script. As I don't know anything about Ant scripts, I don't know if that is possible at all in Ant scripts.
score: 0
comment on: http://stackoverflow.com/q/25694243
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25619208
tagged with: jetty
tagged with: embedded-jetty
type: Question
score: 0
has title: Embedded Jetty with client certificates
tagged with: java
has answer: http://stackoverflow.com/a/25626667
type: UnansweredQuestion
has body: I want to create embedded https server that required the clients to present a certificate and I am using this: http://www.smartjava.org/content/embedded-jetty-client-certificates Now my question is that how can I provide keystore and truststore file for my code given that my jetty is emedded. I mean these lines in the code: // the keystore (with one key) we'll use to make the connection with the // broker private final static String KEYSTORE_LOCATION = "src/main/resources/client_keystore.jks"; private final static String KEYSTORE_PASS = "secret"; // the truststore we use for our server. This keystore should contain all the keys // that are allowed to make a connection to the server private final static String TRUSTSTORE_LOCATION = "src/main/resources/truststore.jks"; private final static String TRUSTSTORE_PASS = "secret"; Thanks
answer count: 1

http://stackoverflow.com/comment/40033907
has text: +1 you are right. Now its weird - no doubt. But f may be null, a Null-Pointer exception will be thrown, noone knows if NullPointerException not inheried a IOException.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25624597

http://stackoverflow.com/comment/40127690
has text: @rgettman you should include that comment in your answer as a precursor to the code sample. Very concise answer to a well asked question.
type: AnswerComment
comment on: http://stackoverflow.com/a/25676496
score: 1
type: Comment

http://stackoverflow.com/q/25675704
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25675834
has title: Error with a simple Spinner on Android
tagged with: android-spinner
accepted answer: http://stackoverflow.com/a/25702917
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25702917
has body: I'm learning about Spinners in Android, and I've tested the code that appears in this link of Android Developers: http://developer.android.com/guide/topics/ui/controls/spinner.html But it doesn't work, these are the files: MainActivity.java ... protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Spinner spinner = (Spinner) findViewById(R.id.planets_spinner); // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.planets_array, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner spinner.setAdapter(adapter); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } ... fragment_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android: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.spinners.MainActivity$PlaceholderFragment" > <Spinner android:id="@+id/planets_spinner" android:layout_width="fill_parent" android:layout_height="wrap_content" /> Strings.xml <?xml version="1.0" encoding="utf-8"?> Spinners Settings Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune When I try the app show some errors: E/AndroidRuntime(1381): FATAL EXCEPTION: main Process: com.example.spinners, PID: 1381 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.spinners/com.example.spinners.MainActivi…
score: 0
tagged with: android
tagged with: java
tagged with: spinner
has answer: http://stackoverflow.com/a/25675834

http://stackoverflow.com/comment/50684989
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25613395
type: QuestionComment
has text: @Soyer Hey I'm having a similar issue; what did you end up doing? Thanks!

http://stackoverflow.com/a/25685449
upvote count: 2
downvote count: 0
has body: if static string then instead of securityKey == "oneplc" do securityKey.equals("oneplc"); if from strings.xml then securityKey.equals(getResources().getString(R.string.stringname));
answers question: http://stackoverflow.com/q/25685326
type: Answer
score: 2

http://stackoverflow.com/comment/40168730
comment on: http://stackoverflow.com/q/25698893
score: 0
type: Comment
has text: Come on guys stop marking as a bad question and help me. Thats not fair with someone who is new in this field.
type: QuestionComment

http://stackoverflow.com/comment/39938794
has text: @MatteoDepasquali You send chunks of 1024-10000 bytes. I would like to see the sending process.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25571343

http://stackoverflow.com/q/25565764
has answer: http://stackoverflow.com/a/25566673
downvote count: 0
score: 1
upvote count: 1
favorite count: 0
tagged with: spring-boot
type: Question
has body: I picked up a spring-boot project on ubuntu with intellij 13.0.1 using the gradle build file from spring.io guide. I had some groovy and gradle in my /opt folder but switched to gvm so my current groovy is : joseph@do-enr-pc-2:~$ groovy --version Groovy Version: 2.3.6 JVM: 1.8.0_20 Vendor: Oracle Corporation OS: Linux joseph@do-enr-pc-2:~$ echo $GROOVY_HOME /home/joseph/.gvm/groovy/current This is a simple project to test how it looks like .All needed files are on pastie.org When I run my project with java I get the following: joseph@do-enr-pc-2:/home/joseph/micro-smpp-client-java$ ./gradlew springBoot &amp;&amp; java build/libs/micro-smpp-client-0.1.0.jar --stacktrace Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties. Deprecated dynamic property: "mainClass" on "task ':springBoot'", value: "net.myproject.smpp...". :springBoot UP-TO-DATE BUILD SUCCESSFUL Total time: 2.813 secs Error: Could not find or load main class build.libs.micro-smpp-client-0.1.0.jar But when I run it with groovy I have this following: joseph@do-enr-pc-2:/home/joseph/micro-smpp-client-java$ ./gradlew springBoot &amp;&amp; groovy build/libs/micro-smpp-client-0.1.0.jar --stacktrace Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties. Deprecated dynamic property: "mainClass" on "task ':springBoot'", value: "net.myproject.smpp...". :springBoot UP-TO-DATE BUILD SUCCESSFUL Total time: 3.934 secs org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: /home/joseph/micro-smpp-client-java/build/libs/micro-smpp-client-0.1.0.jar…
tagged with: intellij-idea
type: UnansweredQuestion
tagged with: spring
answer count: 1
tagged with: groovy
tagged with: java
has title: Project throwing multiple compilation errors exception

http://stackoverflow.com/comment/40115575
type: QuestionComment
has text: Better to just do `yourStr.replace("$", "")` and avoid used regexes when they aren't needed.
comment on: http://stackoverflow.com/q/25669656
score: 1
type: Comment

http://stackoverflow.com/comment/40015764
score: 0
type: AnswerComment
type: Comment
has text: And as the ugliness of the syntax indicates, this is not something you should be doing. These inner classes should be managed by their containing class.
comment on: http://stackoverflow.com/a/25614811

http://stackoverflow.com/q/25559052
answer count: 1
has title: JApplet - Wont draw image when boolean is true
tagged with: swing
type: AnsweredQuestion
tagged with: japplet
has body: I have 4 tiles: Blue, red, green, and yellow. When the mouse moves over the tile I want it to light up (just change the image to a light colored one). Instead nothing happens. I have done some simple debugging and know for a fact that the images are imported correctly and mouseOverTile[0] is turning true. import java.awt.Graphics; import java.awt.Image; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.Arrays; import javax.swing.ImageIcon; import javax.swing.JApplet; public class MainGame extends JApplet implements MouseListener, Runnable { private static final long serialVersionUID = 1L; Thread animator = null; Image blue, blueLit, red, redLit, green, greenLit, yellow, yellowLit; boolean takingTurn; boolean[] mouseOverTile = new boolean[4]; public void init() { setSize(500, 500); blue = new ImageIcon("Images/Blue.png").getImage(); blueLit = new ImageIcon("Images/Blue_Lit.png").getImage(); red = new ImageIcon("Images/Red.png").getImage(); redLit = new ImageIcon("Images/Red_Lit.png").getImage(); green = new ImageIcon("Images/Green.png").getImage(); greenLit = new ImageIcon("Images/Green_Lit.png").getImage(); yellow = new ImageIcon("Images/Yellow.png").getImage(); yellowLit = new ImageIcon("Images/Yellow_Lit.png").getImage(); Arrays.fill(mouseOverTile, false); takingTurn = true; addMouseListener(this); } public void start() { if(animator == null) { animator = new Thread(this); } } public void stop() { animator = null; } @Override public void run() { while(Thread.currentThread() == animator) { try { Thread.sleep(1); repaint(); } catch(Exception e) { } } } public void paint(Graphics g) { if(!mouseOverTile[0]) { g.drawImage(blue, 50, 50, this); } else g.drawImage(blueLit, 50, 50, this); if(!mouseOverTile[1]) { g.drawImage(red, 260, 50, this); } else g.drawImage(redLit, 260, 50, this); if(!mouseOverTile[2]) { g.drawImage(green, 50, 260, this); } else g.drawImage(greenLit, 50, 260, this); if(!mouseOverTile[3]) { g.drawImage(yellow, 260…
tagged with: java
has comment: http://stackoverflow.com/comment/39913390
accepted answer: http://stackoverflow.com/a/25559298
type: Question
has comment: http://stackoverflow.com/comment/39913184
score: 0
has answer: http://stackoverflow.com/a/25559298
has comment: http://stackoverflow.com/comment/39913404

http://stackoverflow.com/comment/40149273
type: AnswerComment
has text: Ok, mhmm .... maybe i should try to upgrade all my dependecies to the latest release version, there are loads of packages linked to that project.
type: Comment
comment on: http://stackoverflow.com/a/25644440
score: 0

http://stackoverflow.com/a/26240165
score: 0
has body: After some troubles I have found the solution: mysql 5.5 guide states: InnoDB uses the in-memory auto-increment counter as long as the server runs. When the server is stopped and restarted, InnoDB reinitializes the counter for each table for the first INSERT to the table, as described earlier. This is a big problem for me. I'm using envers to keep entities audits. I get as many errors as many "last rows" I delete. Suppose I'm starting insert data into an empty table. Suppose to insert 10 rows. Then suppose to delete the last 8. In my db I will have as result 2 entities, with id 1 and 2 respectively. In the audit table I will have all 10 entities, with id from 1 to 10, and entities with id from 3 to 10 will have 2 action: create action and delete action. auto-increment counter is now setted to 11. Restarting mysql service auto-increment counter goes to 3. So if I insert a new entity, it will be saved with id 3. But in audit table there is also an entity with id = 3. That entity is already marked as created and deleted. It result in an assertion failure during update /delete action because envers cannot handle this inconsistent state.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/44435566
has comment: http://stackoverflow.com/comment/108192048
answers question: http://stackoverflow.com/q/25690217
type: Answer
has comment: http://stackoverflow.com/comment/44428752
accepted answer of: http://stackoverflow.com/q/25690217
has comment: http://stackoverflow.com/comment/44428637

http://stackoverflow.com/q/25653672
has comment: http://stackoverflow.com/comment/40087191
type: Question
has comment: http://stackoverflow.com/comment/40086743
has comment: http://stackoverflow.com/comment/40086926
accepted answer: http://stackoverflow.com/a/25673555
has title: Receiving "Not a valid char constructor input" error when passing decimals
has answer: http://stackoverflow.com/a/25673555
has comment: http://stackoverflow.com/comment/40087111
tagged with: bigdecimal
tagged with: spring
type: AnsweredQuestion
score: 0
has body: I am receiving "Not a valid char constructor input" when passing decimal. My code is below. I have researched and found that by changing from BigDecimal to Formatdeciaml solves the problem, but I can't do that because then my mapper needs to be changed as well. Any help would be appreciated!! Controller String postagePaid = (String) request.getParameter("tPostagePaid"); String insuranceFees = (String) request.getParameter("tInsuranceFees"); String registeredFees = (String) request.getParameter("tRegisteredFees"); String codFees = (String) request.getParameter("tCODFees"); String insRegisteredCODFees = (String) request.getParameter("tInsuranceFees"); System.out.println("insurance Fee: " + insuranceFees); if (postagePaid != null &amp;&amp; !insuranceFees.isEmpty()) { // postage paid amount claim.setClPostagePaidAmt(new BigDecimal(postagePaid)); } if (insuranceFees != null &amp;&amp; !insuranceFees.isEmpty()) { // Insurance Fees claim.setClInsuranceFee(new BigDecimal(insuranceFees)); } if (registeredFees != null &amp;&amp; !insuranceFees.isEmpty()) { // Registered Fees claim.setClRegisteredFee(new BigDecimal(registeredFees)); } if (codFees != null &amp;&amp; !insuranceFees.isEmpty()) { // COD Fees claim.setClCodFee(new BigDecimal(codFees)); } claim.setClInsRegCodAmt(null); Error: Caused by: java.lang.NumberFormatException: Not a valid char constructor input: at java.math.BigDecimal.bad(BigDecimal.java:1859) at java.math.BigDecimal.charParser(BigDecimal.java:1303) at java.math.BigDecimal.&lt;init&gt;(BigDecimal.java:922) at java.math.BigDecimal.&lt;init&gt;(BigDecimal.java:901) at gov.usps.oic.controller.OicClaimEntryControlloer.submitClaim(OicClaimEntryControlloer.java:991) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.springfr…
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40114937

http://stackoverflow.com/comment/40150689
comment on: http://stackoverflow.com/a/25689267
type: AnswerComment
type: Comment
has text: @ShubhamMarathia I haven't read the specific problem, but in general - yes.
score: 0

http://stackoverflow.com/comment/39941916
type: Comment
comment on: http://stackoverflow.com/a/25571650
type: AnswerComment
has text: You dont't trust public keys, you trust certificates. Public jets are public. Anyone can have them. Possession of them proves nothing, and distribution of them with client code accomplishes nothing. You need to study how PKI really works.
score: 0

http://stackoverflow.com/comment/40151824
comment on: http://stackoverflow.com/q/25689871
score: 1
type: QuestionComment
has text: The method `output.flush()` forces the stream to output whatever it has buffered. If you don't flush the downloaded bytes will be stored in `output` until it flushes itself. Not sure when that happens.
type: Comment

http://stackoverflow.com/a/25693321
answers question: http://stackoverflow.com/q/25692963
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25692963
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/40159500
has comment: http://stackoverflow.com/comment/40159732
type: Answer
has body: There is a way to provide property values to Logback configuration during runtime: http://logback.qos.ch/manual/configuration.html#definingPropsOnTheFly You need to create a class that implements PropertyDefiner interface and returns location of the jar public class MyPropertyDefiner extends PropertyDefinerBase { @Override public String getPropertyValue() { return MyPropertyDefiner.class.getProtectionDomain().getCodeSource().getLocation().getFile(); } } In your logback.xml you can specify something like this &lt;configuration&gt; &lt;define name="jarLocation" class="MyPropertyDefiner"/&gt; &lt;appender name="FILE" class="ch.qos.logback.core.FileAppender"&gt; &lt;file&gt;${jarLocation}&lt;/file&gt; ... &lt;/appender&gt; ... &lt;/configuration&gt;
upvote count: 4

http://stackoverflow.com/q/25695998
tagged with: interface
tagged with: android
tagged with: java
tagged with: splash-screen
tagged with: class
type: AnsweredQuestion
has title: Set another Class to Main Class Android
answer count: 1
downvote count: 0
score: 1
upvote count: 1
accepted answer: http://stackoverflow.com/a/25696040
favorite count: 0
has answer: http://stackoverflow.com/a/25696040
type: Question
has body: i made a splash screen for my app (i know that it is not that important), so i made a new class .. it does not show error on android studio now .. the only problem i have is .. how can i change that (splash screen) class will show first before the main class ?? .. i followed a quick tutorial about making a splashscreen on another website and this is what my XML and CLASS structure looks like, PS i decided making a splash screen right after my app is already made, so i am editing my app .. thanks
has comment: http://stackoverflow.com/comment/40163768

http://stackoverflow.com/q/25560535
upvote count: 1
has answer: http://stackoverflow.com/a/25562155
downvote count: 1
has answer: http://stackoverflow.com/a/25562077
favorite count: 0
type: Question
has body: I'm new to LibGDX and I am taking it slowly. I'm still trying to understand most things which is why typically google searches don't help due to the fact that their too complicated. I have a main menu that has text that I want centered no matter what the screen size is. Here is the code that I have for that menu. public class Menu implements Screen { SlingshotSteve game; OrthographicCamera camera; public Menu(final SlingshotSteve gam) { this.game = gam; camera = new OrthographicCamera(); camera.setToOrtho(false, 800, 480); } @Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0.2f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); game.batch.setProjectionMatrix(camera.combined); game.batch.begin(); game.font.draw(game.batch, "Welcome to Slingshot Steve!!! ", 100, 150); game.font.draw(game.batch, "Tap anywhere to begin!", 100, 100); game.batch.end(); if (Gdx.input.isTouched()) { game.setScreen((Screen) new GameScreen(game)); dispose(); } } @Override public void resize(int width, int height) { } @Override public void show() { } @Override public void hide() { } @Override public void pause() { } @Override public void resume() { } @Override public void dispose() { } }
tagged with: libgdx
tagged with: java
possible better answer: http://stackoverflow.com/a/25562155
has title: LibGDX - how do I make my text centered?
type: AnsweredQuestion
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25562077

http://stackoverflow.com/q/25604832
answer count: 4
has answer: http://stackoverflow.com/a/25607675
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25604890
has comment: http://stackoverflow.com/comment/39997715
has comment: http://stackoverflow.com/comment/40003069
has body: I think that there's something wrong in my code, is it the same to call (in setIstance) the method isSameMonth() in the static way or in a non static way? The compiler suggest me to change: timesheet.isSameMonth() to Timesheet.isSameMonth() I think no, because I want to pass the local variable timesheet, is it the same thing or should I modify my code? Timesheet class: static private Timesheet timesheet; static public Timesheet getIstance() { if (timesheet == null || !Timesheet.isSameMonth()) { timesheet = null; timesheet = new Timesheet(); } return timesheet; } static public void setIstance(Timesheet timesheet) { if (timesheet != null &amp;&amp; timesheet.isSameMonth()) { Timesheet.timesheet = timesheet; } } public static boolean isSameMonth() { Date now = new Date(); Calendar calendarNow = Calendar.getInstance(); calendarNow.setTime( now ); Date firstDay = timesheet.days[0]; Calendar calendarFirstDay = Calendar.getInstance(); calendarFirstDay.setTime( firstDay ); if (calendarNow.get(Calendar.MONTH) == calendarFirstDay.get(Calendar.MONTH)) { return true; } return false; } From outside I make this call: Gson gson = new Gson(); String json = sharedPrefs.getString("timesheet", ""); if (!json.isEmpty()) { try { Timesheet timesheet = Timesheet.getIstance(); if (timesheet.getDay(0)==null) { Timesheet.setIstance( gson.fromJson(json, Timesheet.class) ); } refreshWidget(timesheet, context, allWidgetIds, intent.getAction()); } catch (Exception e) { Log.e(TAG_LOG, e.toString()); } }
has title: Static method in java, can I access in a non-static way to a static method?
accepted answer: http://stackoverflow.com/a/25607675
type: Question
tagged with: static-methods
tagged with: static
has answer: http://stackoverflow.com/a/25604891
has answer: http://stackoverflow.com/a/25604875
possible better answer: http://stackoverflow.com/a/25604875
tagged with: java
has comment: http://stackoverflow.com/comment/39997987

sql
tags question: http://stackoverflow.com/q/25627017
tags question: http://stackoverflow.com/q/25560742
tags question: http://stackoverflow.com/q/25700074
tags question: http://stackoverflow.com/q/25579825
tags question: http://stackoverflow.com/q/25607985
tags question: http://stackoverflow.com/q/25711515
tags question: http://stackoverflow.com/q/25643000
tags question: http://stackoverflow.com/q/25562277
tags question: http://stackoverflow.com/q/25654506
tags question: http://stackoverflow.com/q/25567966
tags question: http://stackoverflow.com/q/25617942
tags question: http://stackoverflow.com/q/25567032
tags question: http://stackoverflow.com/q/25570850
tags question: http://stackoverflow.com/q/25559341
tags question: http://stackoverflow.com/q/25569372
tags question: http://stackoverflow.com/q/25664009
tags question: http://stackoverflow.com/q/25674713
tags question: http://stackoverflow.com/q/25654463
tags question: http://stackoverflow.com/q/25705713
tags question: http://stackoverflow.com/q/25583412
tags question: http://stackoverflow.com/q/25623458
tags question: http://stackoverflow.com/q/25643981
tags question: http://stackoverflow.com/q/25679525
tags question: http://stackoverflow.com/q/25631184
tags question: http://stackoverflow.com/q/25686350
tags question: http://stackoverflow.com/q/25701392
tags question: http://stackoverflow.com/q/25685605
tags question: http://stackoverflow.com/q/25592047
tags question: http://stackoverflow.com/q/25616249
tags question: http://stackoverflow.com/q/25555609
tags question: http://stackoverflow.com/q/25631706
tags question: http://stackoverflow.com/q/25556020
tags question: http://stackoverflow.com/q/25631839
tags question: http://stackoverflow.com/q/25649575
tags question: http://stackoverflow.com/q/25706875
tags question: http://stackoverflow.com/q/25662046
tags question: http://stackoverflow.com/q/25658482
tags question: http://stackoverflow.com/q/25584807
tags question: http://stackoverflow.com/q/25677856
tags question: http://stackoverflow.com/q/25582698
tags question: http://stackoverflow.com/q/25634983
tags question: http://stackoverflow.com/q/25603949
tags question: http://stackoverflow.com/q/25597778
tags question: http://stackoverflow.com/q/25676589
tags question: http://stackoverflow.com/q/25621722
tags question: http://stackoverflow.com/q/25705762
tags question: http://stackoverflow.com/q/25629574
tags question: http://stackoverflow.com/q/25681354
tag name: sql
tags question: http://stackoverflow.com/q/25656231
tags question: http://stackoverflow.com/q/25598996
type: Tag
tags question: http://stackoverflow.com/q/25613694
tags question: http://stackoverflow.com/q/25701694
tags question: http://stackoverflow.com/q/25690708
tags question: http://stackoverflow.com/q/25572338
tags question: http://stackoverflow.com/q/25665662
tags question: http://stackoverflow.com/q/25576538
tags question: http://stackoverflow.com/q/25633938
tags question: http://stackoverflow.com/q/25703203
tags question: http://stackoverflow.com/q/25690447
tags question: http://stackoverflow.com/q/25684276
tags question: http://stackoverflow.com/q/25601338
tags question: http://stackoverflow.com/q/25567813
tags question: http://stackoverflow.com/q/25570907
tags question: http://stackoverflow.com/q/25687598
tags question: http://stackoverflow.com/q/25605241
tags question: http://stackoverflow.com/q/25559417
tags question: http://stackoverflow.com/q/25568584

http://stackoverflow.com/a/25594484
type: Answer
has comment: http://stackoverflow.com/comment/39978859
has body: Two things I can think of doing as a quick fix, either 'Invalidate Caches/Restart' by going to File > Invalidate Caches/Restart. Or try importing the project again as a maven project. Do you have any errors in the 'Event Log'?
score: 1
accepted answer of: http://stackoverflow.com/q/25594442
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25594442
has comment: http://stackoverflow.com/comment/39979176

http://stackoverflow.com/comment/40166713
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25697741
score: 0
has text: but `HashMap` internally use `hashCode()` it's it?

http://stackoverflow.com/a/25669557
answers question: http://stackoverflow.com/q/25669500
has comment: http://stackoverflow.com/comment/40136769
has comment: http://stackoverflow.com/comment/40116034
score: 0
has body: someString.matches("[A-Za-z0-9]+")
type: Answer

http://stackoverflow.com/q/25707531
upvote count: 0
has comment: http://stackoverflow.com/comment/40185055
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14229072
answer count: 1
downvote count: 1
has body: I am working on a Swing based small project. In this project I want to open another window when user log-in successfully but when I click log-in button an exception occurred, like "Illegal attempt to exit early", while my database connection is well because when I show message dialog then it shows successful log-in. Here is my code. package org.Core.Art; import java.awt.Component; import org.netbeans.api.settings.ConvertAsProperties; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.windows.TopComponent; import org.openide.util.NbBundle.Messages; import java.sql.*; import javax.swing.*; import org.openide.util.Exceptions; public final class CoreTopComponent extends TopComponent { private String password; private String pwd; private Component jPasswordField1; private Component jButton1; //private Object text_password; public CoreTopComponent() { initComponents(); } private void ClickActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: Object password = text_password.getText(); String query = "Select * from assistant where pass = '"+password+"'"; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/auto_lube","root", "mehar"); Statement stmt = conn.createStatement(); stmt.execute(query); ResultSet rs = stmt.getResultSet(); boolean recordfound = rs.next(); if (recordfound) { Login regFace = new Login(); regFace.setVisible(true); dispose(); //JOptionPane.showMessageDialog(null,"You are login successfully"); } else { JOptionPane.showMessageDialog(null,"Try again"); // new Login_fram().setVisible(true); } conn.close(); } catch(java.lang.ClassNotFoundException ex) { JOptionPane.showMessageDialog(null,"Exception Occured"+ex.getMessage()); } catch(Exception ex) { JOptionPane.showMessageDialog(null,"Exception Occured"+ex.getMessage()); } } private void text_passwordActionPerformed(java.awt.event.ActionEvent evt) { // TODO add y…
has title: Open new window when user login successfully in swing
tagged with: swing
has comment: http://stackoverflow.com/comment/40184451
linked to: http://stackoverflow.com/q/3988788
has answer: http://stackoverflow.com/a/25712844
has comment: http://stackoverflow.com/comment/40184434
favorite count: 0
linked to: http://stackoverflow.com/q/25448611
tagged with: java
has comment: http://stackoverflow.com/comment/40184469
score: -1
type: Question

http://stackoverflow.com/a/25708028
score: 0
answers question: http://stackoverflow.com/q/25707992
type: AcceptedAnswer
has body: In System.out.print("\n"+dict.get(str)+"\n\n");, you are actually calling toString of int[], not of your Complex object. This is expected output for array toString.
type: Answer
accepted answer of: http://stackoverflow.com/q/25707992

http://stackoverflow.com/comment/40004507
has text: why? which is a better approach then?
comment on: http://stackoverflow.com/q/25608699
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25688197
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25687598
score: 0
has body: The word "secure" depends on how you code it. JDBC security level is comparatively high than many other options but you should make sure that there is no venerability in your codes. While coding, do not forget: Use prepared statements. Always use field validators. Keep studying on building security systems. Also, if your transport is not encrypted, then there is laways a chance of hacking. A SSL connection encrypts the transport and therefore enhanced the security.
accepted answer of: http://stackoverflow.com/q/25687598
type: Answer

http://stackoverflow.com/q/25592312
has comment: http://stackoverflow.com/comment/39974778
favorite count: 0
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/39975357
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39975261
downvote count: 0
has comment: http://stackoverflow.com/comment/39974653
upvote count: 1
tagged with: sorting
tagged with: collections
has comment: http://stackoverflow.com/comment/39978049
tagged with: arraylist
has comment: http://stackoverflow.com/comment/39974853
score: 1
has body: I am doing my final Matric project and I am stuck. Basically what my app does is it plots a study schedule for you. My cousin gave me the idea of looping through a couple of times, generating about 10 study schedules and assigning values to them and the highest value is the chosen timetable to give to the user. I am trying to generate a random table, where it plots the timetable with some preloaded subjects, their exam dates and their score (% the user got) which will all be populated later dynamically. I am just testing now. My issue I am facing now is: It only loads the first subject, it does not set the next subject. I have tried to put in constraints such as the maximum amount of time that can be allocated to the one subject, but it does not work for some reason (probably bad code). So what needs to happen is it needs to see how long we have to study per subject according to what subject is before the other in terms of exam dates (so english more than IT for example which is where the score comes in. That was inverted from the lowest percentage to a higher percentage). Here is the code for the weighting class: public void dayCounter() { days = new ArrayList&lt;Day&gt;(); // loop through for how many days we have to study for(int i = 0; i &lt; nodays; i++) { // create new day object to store data in DateTime d = startDate.plusDays(i); // create new day with how many hours we have to study that day Day day = new Day(2); // set the date and time for the new day object day.setDateTime(d); // get monday - sunday, what day it is DateTime.Property dayOfWeek = d.dayOfWeek(); // set the day of the week (mon - sun) as name of day object day.setName(dayOfWeek.getAsText()); for(int j = 0; j &lt; day.getMaxNumberOfHours(); j++ ) { Subject sub = getSubject(); try { if(sub != null &amp;&amp; !sub.isAreHoursCompleted()) { ArrayList&lt;Subject&gt; hoursPerDay = null; if(sub.getExamDate().isBefore(day.getDateTime())) { hoursPerDay = new ArrayList&lt;Subject&gt;(); for(int x = 0; …
tagged with: java
has comment: http://stackoverflow.com/comment/39975454
tagged with: artificial-intelligence
has title: Load random index from ArrayList of custom object
has comment: http://stackoverflow.com/comment/39975527

http://stackoverflow.com/comment/39923944
comment on: http://stackoverflow.com/q/25565171
type: QuestionComment
has text: How do you know where you have to "split" your `String` to get different "words" ?
score: 1
type: Comment

http://stackoverflow.com/comment/40008912
score: 0
has text: in chackers once some piece is reaching last line, it is switches to a king. the piece is old checker
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25610917

http://stackoverflow.com/comment/39969822
type: QuestionComment
comment on: http://stackoverflow.com/q/25589685
score: 1
type: Comment
has text: This is really basic stuff. Do you mind searching on the net first? Anyway, use a `List` that supports concurrency like [`CopyOnWriteArrayList`](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CopyOnWriteArrayList.html) or use another structure that supports concurrent operations instead like a `Queue`.

http://stackoverflow.com/q/25646630
downvote count: 0
has body: I'm using lucene with the following filter chain: StandardFilter &gt; LowerCaseFilter &gt; GermanNormalizationFilter &gt; ASCIIFoldingFilter Which additional filter do I have to use to convert any unknown characters to the latin alphabet? Eg russian strings like Кадашевская, I would like them to either be converted to the latin alphabet equivalent, or have them removed. Which filter fits this purpose? At the moment, the filter chain normalized the string to: ???????????
tagged with: lucene
favorite count: 0
score: 2
type: AnsweredQuestion
has title: How to normalize unknown characters in Lucene?
tagged with: java
accepted answer: http://stackoverflow.com/a/25648634
has answer: http://stackoverflow.com/a/25648634
type: Question
upvote count: 2
answer count: 1

http://stackoverflow.com/comment/58188313
has text: Actually the [current API doc](http://developer.android.com/reference/android/net/http/HttpResponseCache.html) emphasizes the need to *flush* the cache, not to close it. But it doesn't explain how to install and flush a *single* cache for the whole app, which is what your question boils down to. And that's a good answer below.
score: 0
comment on: http://stackoverflow.com/q/25621942
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39949537
comment on: http://stackoverflow.com/q/25578334
score: 0
type: Comment
type: QuestionComment
has text: Why don't you answer the first part of the question first. Then I can answer yours

http://stackoverflow.com/q/25641586
tagged with: java
tagged with: spinner
accepted answer: http://stackoverflow.com/a/25642376
type: Question
has comment: http://stackoverflow.com/comment/40064607
has title: link two j spinners where number range of one depends on value selected in the other
has answer: http://stackoverflow.com/a/25642376
answer count: 1
has body: I'm new to Java and trying to understand if the following is possible: I have a number spinner ranging from 30 to 55, call it spinner1. I want to link a second spinner, spinner2, where the range of values depends on the number chosen in spinner1. e.g. if the user chooses 30 in spinner1 they can choose a number between 1 and 100 in spinner2. Selecting 55 in spinner1 limits the range of values in spinner2 to between 1 and 50. I have read the JSpinner cycling tutorial and understand how two spinners can be linked but there both spinners have fixed limits. I really jsut want o know if this is possible and any hints would be appreciated.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40064438
score: 0

http://stackoverflow.com/a/25603553
type: Answer
has body: I would just split on a comma surrounded by reversed curly brackets: String[] parts = s.split("(?&lt;=}),(?=\\{)"); This uses look arounds to assert the presence of, but not consume, the curly brackets.
answers question: http://stackoverflow.com/q/25603463
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25652670
has comment: http://stackoverflow.com/comment/40092985
has answer: http://stackoverflow.com/a/25657583
has comment: http://stackoverflow.com/comment/40084689
has comment: http://stackoverflow.com/comment/40084713
has comment: http://stackoverflow.com/comment/40092572
tagged with: get
score: 0
has body: I am writing code to send get requests for a list of URLs. Now, some of the get requests are failing and not returning HTTP Response Code 200. But when I hit the URL for the get request on browser I am able to download the XML file(which is what should happen). My first question is why does this happening that when I am sending get request from my code, the request fails but it doesnot fail otherwise. My second question is how can I fix this problem of failed get requests. Please find below the code sample that I am writing in my code. URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); // optional default is GET con.setRequestMethod("GET"); //add request header con.setRequestProperty("User-Agent", USER_AGENT); int responseCode = con.getResponseCode(); System.out.println("\nSending 'GET' request to URL : " + url); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); The Exception is: Update: Response Code : 404 java.io.FileNotFoundException: http://gdata.youtube.com/feeds/api/videos/gzakooXyvuA at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at ReadMyExcel.sendGet(ReadMyExcel.java:133) at ReadMyExcel.readExcel…
type: UnansweredQuestion
tagged with: java
answer count: 1
has title: Send Multiple Get requests
type: Question

http://stackoverflow.com/comment/40075341
has text: I think the solution is in detail described here - http://stackoverflow.com/questions/8775303/read-properties-file-outside-jar-file
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25647597
type: QuestionComment

http://stackoverflow.com/a/25565491
has comment: http://stackoverflow.com/comment/39970607
upvote count: 2
has comment: http://stackoverflow.com/comment/39952705
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25554687
has body: .flatMap is for when some return value of the function you give to it returns a Promise itself. If all you do is return non-futures, then you can just use .map, so the last .flatMap does not seem to need be a .flatMap since you just wrap all the results values in Promise.pure, with .map you can just return those values without further boxing them in a Promise. The function you give to userPromise.flatMap on the other hand will return a Promise so it must be a flatMap or else it in turn will return Promise&lt;Promise&lt;Result&gt;&gt; which you cannot return from your controller action.
has comment: http://stackoverflow.com/comment/39971305
score: 2
accepted answer of: http://stackoverflow.com/q/25554687
type: Answer
has comment: http://stackoverflow.com/comment/39952904

http://stackoverflow.com/comment/40114887
score: 0
type: Comment
type: QuestionComment
has text: @ankit337 It's the strange idea that optimization problems belong to [CR](http://codereview.stackexchange.com) and whatever else belongs to [programmers](http://programmers.stackexchange.com) and whatever. It's all [BS](http://www.urbandictionary.com/define.php?term=BS) as the distinction is pretty blurred and closing/downvoting questions based on such fuzzy criteria is unfriendly to newcommers. It also leads to many border cases with endless discussions. It wouldn't be so bad, if there was a simple way to *move* the question to another site (voting for move, etc.).
comment on: http://stackoverflow.com/q/25659045

http://stackoverflow.com/comment/39950639
type: Comment
score: 0
has text: i can help you but i can not understand you, a bit not clear for me, this error cause not to show your listview in activity after that you must attach your fragment to this activity and then get it from activity.
type: QuestionComment
comment on: http://stackoverflow.com/q/25578887

java.util.scanner
tags question: http://stackoverflow.com/q/25578061
tags question: http://stackoverflow.com/q/25696219
tags question: http://stackoverflow.com/q/25701521
tags question: http://stackoverflow.com/q/25708251
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/25598525
tags question: http://stackoverflow.com/q/25574436
tags question: http://stackoverflow.com/q/25562045
tags question: http://stackoverflow.com/q/25612951
tags question: http://stackoverflow.com/q/25645351
tags question: http://stackoverflow.com/q/25672656
tags question: http://stackoverflow.com/q/25677384
tags question: http://stackoverflow.com/q/25660338
tags question: http://stackoverflow.com/q/25646835
tags question: http://stackoverflow.com/q/25702507
type: Tag
tags question: http://stackoverflow.com/q/25685111
tags question: http://stackoverflow.com/q/25583983
tags question: http://stackoverflow.com/q/25678222
tags question: http://stackoverflow.com/q/25670750
tags question: http://stackoverflow.com/q/25702124

http://stackoverflow.com/q/25648180
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/40077261
has comment: http://stackoverflow.com/comment/40076377
answer count: 2
downvote count: 2
possible better answer: http://stackoverflow.com/a/25648611
has answer: http://stackoverflow.com/a/25648495
has comment: http://stackoverflow.com/comment/40076280
has body: my code is trying to find same 3 letter on gene[] and print corresponding array on trait[]. but the "if functions tries to check if the whole array input is divisible by 3".. need help why my "if" function is not printing!!! public class HelloWorld { public static void main(String[] args) { //args example: TTTGGTGGGTTC String[] gene = {"TTT","TTC"........GGC","GGA","GGG"}; char[] trait = {'F','F','V','V'......,'E','G','G','G','G'}; String input = args[0]; int dome = input.length(); int x = 0; int z = 2; int b = 0; for (int c = 0 ; c &lt;= dome/3 ; c++){ String top = input.substring(x, z+1); while (!top.equals(gene[b]) ){ b = b + 1; } System.out.print(trait[b] + " "); x = x + 3; z = z + 3; b = 0; } if ( dome%3 == 0){ System.out.print("no excess "); }else{ System.out.print("*"); } } }
has title: if function not working on my program
has comment: http://stackoverflow.com/comment/40076658
has comment: http://stackoverflow.com/comment/40076970
favorite count: 0
has comment: http://stackoverflow.com/comment/40076366
has comment: http://stackoverflow.com/comment/40076445
type: Question
has comment: http://stackoverflow.com/comment/40076512
has answer: http://stackoverflow.com/a/25648611
score: -2
accepted answer: http://stackoverflow.com/a/25648495
has comment: http://stackoverflow.com/comment/40076587
tagged with: java
has comment: http://stackoverflow.com/comment/40077237
has comment: http://stackoverflow.com/comment/40076240

http://stackoverflow.com/q/25563604
score: 0
answer count: 2
has title: Java append to end of ArrayList in function
has comment: http://stackoverflow.com/comment/39921153
type: Question
tagged with: arraylist
has body: with this below function i can create ArrayList and append any value into that. this action is not problem but after calling that every time i can not append to end of ArrayList without clear current values of that. after each call ArrayList clear. public List&lt;ReceiveFields&gt; getReceivedSMS(long idToDown, long count) throws TException { . . . String str = WSDLHelper.call(request); String[] strings = WSDLHelper.convert2(WSDLHelper.convert1(str)); List&lt;ReceiveFields&gt; receiveArray = new ArrayList&lt;ReceiveFields&gt;(); if (strings != null) { for (int i = 0; i &lt;= strings.length - 1; i++) { String[] str1 = WSDLHelper.convert3(strings[i]); try { receiveArray.add(new ReceiveFields( Long.valueOf(str1[0]), str1[1], str1[2], URLDecoder.decode(str1[3], "UTF-8"), URLDecoder.decode(str1[4], "UTF-8"), WSDLHelper.convertDate(str1[5]))); } catch (UnsupportedEncodingException ex) { throw new TException(PublicErrorList.NOT_EXIST_ERROR_DETAIL); } } } return receiveArray; }
has comment: http://stackoverflow.com/comment/39921049
type: UnansweredQuestion
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25563702
has answer: http://stackoverflow.com/a/25563800
has comment: http://stackoverflow.com/comment/39921234
has comment: http://stackoverflow.com/comment/39921167

http://stackoverflow.com/a/25700998
type: Answer
accepted answer of: http://stackoverflow.com/q/25700059
has comment: http://stackoverflow.com/comment/58246523
upvote count: 22
answers question: http://stackoverflow.com/q/25700059
type: AcceptedAnswer
downvote count: 1
has body: As noted in another answer, if you don't care about the order, you might do best to change the interface so it doesn't care about the order. If order matters in the code but not in a specific test, you can use the ArgumentCaptor as you did. It clutters the code a bit. If this is something you might do in multiple tests, you might do better to use appropriate Mockito Matchers or Hamcrest Matchers, or roll your own (if you don't find one that fills the need). A hamcrest matcher might be best as it can be used in other contexts besides mockito. For this example you could create a hamcrest matcher as follows: import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.hamcrest.Matcher; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; public class MyMatchers { public static &lt;T&gt; Matcher&lt;List&lt;T&gt;&gt; sameAsSet(final List&lt;T&gt; expectedList) { return new BaseMatcher&lt;List&lt;T&gt;&gt;(){ @Override public boolean matches(Object o) { List&lt;T&gt; actualList = Collections.EMPTY_LIST; try { actualList = (List&lt;T&gt;) o; } catch (ClassCastException e) { return false; } Set&lt;T&gt; expectedSet = new HashSet&lt;T&gt;(expectedList); Set&lt;T&gt; actualSet = new HashSet&lt;T&gt;(actualList); return actualSet.equals(expectedSet); } @Override public void describeTo(Description description) { description.appendText("should contain all and only elements of ").appendValue(expectedList); } }; } } And then the verify code becomes: verify(mockClassB).sendEvent(argThat(MyMatchers.sameAsSet(expectedFileList))); If you instead created a mockito matcher, you wouldn't need the argThat, which basically wraps a hamcrest matcher in a mockito matcher. This moves the logic of sorting or converting to set out of your test and makes it reusable.
has comment: http://stackoverflow.com/comment/40211235
score: 21

http://stackoverflow.com/comment/39969455
comment on: http://stackoverflow.com/q/25589521
has text: What does `System.out.println("test readLine: " + readLine);` print? (In other words, we need more information about what the output is and what error you're getting
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39939035
has text: Hmm, pesky... Is Apache POI able to read the file generated without errors? Can it see the table? And how about Open Office - does that tolerate the file + see the table, or does it join Excel in complaining?
comment on: http://stackoverflow.com/q/25570731
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/25682020
tagged with: java
linked to: http://stackoverflow.com/q/1252965
downvote count: 0
answer count: 1
favorite count: 0
type: Question
has title: Jython, how to get the base path of the jar a script is in?
tagged with: jython
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25686181
tagged with: jar
upvote count: 1
tagged with: python
has body: I’ve packaged some python scripts in a jar using the method described here: Distributing my Python scripts as JAR files with Jython? This worked fine, but I’m having trouble getting to the base path of the jar my script is in. At the moment, the workaround I’ve found was to cd to the directory the jar is in and retrieve the path with os.getcwd(). Using os.path.realpath(__file__) gives me /path/to/jar/myapplication.jar/Lib/module/file.py. Is there a variable like __file__ that would give me /path/to/jar/myapplication.jar instead ? The reason is I have some configuration file externalized that I would like to retrieve based on a relative path to my application.
score: 1

http://stackoverflow.com/q/25643551
answer count: 1
type: Question
tagged with: gridview
has answer: http://stackoverflow.com/a/25654804
tagged with: bounce
type: UnansweredQuestion
has body: I have a GridView in my project using the StaggeredGridView (https://github.com/etsy/AndroidStaggeredGrid). Every item is composed by a ImageView and a TextView and the height of the differents ImageViews change from one to the other. The problem comes when scrolling back to the top, because of the view recycling, when the images re-loads, because of having different heights, the StaggeredGridView 'bounces' a bit and its quite annoying. I'm trying to remove the bouncing, just like Pinterest's or Etsy's app does (those don't bounce at all and seem to keep the aspect ratio in memory). I've but i didnt manage to figure out how. Here is some code: GridItemAdaptem @Override public View getView(final int position, View convertView, final ViewGroup parent) { final Holder holder; if( convertView!=null ){ holder = (Holder) convertView.getTag(); } else { LayoutInflater inflater = ((Activity) context).getLayoutInflater(); convertView = inflater.inflate( R.layout._grid_guide_item, parent, false ); holder = new Holder( convertView ); convertView.setTag(holder); } final Guide guide = this.guides.get(position); holder.pic.post(new Runnable() { @Override public void run() { try { int height = Integer.parseInt( guide.getCover().getHeight() ) * holder.pic.getWidth() / Integer.parseInt(guide.getCover().getWidth()); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( holder.pic.getWidth(), height ); holder.pic.setScaleType(ImageView.ScaleType.FIT_XY); holder.pic.setLayoutParams(params); ImageAware imageAware = new ImageViewAware( holder.pic, true); imageLoader.displayImage( FavoAPI.getImageURL( guide.getCoverId() ), imageAware ); } catch (NotCoverException ignored) {} } } ); holder.name.setText( guide.getName() ); holder.user.setText( Finals.AUTHOR + guide.getOwner().getFull_name() ); return convertView; } static class Holder { @InjectView( R.id._grid_item_user ) TextView user; @InjectView( R.id._grid_item_name ) TextView name; @InjectView( R.id._grid_item_pic) RoundedCor…
tagged with: adapter
has title: Android GridView. Avoid bounce/bumps while scrolling
score: 0
tagged with: android
tagged with: java

http://stackoverflow.com/q/25613642
has answer: http://stackoverflow.com/a/25614462
accepted answer: http://stackoverflow.com/a/25613713
has answer: http://stackoverflow.com/a/25613681
has title: Up button exits app?
has comment: http://stackoverflow.com/comment/40017642
has comment: http://stackoverflow.com/comment/40013573
has body: I'm not really sure why this is happening, however I have my Main activity, and then use an Intent to call a child activity. On this activity I have an up button, however it just exits the app for some reason. I've been staring at this for a while and maybe it just needs a fresh pair of eyes. If anyone can explain why this is happening, I'd be grateful MainActivity.java public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); CardView cardView = (CardView) findViewById(R.id.card_view); cardView.setOnClickListener(new CardView.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this, Orange.class); startActivity(intent); finish(); } }); } } Orange.java public class Orange extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.orange); getActionBar().setDisplayHomeAsUpEnabled(true); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } In my AndroidMainfest.xml I have &lt;activity android:name=".MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt;
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25613713
downvote count: 0
has answer: http://stackoverflow.com/a/25614573
score: 1
upvote count: 1
tagged with: android
tagged with: java
possible better answer: http://stackoverflow.com/a/25614462
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question

http://stackoverflow.com/q/25601958
has comment: http://stackoverflow.com/comment/39992427
type: UnansweredQuestion
score: 2
has body: I'm using ehcache 2.8.2, and I notice problems with one of my nodes failing to recover ( I have 5 or so in a test in environment ). Turning the logs down to debug level I can see that I get DEBUG (pool-4-thread-1) rmiUrl is stale. Either the remote peer is shutdown or the network connectivity has been interrupted. Will be removed from list of remote cache peers A couple of times ( once per other node ) followed by log silence until the server is cycled. I think maybe its incorrectly configured, but I can't find the relevant documentation on this section and its not obvious to me what I have to configure. Does anyone know how network reslience is handled in the configuration ? Edit : Current configuration details ( simplified ) : Ehcache : <diskStore path="/var/patelm5/cache"/> <cacheManagerEventListenerFactory class="" properties=""/> <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1, multicastGroupPort=4446"/> <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/> <defaultCache maxElementsInMemory="100" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" diskPersistent="false" diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU" /> Spring.xml <property name="cacheManager" ref="ehCacheManagerFactory" /> <property name="cacheName" ref="AVAILABILTY_MONITOR_CACHE_NAME" /> <property name="maxElementsInMemory" value="1" /> <property name="eternal" value="false" /> <property name="overflowToDisk" value="false" /> <property name="diskPersistent" value="false" /> <property name="diskExpiryThreadIntervalSeconds" value="300" /> <property name="timeToLive" value="36000" /> <property name="timeToIdle" value="36000" /> <property name="cacheEventListener" ref="defaultCacheEventListener" /> <property name="bootstrapCacheLoader" ref="bootstrapCacheLoader" /> <u…
has title: How to make ehcache reconnect with remote cache peers after network failure?
answer count: 0
upvote count: 2
tagged with: java
downvote count: 0
favorite count: 0
type: Question
tagged with: ehcache

http://stackoverflow.com/q/25608189
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
downvote count: 0
has body: I want to send Json with Jersey. I use mongoDb. My function to return my objects : public static List&lt;DBObject&gt; getAll(){ List&lt;DBObject&gt; toReturn = new ArrayList&lt;DBObject&gt;(); DBCollection coll = Db.databse.getCollection("Roles"); DBCursor cursor = coll.find(); try { while(cursor.hasNext()) { toReturn.add(cursor.next()); } } finally { cursor.close(); } return toReturn; } And my jersey method to return json : @GET @Path("/") @Produces(MediaType.APPLICATION_JSON) public Response getAll(){ return Response.status(200).entity(Role.getAll()).build(); } I use POSTMAN. POSTMAN receives 200 but not my JSON. If somebody can help me. Thx.
accepted answer: http://stackoverflow.com/a/25663085
tagged with: dbobject
favorite count: 0
has answer: http://stackoverflow.com/a/25663085
type: Question
tagged with: mongodb
tagged with: jersey
has title: Jersey : response with List<DBObject>
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/25698184
answers question: http://stackoverflow.com/q/25698140
score: 2
accepted answer of: http://stackoverflow.com/q/25698140
type: Answer
has body: You get a NullpointerException in this line: URL secondUrl = new URL(ucon.getHeaderField("Location")); because ucon.getHeaderField("Location")returns null and these NullpointerException is mapped to a MalformedURLException. Exception in thread "main" java.net.MalformedURLException at java.net.URL.&lt;init&gt;(Unknown Source) at java.net.URL.&lt;init&gt;(Unknown Source) at java.net.URL.&lt;init&gt;(Unknown Source) at Test.main(Test.java:16) Caused by: java.lang.NullPointerException ... 4 more
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40103761
type: AnswerComment
comment on: http://stackoverflow.com/a/25648169
has text: The test results mean that my code is OK and I have problems with my network connection. I wonder why there was such a big difference during tests run on same network infrastructure 2 months ago. Do you have any suggestions what could I possibly check in the logs I have to recognize the cause of limited upload speed to Google servers or should I send you the json log files? Once again thank you for help.
type: Comment
score: 0

http://stackoverflow.com/comment/40011460
has text: `ocr.setResource(I.class.getResourceAsStream(("/resource.zip"))` with the file placed as resource, not File.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25612424

http://stackoverflow.com/a/25563160
accepted answer of: http://stackoverflow.com/q/25562479
type: Answer
has body: Why your approach fails As Salinkov suggested, the jpeg format causes data compression. To summarise what you did: You loaded the image data in a byte array. You modified some of the bytes. You loaded the byte array as an image. You saved this image in jpeg format, which causes recompression. That's where your method falls apart. A lossless format will not produce these problems, which is why gif works. Or png, bmp, etc... Can you use your method for jpeg? Weeeeell, no, not really. First, we need to understand what kind of data a jpeg image holds. The short answer is that individual bytes don't correspond to actual pixels in the image. The long story is that you split the image in 8x8 arrays and take the DCT to obtain the frequency coefficients. After a quantisation step, many of them will become 0, especially the higher frequency coefficients (bottom right of the DCT array - see here). This is the lossy step of jpeg. You sacrifice higher frequency coefficients for some tolerable image distortion (loss of information). Now, what you save is the non-zero coefficients, based on their location in the matrix, i.e. (0, 0, -26), (0, 1, -3), etc. This can be further compressed with Huffman coding. By the way, changing any one frequency component affects all 64 pixels. So how is jpeg steganography normally done? It mostly follows the jpeg encoding process: Split image in 8x8 arrays. DCT each 8x8 array and quantise the coefficients. Now we have obtained the quantised DCT coefficients and we take a break from the jpeg encoding process. Apply some steganographic algorithm by changing the value of the quantised coefficients. Huffman compress the coefficients and continue with the rest of the jpeg encoding process with these modified DCT coefficients.
answers question: http://stackoverflow.com/q/25562479
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25685405
upvote count: 1
has body: I used the jndi lookup (http://logging.apache.org/log4j/2.x/manual/lookups.html#JNDILookup) in combination with property substituion (http://logging.apache.org/log4j/2.x/manual/configuration.html#PropertySubstitution) Here the extract of the tomcat context: &lt;Environment name="MongoDB.serverAddress.1.host" value="..." type="java.lang.String"/&gt; &lt;Environment name="MongoDB.serverAddress.1.port" value="..." type="java.lang.String"/&gt; &lt;Environment name="MongoDB.password" value="..." type="java.lang.String"/&gt; Here the extract of log4j2 configuration: &lt;Configuration status="warn"&gt; &lt;Properties&gt; &lt;Property name="MongoDbServer"&gt;$${jndi:MongoDB.serverAddress.1.host}:$${jndi:MongoDB.serverAddress.1.port}&lt;/Property&gt; &lt;Property name="MongoDbPassword"&gt;$${jndi:MongoDB.password}&lt;/Property&gt; &lt;/Properties&gt; &lt;Appenders&gt; &lt;NoSql name="databaseAppender"&gt; &lt;MongoDb databaseName="SISTEMA" collectionName="applicationLog" server="${MongoDbServer}" username="SISTEMA" password="${MongoDbPassword}" /&gt; &lt;/NoSql&gt; ....
answers question: http://stackoverflow.com/q/25662269
score: 1
accepted answer of: http://stackoverflow.com/q/25662269
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/25699800
has answer: http://stackoverflow.com/a/25700230
tagged with: applet
tagged with: awt
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25700230
tagged with: java
accepted answer: http://stackoverflow.com/a/25700903
tagged with: keylistener
has title: Inputting a Key during a Loop in Java applet for animation purposes
has answer: http://stackoverflow.com/a/25700903
type: Question
has comment: http://stackoverflow.com/comment/40170925
tagged with: paint
answer count: 2
has comment: http://stackoverflow.com/comment/40170426
has body: I'm learning how to make an Applet using Java in the form of a game. In the game, I have a character sprite drawn at the center and moves when the player presses w a s d. It goes like this: public game extends applet implements KeyListener { int x, y; URL url; Image image; public void init() { x = getSize().width/2; y = getSize().height/2; url = new URL(getCodeBase()); image = getImage(url, "player.gif"); //take note that this is a still image addKeyListener(this); } public void paint(Graphics g) { g.drawImage(image, x, y, 32, 32, this); //the size of the image is 32x32 } public void KeyPressed(arg0) { char c = arg0.getKeyChar(); switch(c) { case 'w': y -= 10; break; /*And so on. You guys know how it works.*/ } repaint(); } My problem is, the character sprite seems dull when the user doesn't press anything. What I want to do is to make the Image an array of images and put a simple image animation by looping the array in paint like so: public void paint(Graphics g) { for(int i = 0; ; i++) { g.drawImage(image[i], x, y, 32, 32, this); if(i == image.size() - 1) { i = 0;} } } However, if I do this, I won't be able to get anymore KeyEvents that would activate when the user wants to move. My question is this: How will I make it so that my character does an animation when the program is "idle" (i.e. the user isn't pressing anything) while still maintaining the capability to take in KeyEvents (e.g. moving when the player types in w, a, s, or d, and then continuing the idle animation after repainting)? Thanks in advance. PS. I'm still quite a beginner in Java so sorry if my code is not very nice. Any advice is welcome.

http://stackoverflow.com/a/25592394
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/25592125
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/39975004
has body: But there is a specific call to this method, only it's not occurring in your code but rather in the JVM. A button push instigates internal events that leads the JVM to tell the button to notify all of its listeners that it has been pushed. This will cause the actionPerformed methods of all attached ActionListeners to be called. To see information on how this works, first look at the Java API for the AbstractButton class where you'll find the method protected void fireActionPerformed(ActionEvent event) Where Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the event parameter. Then for further information, you will want to go beyond the Java API to the source code which can be found here. If you check out the Java 8.0 source code there, and look up javax then swing, then AbstractButton, you'll find a fireActionPerformed(ActionEvent event) method: 2002 protected void More ...fireActionPerformed(ActionEvent event) { 2003 // Guaranteed to return a non-null array 2004 Object[] listeners = listenerList.getListenerList(); 2005 ActionEvent e = null; 2006 // Process the listeners last to first, notifying 2007 // those that are interested in this event 2008 for (int i = listeners.length-2; i&gt;=0; i-=2) { 2009 if (listeners[i]==ActionListener.class) { 2010 // Lazily create the event: 2011 if (e == null) { 2012 String actionCommand = event.getActionCommand(); 2013 if(actionCommand == null) { 2014 actionCommand = getActionCommand(); 2015 } 2016 e = new ActionEvent(AbstractButton.this, 2017 ActionEvent.ACTION_PERFORMED, 2018 actionCommand, 2019 event.getWhen(), 2020 event.getModifiers()); 2021 } 2022 ((ActionListener)listeners[i+1]).actionPerformed(e); 2023 } 2024 } 2025 }
has comment: http://stackoverflow.com/comment/70376817

http://stackoverflow.com/a/25594234
type: Answer
answers question: http://stackoverflow.com/q/25589152
score: 2
has body: It appears that something was messed up in importing the project. I made a new project and just copied everything over and it worked perfectly. Importing was making it where the jar files could not be found. Not sure why.... Thanks for the help everyone!
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/25571309
has comment: http://stackoverflow.com/comment/39935805
has title: Eclipse Android Exception : NullPointerException throws in SharedPreferences
has comment: http://stackoverflow.com/comment/39936259
type: Question
has comment: http://stackoverflow.com/comment/39935843
has comment: http://stackoverflow.com/comment/39936202
answer count: 0
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39935864
has comment: http://stackoverflow.com/comment/39936132
tagged with: gps
has comment: http://stackoverflow.com/comment/39935879
has body: I created this application with the help of a tutorial to get the gps cordinates to my app. This is my problem I have used SharedPreferences to set the values when user enters. In this code i get the previous values (gps updates and maximum run time of the app) and compare them with some conditions and set new user inputs if valid. but here I get NullPointerException in this code. import android.content.SharedPreferences; import android.os.Bundle; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import android.util.Log; import android.widget.Toast; public class LocationGPSTrackerPrefs extends PreferenceActivity { @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // addPreferencesFromResource(R.xml.preferences); Preference pref; Log.d("LocationGPSTrackerPrefs", " works "); pref = findPreference("pref_gps_updates"); // gps updated pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); int oldValue = Integer.parseInt(preferences.getString("pref_gps_updates", "0")); if (newValue == null || newValue.toString().length() == 0 || Integer.parseInt(newValue.toString()) &lt; 30) { Toast.makeText(getApplicationContext(), getString(R.string.pref_gps_updates_too_low), Toast.LENGTH_SHORT).show(); return false; } else if (LocationGPSTrackerService.isRunning &amp;&amp; Integer.parseInt(newValue.toString()) != oldValue) { Toast.makeText(getApplicationContext(), getString(R.string.toast_prefs_restart), Toast.LENGTH_LONG).show(); } return true; } }); pref = findPreference("pref_max_run_time"); // change run time pref.setOnPreferenceChangeListener(new OnPreferenceCh…
has comment: http://stackoverflow.com/comment/39936049
has comment: http://stackoverflow.com/comment/39936007
has comment: http://stackoverflow.com/comment/39935954
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39936767

http://stackoverflow.com/comment/39953334
has text: I don't have enough rep (currently 614) but yeah, I will edit things like this when I have enough.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25580572
type: Comment

http://stackoverflow.com/comment/40123568
comment on: http://stackoverflow.com/a/25673768
type: Comment
has text: tried this - it seems like my server is now listening on the port. However, I keep getting this message: INFO: Configuring Hazelcast from ....
score: 0
type: AnswerComment

http://stackoverflow.com/q/25600689
upvote count: 1
has comment: http://stackoverflow.com/comment/39989971
has answer: http://stackoverflow.com/a/25600725
accepted answer: http://stackoverflow.com/a/25600725
tagged with: eclipse-kepler
favorite count: 0
has comment: http://stackoverflow.com/comment/39990275
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39990064
tagged with: spring-tool-suite
has answer: http://stackoverflow.com/a/25600865
possible better answer: http://stackoverflow.com/a/25600865
tagged with: eclipse
type: Question
answer count: 2
tagged with: dead-code
has body: I'm using Eclipse 4.3 Kepler (actually STS 3.6.1). I ran into some code: private String someMethod(String myParam) { try { MyInterface myVar = (MyInterface) domeSomething(myParam); if (myVar != null) { return myVar.methodThatReturnsString(); } } catch (Exception e) { return ""; } return ""; // eclipse marks this as dead code } (As you'd expect, the doSomething() method throws some exception, and it returns an interface more general than MyInterface.) Eclipse underlines the last return statement as dead code, and if I remove it as the quickfix suggests, I and up with the "This method should return a result of type String" error. Why is the last return statement dead code? Is it because of the class cast? Say that doSomething() could return null, if you cast it, would that throw a class cast exception? And, why does Eclipse suggest that I fix the error with something that leads to a dead code warning? Is it because Eclipse can't predict this?
downvote count: 0
has title: Removing dead code leads to error

http://stackoverflow.com/comment/40143305
has text: that makes sense. though, i don't know if i have had one instance where I "accidentally re-used" a field.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25668168

http://stackoverflow.com/a/25590049
has comment: http://stackoverflow.com/comment/39971177
has comment: http://stackoverflow.com/comment/39973342
type: Answer
has comment: http://stackoverflow.com/comment/39971435
score: 0
has body: the problem is that you read whole lines from the stream... try reading int values, because it's not guaranteed to return a whole line... int sign = 0; while(sign != -1){ sign = process.getInputStream().read(); char c = (char)sign; System.out.print(""+c); } i have this answer from http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html#start%28%29
has comment: http://stackoverflow.com/comment/39970662
answers question: http://stackoverflow.com/q/25589938
has comment: http://stackoverflow.com/comment/39971550
has comment: http://stackoverflow.com/comment/39970573

http://stackoverflow.com/comment/40103243
comment on: http://stackoverflow.com/a/25660949
type: Comment
type: AnswerComment
score: 0
has text: Thank you for your help, the problem was solved after changing getText with getAttribute. and also with removing else block.

http://stackoverflow.com/q/25570583
has body: In our AppServer we are seeing threadcount exceeding its JMX thread count threshold (Max = 500, Actual = 595). I see there are no deadlocks. I have taken a thread dump and see that out of the 595 threads, majority of them fall in 2 categories: 1) 234 threads in Timed Waiting (Thread Dump shown below) "Timer-232" daemon prio=10 tid=0x00007f46c85cd000 nid=0x7b06 in Object.wait() [0x00007f4668001000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on &lt;0x000000075246c498&gt; (a java.util.TaskQueue) at java.util.TimerThread.mainLoop(Timer.java:509) - locked &lt;0x000000075246c498&gt; (a java.util.TaskQueue) at java.util.TimerThread.run(Timer.java:462) 2) 233 threads in Waiting state (Thread Dump shown below). I guess this is the culprit being blocked on a queue, specifically Delay queue. "AsyncHttpClient-Reaper" daemon prio=10 tid=0x00007f469cd4c000 nid=0x7b09 waiting on condition [0x00007f4667cfe000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for &lt;0x00000007524a2908&gt; (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1987) at java.util.concurrent.DelayQueue.take(DelayQueue.java:160) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:609) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:602) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:662) Can you please help me understand what is causing the threads to exceed JMX threshold? Its the first time I am working with thread scenario and henc…
favorite count: 0
has comment: http://stackoverflow.com/comment/39934427
has comment: http://stackoverflow.com/comment/39934405
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39947583
has comment: http://stackoverflow.com/comment/40043171
has title: Too many threads running
answer count: 2
has answer: http://stackoverflow.com/a/25577353
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
downvote count: 0
has answer: http://stackoverflow.com/a/25570662

http://stackoverflow.com/comment/40036548
comment on: http://stackoverflow.com/q/25625304
type: QuestionComment
type: Comment
score: 0
has text: Yes, unfortunatelly I have to end this migration in two weeks and I don't think I can migrate the full Jboss to higher version.

http://stackoverflow.com/a/54169035
score: 4
has body: In the maven-assembly-plugin, you define the name of the .war file (I called it ROOT because it´s the main application) and the phase when the plugin should be executed. The appendAssemblyId property defines if "-war" should be appended to the file name (e.g. "ROOT-war.war"). org.apache.maven.plugins maven-assembly-plugin 3.1.1 war-assembly.xml ROOT false package single The structure of the resulting .war file needs to be configured in a separate xml file which is called "web-assembly.xml" (you can specify any name). In this descriptor file, the files and directories and the corresponding output directory in the .war file needs to be specified. war war false WEB-INF/lib *:war ${project.build.directory}/classes WEB-INF/classes /**/* ... The maven-assembly-plugin gives you a great flexibility of how to structure your output artifact. But you also need to copy dependencies, class files and resources separately which can be quite complex. The maven-war-plugin does all of this for you.
downvote count: 0
answers question: http://stackoverflow.com/q/25662048
upvote count: 4
type: Answer

http://stackoverflow.com/comment/40173230
comment on: http://stackoverflow.com/a/25701480
has text: Okay that means we can make our class as implicit compile
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25559341
type: Question
has comment: http://stackoverflow.com/comment/39913374
type: UnansweredQuestion
has title: How to do a Join Query on a Mysql fetch in JPQL
score: 0
has body: I have a table Users Id(key) | username | some other cols...n and a table Tokens: userID, Token (k) userID in Tokens is defined as being the foreign key from users.id. What i want to do is to be able to : Given a Tokens.token, get the col info from Users. the mysql command in SQL is like such: select a.* from users a left join tokens b on a.User_Id = b.userId and b.userId = 1; (i dont know if the above is optimal...but it returns what i want) How would i replicate that in JPQL? The simple select fetch command i am familar with is: (other than using the built in one) String qlString = "Select p from Tokens p WHERE p.token=:token"; TypedQuery&lt;Tokens&gt; query = this.entityManager.createQuery(qlString,Tokens.class).setParameter("token", token);
tagged with: sql
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25560778
answer count: 1
tagged with: mysql
has comment: http://stackoverflow.com/comment/39915786
tagged with: jpql

listview
tags question: http://stackoverflow.com/q/25668627
tags question: http://stackoverflow.com/q/25653407
tags question: http://stackoverflow.com/q/25583678
tags question: http://stackoverflow.com/q/25657845
tags question: http://stackoverflow.com/q/25640835
tags question: http://stackoverflow.com/q/25568221
tags question: http://stackoverflow.com/q/25670028
tags question: http://stackoverflow.com/q/25677652
tag name: listview
tags question: http://stackoverflow.com/q/25644862
tags question: http://stackoverflow.com/q/25673466
tags question: http://stackoverflow.com/q/25591514
tags question: http://stackoverflow.com/q/25604978
tags question: http://stackoverflow.com/q/25661853
tags question: http://stackoverflow.com/q/25705449
tags question: http://stackoverflow.com/q/25562040
tags question: http://stackoverflow.com/q/25581185
tags question: http://stackoverflow.com/q/25634586
tags question: http://stackoverflow.com/q/25645581
tags question: http://stackoverflow.com/q/25579918
tags question: http://stackoverflow.com/q/25703286
tags question: http://stackoverflow.com/q/25652255
type: Tag
tags question: http://stackoverflow.com/q/25610279
tags question: http://stackoverflow.com/q/25674599
tags question: http://stackoverflow.com/q/25712136
tags question: http://stackoverflow.com/q/25599998
tags question: http://stackoverflow.com/q/25590139

http://stackoverflow.com/a/25678189
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: if you want to generate a random string then you can use: (here i have included numbers also in my random string generation, if you dont want to use numbers then you can remove from sample variable) public String getRandomString(String prefix, int length) { String sample = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; Random random = new Random(); StringBuilder sb = new StringBuilder(); sb.append(prefix); for (int index = 0; index &lt; length; index++) { sb.append(sample.charAt(random.nextInt(sample.length()))); } return sb.toString(); }
answers question: http://stackoverflow.com/q/25677824

http://stackoverflow.com/a/25567219
has comment: http://stackoverflow.com/comment/39932666
has comment: http://stackoverflow.com/comment/39932094
has comment: http://stackoverflow.com/comment/39930564
score: 3
has body: Yes, it was an old verifier bug. It looks like it was this one: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4007892 It is not clear from the (public) bug history exactly when it was fixed, but I suspect that it was fixed a long time ago. If it's a bug, and what does it have to do with bytecode verifier The bytecode verifier should check that a class doesn't attempt to reference private fields of another class. This check is supposed to happen when the classes are loaded by the JVM.
type: Answer
has comment: http://stackoverflow.com/comment/39958480
accepted answer of: http://stackoverflow.com/q/25564460
answers question: http://stackoverflow.com/q/25564460
has comment: http://stackoverflow.com/comment/39931489
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40111595
has text: I am not going to be managing 3 HttpClient objects. My thread function will have only 1 HttpClient object. However more than 1 thread would be running at a time.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25667570
score: 0

http://stackoverflow.com/q/25669531
tagged with: hbase
score: 1
tagged with: bigdata
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
tagged with: java
has body: In Eclipse I add external libraries from three directories. The lib directory from hadoop, the same from hbase and two local directories from my Eclipse project with other jars. When executing the exported jar file I get out a ClassNotFoundException related with hbase. I'm sure that is a problem with my external libraries. I execute the program just like that: hadoop jar /home/brunneis/Escritorio/mr.jar Principal -libjars /bigdata/hbase/lib/*.jar,/home/brunneis/workspace/MapReduce/lib/*.jar,/home/brunneis/workspaces/MapReduce/lib1.1.2/*.jar At the hadoop-env.sh file I also added this line: export HADOOP_CLASSPATH="/bigdata/hbase/lib/*.jar;/home/brunneis/workspace/MapReduce/lib/*.jar;/home/brunneis/workspace/MapReduce/lib1.1.2/*.jar" And this is what I get: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration at Principal.main(Principal.java:27) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.RunJar.main(RunJar.java:160) Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 6 more Thank you so much.
tagged with: mapreduce
has title: Hadoop MapReduce program runs fine in Eclipse but not when exported to .jar file
accepted answer: http://stackoverflow.com/a/25677659
tagged with: hadoop
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20425219
has answer: http://stackoverflow.com/a/25677659

http://stackoverflow.com/a/25632582
has body: Use following as your string contains colon (:), comma(,) and spaces (\s): There is no Use of wordDelRegEx variable: String leftRegEx = "([\\w\\s,:]{" + nLeft + "})"; String rightRegEx = "([\\w\\s,:]{" + nRight + "})"; //matches something like: aaaaaaa email@gmail.com bbbbbbbbbb String contextRe =leftRegEx+ email +rightRegEx;
accepted answer of: http://stackoverflow.com/q/25631530
has comment: http://stackoverflow.com/comment/40058453
has comment: http://stackoverflow.com/comment/40069359
type: Answer
answers question: http://stackoverflow.com/q/25631530
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/40086221
score: 0
type: AnswerComment
has text: @isakkarlsson: must've definitely been a bug then. Thankfully, the most recent version of javac (1.8.0_20) fixes it.
comment on: http://stackoverflow.com/a/25653301
type: Comment

http://stackoverflow.com/comment/40100814
score: 0
comment on: http://stackoverflow.com/q/25661334
type: QuestionComment
has text: I use Eclipse Luna 4.4.0 its strange that there are 2 ways to clean an projekt that do different things.
type: Comment

http://stackoverflow.com/comment/39987992
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25599648
has text: it returns windows 8.1 in windows and returns linux in centOS(linux)
type: QuestionComment

http://stackoverflow.com/a/25657877
has comment: http://stackoverflow.com/comment/40175748
has comment: http://stackoverflow.com/comment/40095297
has body: Final fields make OneValueCache immutable, thereby making it thread safe. They also have special semantics defined by the JLS, in particular, any thread will be able to see the correctly constructed object with the final fields initialized to its only correct value. If this was not the case, and the fields happened to not be final, other threads might not be able to see the changes, even made in the constructor, because without final fields, there are no construction safety guarantees. JCIP explains that OneValueCache is only an immutable reference class used to hold to the two bits of data. This is safer than updating two fields in the method, as it is not atomic. Then, OneValueCache is made volatile in the servlet because it needs to be changed, but is an atomic assignment, so no synchronization is needed.
downvote count: 0
answers question: http://stackoverflow.com/q/25657770
score: 5
has comment: http://stackoverflow.com/comment/40094290
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/40174513
has comment: http://stackoverflow.com/comment/40108840
has comment: http://stackoverflow.com/comment/40094312

http://stackoverflow.com/comment/40154231
comment on: http://stackoverflow.com/a/25690892
type: Comment
score: 0
type: AnswerComment
has text: nope... there is only one extra element (title) in XML which is website title that is why it messing up the out put...at start of XLM there is an extra title tag.... any solution for that?

http://stackoverflow.com/comment/40177624
comment on: http://stackoverflow.com/q/25703840
score: 1
type: QuestionComment
has text: Generally speaking - passing things around as parameters (a-la dependency injection) rather than referring to them as global variables is preferable and you should consider doing that instead. Mutable global state is really hard to debug and reason about.
type: Comment

http://stackoverflow.com/q/25601448
favorite count: 0
has answer: http://stackoverflow.com/a/25602210
score: 8
upvote count: 8
type: Question
has title: JavaFx Set Tableview Cell Background Color Dynamically
tagged with: java
accepted answer: http://stackoverflow.com/a/25602210
tagged with: javafx-2
type: AnsweredQuestion
has body: I want to add color to the color cell of the rows dynamically when ADD button is clicked. I am not able to change the background color of the cell. Please see the image for reference. Am not able to achieve that with the help of code. Thanks for help in advance. Snippet adding values to table : @FXML private void addEntity() { data.add(new Inventory(codeTemp.getText(), articleNameTemp.getText(), Integer.parseInt(amountTemp.getText()), dcTemp.isSelected() ? true:false, stTemp.isSelected()?true:false, Utilities.toRGBCode(colorTemp.getValue()), informationTemp.getText(), data.size()+1)); inventoryTable.setItems(data); }
downvote count: 0
answer count: 1

http://stackoverflow.com/q/25572376
answer count: 1
has comment: http://stackoverflow.com/comment/39938548
type: Question
has comment: http://stackoverflow.com/comment/39938100
has answer: http://stackoverflow.com/a/25573555
type: UnansweredQuestion
tagged with: java
has body: I have to implemented a table with the help of LinkedHashMap which has 1000000 rows and 450 column. I have done this using nested the LinkedHashMap. First I hash to a row and then column to find a particular cell. My has values are Strings. Main problem is that it's running two slow and taking too much memory. Is there any alternative way to solve implement this. Here is the code that I have implemeted.. public LinkedHashMap&lt;String,Row&gt; transitionTable; // This class represent the one Row of Transition Table public class Row implements Cloneable{ // This represent the tagCount of a Row LinkedHashMap&lt;String,Float&gt; tagCount; float totalOccurance=0f; //Constructor public Row() { tagCount=new LinkedHashMap&lt;String,Float&gt;(); } // Method used to do cloning of public Object Clone() throws CloneNotSupportedException { Row row=new Row(); row.tagCount = (LinkedHashMap&lt;String, Float&gt;)this.tagCount.clone(); return row; } } Please help!!!
has comment: http://stackoverflow.com/comment/39943239
has comment: http://stackoverflow.com/comment/39938338
has title: Nested LinkedHashMap with large data is too slow
tagged with: optimization
has comment: http://stackoverflow.com/comment/39938067
score: 0

http://stackoverflow.com/q/25580041
tagged with: netbeans-platform
type: UnansweredQuestion
tagged with: memory-leaks
answer count: 0
score: 1
tagged with: java
has title: Interpret Profiler output for Out Of Memory:PermGen Space Error
tagged with: profiling
has body: I am working on a Netbeans Platform module (jMonkeyEngine plugin to be precise) in which I have used a JavaFX to build the UI a JFXPanel in the TopComponent displays the Javafx content. I have created a new Netbeans FileType and the JavaFX UI is used to modify the contents of the DataObject associated with the FileType. Recently my application has started crashing due to Out Of Memory : Permgen Space error and I cannot pinpoint the exact code causing it primarily as the stack trace points to a different thread and line of code each time this happens. I tried increasing my PermGen space to 1 gb using the -XX:MaxPermSize=1g command line switch but it did not fix the issue. So, I profiled my application using Netbeans Profiler to find any memory leaks but I am completely new to analysing the profiler output/heap dumps. As mentioned, each time the error occurs, the stack trace and heap dumps point to a different thread and a different line of code (sometimes the one's I wrote for the plugin and other times those provided via Netbeans Platform API's). The only thing common in all the heap dump analysis is that there is a sudden increase in the difference between the heap size and used heap space in the VM Telemetry graphs and the 'Time Spent in GC' immediately rises to 100% from being 0-3%. Here are some screenshots : screenshot 1, screenshot 2 You can also see that heap size(red region in the leftmost telemetry graph ) rises to max value specified in the -XX:MaxPermSize when the application crashes. Does this mean that there is a memory leak in the application?? If so, how can I detect it as the source of the error is different each time it occurs?? Here are the command line switched I am using : -J-Xms32m -J-Xmx256m -J-XX:PermSize=512m -J-XX:MaxPermSize=1g -J-XX:MaxDirectMemorySize=2048m.
downvote count: 0
upvote count: 1
tagged with: jmonkeyengine
favorite count: 0
type: Question

http://stackoverflow.com/comment/39926114
type: Comment
type: QuestionComment
score: 0
has text: You should **never ever** write code like this, and **never ever** need to read it. So you could argue that knowing the solution is ... pointless.
comment on: http://stackoverflow.com/q/25566230

http://stackoverflow.com/a/25572473
score: 5
answers question: http://stackoverflow.com/q/25567806
type: AcceptedAnswer
downvote count: 0
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/25567806
has body: The jersey-spring3 extension is not a stand-alone Dependency Injection feature, it's just an extension which makes Jersey aware of Spring's managed beans. From Jersey - Spring DI: Jersey provides an extension to support Spring DI. This enables Jersey to use Spring beans as JAX-RS components (e.g. resources and providers) and also allows Spring to inject into Jersey managed components. ... The above module does not add any transitive dependency to Spring modules, so you will need to add Spring 3 dependencies explicitly into your dependency list. So if you want to use Jersey with Spring you need jersey-spring3 and all the Spring dependencies you normally use. By the way, the jersey-spring3 extension is compiled against Spring 3, but should work with Spring 4. See Using Jersey-spring with Spring 4.0 for reference.

http://stackoverflow.com/a/25605813
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25605676
has body: A layout deals with the user interface. Its where you set all your views that will be visible on the user interface. The code behind (.java) sets the layout you created as the content view and manipulates the behavior of the views you have set. For example, sets the text for a text view. The activity then is the whole thing, the layout and the code behind.
downvote count: 0
type: Answer
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/25605676

http://stackoverflow.com/comment/40028274
type: Comment
comment on: http://stackoverflow.com/a/25621193
type: AnswerComment
has text: Use mUserAgeRetrieved.setText(String.valueOf(objects.get(i).getInt("UserAge")));
score: 1

http://stackoverflow.com/a/25705329
type: Answer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25705252
score: 1
has body: Make sure if in directory res/values/strings.xml there exists a string named "leaderboard_id" something like WriteYourId It seems that right now there is nothing named "leaderboard_id" in your strings.xml which causes the error.

servlets
tags question: http://stackoverflow.com/q/25555541
tags question: http://stackoverflow.com/q/25571343
tags question: http://stackoverflow.com/q/25589152
tags question: http://stackoverflow.com/q/25674159
tags question: http://stackoverflow.com/q/25615874
tags question: http://stackoverflow.com/q/25626755
tags question: http://stackoverflow.com/q/25710365
tags question: http://stackoverflow.com/q/25638500
tags question: http://stackoverflow.com/q/25560742
tags question: http://stackoverflow.com/q/25567639
tags question: http://stackoverflow.com/q/25626986
tags question: http://stackoverflow.com/q/25587654
tags question: http://stackoverflow.com/q/25569415
tags question: http://stackoverflow.com/q/25554452
tags question: http://stackoverflow.com/q/25552727
tags question: http://stackoverflow.com/q/25586490
tags question: http://stackoverflow.com/q/25712859
tags question: http://stackoverflow.com/q/25594066
tags question: http://stackoverflow.com/q/25626750
tags question: http://stackoverflow.com/q/25568688
tags question: http://stackoverflow.com/q/25641964
tags question: http://stackoverflow.com/q/25625641
tags question: http://stackoverflow.com/q/25642159
tags question: http://stackoverflow.com/q/25702939
tags question: http://stackoverflow.com/q/25554379
tags question: http://stackoverflow.com/q/25561515
tags question: http://stackoverflow.com/q/25635604
tags question: http://stackoverflow.com/q/25644120
tags question: http://stackoverflow.com/q/25608493
tags question: http://stackoverflow.com/q/25553881
tags question: http://stackoverflow.com/q/25697916
tags question: http://stackoverflow.com/q/25680371
tags question: http://stackoverflow.com/q/25674206
tags question: http://stackoverflow.com/q/25699923
tags question: http://stackoverflow.com/q/25573245
tags question: http://stackoverflow.com/q/25653935
tags question: http://stackoverflow.com/q/25690010
tags question: http://stackoverflow.com/q/25682302
tag name: servlets
tags question: http://stackoverflow.com/q/25611144
tags question: http://stackoverflow.com/q/25625429
tags question: http://stackoverflow.com/q/25628601
tags question: http://stackoverflow.com/q/25598409
tags question: http://stackoverflow.com/q/25695518
tags question: http://stackoverflow.com/q/25691185
tags question: http://stackoverflow.com/q/25605727
tags question: http://stackoverflow.com/q/25587763
tags question: http://stackoverflow.com/q/25637417
tags question: http://stackoverflow.com/q/25609856
tags question: http://stackoverflow.com/q/25611753
tags question: http://stackoverflow.com/q/25606592
type: Tag
tags question: http://stackoverflow.com/q/25610636
tags question: http://stackoverflow.com/q/25563328
tags question: http://stackoverflow.com/q/25677974
tags question: http://stackoverflow.com/q/25711726
tags question: http://stackoverflow.com/q/25648492
tags question: http://stackoverflow.com/q/25576815
tags question: http://stackoverflow.com/q/25552450
tags question: http://stackoverflow.com/q/25602207
tags question: http://stackoverflow.com/q/25706370
tags question: http://stackoverflow.com/q/25610793
tags question: http://stackoverflow.com/q/25618470
tags question: http://stackoverflow.com/q/25593717
tags question: http://stackoverflow.com/q/25656007
tags question: http://stackoverflow.com/q/25635813
tags question: http://stackoverflow.com/q/25652969
tags question: http://stackoverflow.com/q/25552491
tags question: http://stackoverflow.com/q/25669682
tags question: http://stackoverflow.com/q/25601119
tags question: http://stackoverflow.com/q/25554021
tags question: http://stackoverflow.com/q/25595497
tags question: http://stackoverflow.com/q/25573977
tags question: http://stackoverflow.com/q/25572667
tags question: http://stackoverflow.com/q/25580862
tags question: http://stackoverflow.com/q/25670581
tags question: http://stackoverflow.com/q/25622625
tags question: http://stackoverflow.com/q/25680401
tags question: http://stackoverflow.com/q/25604094
tags question: http://stackoverflow.com/q/25673761

http://stackoverflow.com/q/25711431
has answer: http://stackoverflow.com/a/25711750
downvote count: 0
upvote count: 1
has body: I am creating a new Android app, but it crashes on startup (phone and emulator). Here is the code: Arcig Manifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.tona.arcig" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="17" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Strings.xml <?xml version="1.0" encoding="utf-8"?> Suplování Rozvrh hodin Přihlašování do systému Email Moodle KDM O Aplikaci Arcig.CZ activity_main.xml <ImageButton android:id="@+id/imageButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="2" android:contentDescription="@string/suplovani" android:src="@drawable/suplovani" /> <ImageButton android:id="@+id/imageButton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="2" android:contentDescription="@string/rozvrh" android:src="@drawable/rozvrh" /> <ImageButton android:id="@+id/imageButton3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="2" android:contentDescription="@string/prihlasovani" android:src="@drawable/prihlasovani" /> <ImageButton android:id="@+id/imageButton4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="2" android:contentDescription="@string/email" android:src="@drawable/email" /> <ImageButton android:id="@+id/imageButton5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="2" android:contentDescription="@string/email" android:src="@drawable/moodle" /> <ImageButton android:id="@+id/imageButton6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="2" android:contentDescription="@string/kdm" android:src="@drawable/jidelna" /> <ImageButton android:…
possible better answer: http://stackoverflow.com/a/25711750
type: AnsweredQuestion
has title: Simple android app crashes on startup
tagged with: android
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25711779
has comment: http://stackoverflow.com/comment/40191921
has comment: http://stackoverflow.com/comment/40191543
has answer: http://stackoverflow.com/a/25711779
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: startup
type: Question
linked to: http://stackoverflow.com/q/23353173
tagged with: crash
answer count: 2

http://stackoverflow.com/comment/39914231
has text: q and a are supposed to have types in the argument of the method.
score: 4
type: Comment
comment on: http://stackoverflow.com/q/25559850
type: QuestionComment

http://stackoverflow.com/q/25584087
has title: How to format cell as currency using Apache POI
linked to: http://stackoverflow.com/q/319438
accepted answer: http://stackoverflow.com/a/25584166
type: AnsweredQuestion
has body: I have started learning Apache POI and want to format a cell like this $ 1,200.00 $ 12,500.00 How to do this? Thank.
tagged with: apache-poi
duplicate of: http://stackoverflow.com/q/319438
tagged with: java
answer count: 1
downvote count: 0
score: 1
upvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25584166

http://stackoverflow.com/a/25628905
score: 0
has body: Before understanding above concept you need to note few things : equals() method is defined in Object class, and any class can override it. By default equals() method use memory address of objects to compare them. So, if you do not overriding it then it will call Object's method. String class has overridden version of equals() method. Now come on your program : In first print statement you are comparing two different object which has not overridden equals() method, so it use Object's method and obviously it check memory address which is different. In second print statement two reference variable refer same object so its address are same and equals() method return true. In other print statements for string, which has overridden equals() method, so it will check only actual (here string value) content of object it doesn't matter two String reference variable referring same object or different.
answers question: http://stackoverflow.com/q/25627993
type: Answer

http://stackoverflow.com/a/25579411
has comment: http://stackoverflow.com/comment/39951411
answers question: http://stackoverflow.com/q/25579273
score: 5
has comment: http://stackoverflow.com/comment/39951274
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/39951462
accepted answer of: http://stackoverflow.com/q/25579273
has comment: http://stackoverflow.com/comment/39951241
type: AcceptedAnswer
downvote count: 0
has body: O(n) means no nested for loop and O(1) means constant storage needed for your input. If your input string is constrained to be all ASCII then this problem is really simple. ` boolean[] counter = new boolean[256]; StringBuilder sb = new StringBuilder(input); for (int i = 0; i &lt; sb.length(); i++) { if (counter[(int) input.charAt(i)]) { sb.setCharAt(i, ' '); } counter[(int) input.charAt(i)] = true; } ` However if the input isn't in ASCII but in Unicode, then it cannot be solved in O(1) space.

http://stackoverflow.com/q/25701161
type: AnsweredQuestion
has body: I have an application that takes a number of different images, makes new images from them and then saves them for use to make a video. The images are all PNG's and the videos are several minutes long so the program requires a lot of memory (one image every 33.33 MS of video play time). When I process a single video, it all works fine. I can even process several videos and it all works fine. But, eventually, I get an outofmemory error if I try to process 1 + n videos. What is confusing me is how that error happens. Here is the part of the program where the error happens: ComposeVideoController cvc = new ComposeVideoController(); boolean made = cvc.setXmlUrl(sourcePath, saveDir, fileId); cvc = null; To be more precise, the error happens in one of the frame construction classes which is referenced by the ComposeVideoController. ComposeVideoController is scoped to a single void method that runs recursively (if there are more videos to be made). I have gone through all the objects referenced by ComposeVideoController, which is the entry point to the library that builds the videos, and made sure they are all set to null too. How can I get outofmemory errors in ComposeVideoController when any individual video does not cause an outofmemory error and ComposeVideoController is out of scope (and set null) after any given video is made? The full recursion is shown below. I have one method that checks to see if there are new messages in queue (messages are sent by Socket) and if there are, it calls the method that processes the video. If not, the recursion ends: private void processQueue() { if(makingVideo) return; MakeVideoObject mvo = queue.remove(0); makingVideo = true; String[] convertArr = mvo.getConvertArrayCommand(); String sourcePath = convertArr[1]; String fileId = convertArr[2] + ".mp4"; String saveDir = convertArr[3] + System.getProperty("file.separator"); try { ComposeVideoController cvc = new ComposeVideoController(); boolean made = cvc.setXmlUrl(sourcePath, saveDir…
answer count: 3
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25701317
has comment: http://stackoverflow.com/comment/40173655
favorite count: 0
accepted answer: http://stackoverflow.com/a/25711869
has answer: http://stackoverflow.com/a/25701565
has comment: http://stackoverflow.com/comment/40173816
has title: Java Throwing OutOfMemory Even Though (I Think) I've Set References To Null
has answer: http://stackoverflow.com/a/25711869
linked to: http://stackoverflow.com/q/66540
type: Question
tagged with: java
score: 1
possible better answer: http://stackoverflow.com/a/25701565
has comment: http://stackoverflow.com/comment/40173507
has comment: http://stackoverflow.com/comment/40173881
has comment: http://stackoverflow.com/comment/40174113
has comment: http://stackoverflow.com/comment/40172771
tagged with: out-of-memory

http://stackoverflow.com/comment/40044719
comment on: http://stackoverflow.com/q/25630440
score: 0
has text: http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd "> <context:component-scan base-package="mypack" /> </beans>
type: Comment
type: QuestionComment

http://stackoverflow.com/a/43674883
type: Answer
score: 11
upvote count: 13
downvote count: 2
answers question: http://stackoverflow.com/q/25630425
has body: I hope this is what you need: System.out.println("'" + String.format("%-5.5s", "") + "'"); System.out.println("'" + String.format("%-5.5s", "123") + "'"); System.out.println("'" + String.format("%-5.5s", "12345") + "'"); System.out.println("'" + String.format("%-5.5s", "1234567890.....") + "'"); output length is always 5: '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' - filled with 5 spaces '123&nbsp;&nbsp;' filled with 2 spaces after '12345' - equals '12345' - truncated in addition: System.out.println("'" + String.format("%5.5s", "123") + "'"); output: '&nbsp;&nbsp;123' filled with 2 spaces before
has comment: http://stackoverflow.com/comment/93825363

http://stackoverflow.com/comment/40227188
type: QuestionComment
has text: Can you please make up your question with a complete `struts.xml` with `package` element and also a complete entire `JSP`, because in the presented snippet I did not find a taglib declaration `<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>` for Struts 2 jQuery tags?
score: 0
comment on: http://stackoverflow.com/q/25642712
type: Comment

http://stackoverflow.com/comment/40117991
type: AnswerComment
comment on: http://stackoverflow.com/a/25670833
type: Comment
has text: @edla.sk8 see [this answer](http://stackoverflow.com/a/12409475/2747533). android.4.1.1.4.jar should not be on your classpath.
score: 0

http://stackoverflow.com/comment/40038442
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25627050
type: QuestionComment
has text: Thanks. I do the waiting on a Background thread as it is ultimately trigger from the UI thread, I removed that detail from the SSCCE. I'll add it again and see if I can still reproduce the issue.

http://stackoverflow.com/comment/40154970
score: 0
type: AnswerComment
has text: Thats what I mean, if the `Application` opens the cache is should close it. It is its responsability to cleanup that resource.
comment on: http://stackoverflow.com/a/25671032
type: Comment

http://stackoverflow.com/a/25694836
answers question: http://stackoverflow.com/q/25694807
has body: You specified 0xFFFFFFFF, but that is an int literal, equal to -1, so the floor is always -1. Specify a long literal instead, with an L suffix. 0xFFFFFFFFL isn't -1 as a long, it's 2^32 - 1. long seed = (long) Math.floor((Math.random() * 0xFFFFFFFFL)); For a couple runs, the seed is: 3186506811 1401221963 1537111640
has comment: http://stackoverflow.com/comment/40161525
upvote count: 2
has comment: http://stackoverflow.com/comment/40161580
type: Answer
downvote count: 0
score: 2
accepted answer of: http://stackoverflow.com/q/25694807
type: AcceptedAnswer

endianness
tags question: http://stackoverflow.com/q/25594576
type: Tag
tag name: endianness

http://stackoverflow.com/a/25697968
score: 3
upvote count: 3
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25697665
answers question: http://stackoverflow.com/q/25697665
has body: First thing you code doesnot produces any Exception but still it is always safe to specify the Locale Like this Date dateobj = new SimpleDateFormat("MMM dd, yyyy", Locale.ENGLISH) .parse("Nov 12, 1994"); Date timeobj = new SimpleDateFormat("hh:mm a", Locale.ENGLISH) .parse("8:20 pm");
type: Answer

http://stackoverflow.com/a/25590842
has comment: http://stackoverflow.com/comment/39999337
type: AcceptedAnswer
type: Answer
upvote count: 1
has body: You should be using BukkitRunnable, especially since your way of scheduling tasks is deprecated in recent bukkits. What you should be doing is making a new class that extends BukkitRunnable, then make an instance of it and run runTaskTimer(&lt;plugininstance&gt;, 60, 100); on it, and you can later run cancel(); on the same instance of the BukkitRunnable to stop it. http://wiki.bukkit.org/Scheduler_Programming
has comment: http://stackoverflow.com/comment/39979745
accepted answer of: http://stackoverflow.com/q/25550960
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25550960
has comment: http://stackoverflow.com/comment/40133400
has comment: http://stackoverflow.com/comment/39972233
has comment: http://stackoverflow.com/comment/40114422

http://stackoverflow.com/a/25573512
has body: An alternative approach could be to have a method isBorder(int i, int j) that lets you know if you're on the bounds. If it is not a border, you know you can safely check all squares around (i,j). If it is on the border, you can calculate whether it's a left/right/top/bottom border or some combination of the 4 (no more than 2) and then check the appropriate boxes. disclaimer: I am assuming you're already doing a check to make sure (i,j) is a valid location on the grid. You should be doing a check for this regardless of your implementation
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25573199

http://stackoverflow.com/comment/40140793
type: Comment
comment on: http://stackoverflow.com/q/25684070
type: QuestionComment
score: 0
has text: "I want to operate over array of integers, and I can solve the problem using hashtable" - **wut?** Question: Why are you not just using an array?? (`Integer[] arr = new Integer[capacity];`)

http://stackoverflow.com/comment/40129922
type: Comment
comment on: http://stackoverflow.com/a/25677670
type: AnswerComment
has text: @user3792722 you dont have to use findViewById when extending listActivity see this link for details http://developer.android.com/reference/android/app/ListActivity.html
score: 0

http://stackoverflow.com/a/25671200
answers question: http://stackoverflow.com/q/25669917
has body: Create a test each implementation separatelly: QuickListTest and EfficientMemoryListTest. QuickListTest.java public class QuickListTest extends ListBase { @Test public void shouldBeEmpty() throws Exception { assertThatIsEmpty(new QuickList&lt;Integer&gt;()); } } BaseList.java public abstract class ListBase { protected void assertThatIsEmpty(QuickList&lt;Integer&gt; actual) { assertThat(actual).isEmpty(); } }
score: 0
type: Answer

instrumentation
type: Tag
tags question: http://stackoverflow.com/q/25602876
tag name: instrumentation

http://stackoverflow.com/comment/40182248
type: AnswerComment
has text: Is there any reason why you *shouldn't* avoid them, when this solution is already written, documented, supported, non-deprecated, tested, ...?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25706052

http://stackoverflow.com/a/33397103
score: 3
type: Answer
upvote count: 3
downvote count: 0
has body: The docs for RuleSetReferenceId are helpful, as is I believe this directory in the source tree. Basically put java- in front of any of these files to turn on the rules there.
answers question: http://stackoverflow.com/q/25584501

http://stackoverflow.com/comment/39966740
comment on: http://stackoverflow.com/q/25586673
type: QuestionComment
has text: so I don't really get it.. your outcome in the sql fiddle is exactly what you posted as your expected outcome.. I can limit the data but I don't get what good it would do since you are already getting the correct result.
score: 0
type: Comment

http://stackoverflow.com/comment/39939678
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25572947
has text: Did you try the query using `psql` ? (or any SQL client supporting Oracle). This could be various errors such as invalid database, schema, user, or even worse: the table was declared with some case, and Oracle expect this case.
type: QuestionComment

http://stackoverflow.com/comment/40110311
comment on: http://stackoverflow.com/a/25646572
type: Comment
has text: illegal start of expression >static private final String[] numberArray = new String[] why?
type: AnswerComment
score: 1

http://stackoverflow.com/q/25662450
has comment: http://stackoverflow.com/comment/40102267
has body: So I was just trying to create a simple program with bit more complicated code. What I was asked to do was write a program which controls whether it's a positive or negative number (I know, it's easy). What I was trying to do was to catch what was being entered, so if its not a float it will say to use a comma instead of point or enter a number instead of String. package example1; import java.util.InputMismatchException; import java.util.Scanner; public class numbritest { public static void main(String[] args) { float num; Scanner sisse1 = new Scanner(System.in); try { System.out.println("Sisesta number:"); System.out.println("Kaks komakohta on lubatud"); num = sisse1.nextFloat(); } catch(InputMismatchException exception) //juhul kui sisestab miskit muud { System.out.println("Kontrolli kas kasutasid koma!"); } if (num &lt; 0) //kui arv väiksem { System.out.println("Number " +num +" on negatiivne."); System.out.println("Seega on arv väiksem nullist"); } else //Kui arv on suurem või võrdne { System.out.println("Number " +num +" on positiivne."); System.out.println("Positiivsed arvud on suuremad"); System.out.println("või võrdsed nulliga."); } System.out.println(); System.out.println("Programm lõpetada!"); } } Sorry that it's in Estonian, but I hope you get my point.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25662949
accepted answer: http://stackoverflow.com/a/25662715
tagged with: java
possible better answer: http://stackoverflow.com/a/25662629
has comment: http://stackoverflow.com/comment/40102137
answer count: 4
has title: Using try and catch to get the input
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40102415
has answer: http://stackoverflow.com/a/25662715
has answer: http://stackoverflow.com/a/25662772
has comment: http://stackoverflow.com/comment/40161303
has answer: http://stackoverflow.com/a/25662629

resolution
tag name: resolution
tags question: http://stackoverflow.com/q/25635601
type: Tag

http://stackoverflow.com/comment/40194696
has text: you mean factory to create Table with different type?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25711268

http://stackoverflow.com/q/25578571
tagged with: static-classes
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25578656
type: AnsweredQuestion
has title: Creating an instance of static nested class in Java
has answer: http://stackoverflow.com/a/25578656
has answer: http://stackoverflow.com/a/25578591
answer count: 3
has body: I have read the posts on differences between static nested classes and inner classes. My question is more of an idiomatic java one. My requirement was to demonstrate various concepts like inheritance using a Single piece of code in Java. A single class file, so that it can be studied top-down and verified by running in sandbox like ideone - http://ideone.com/jsHePB class SOFieldAccessQuestion { static class B { int vf; static int sf; B(int i) { vf = i; sf = i + 1; } } static class C extends B { int vf; static int sf; C(int i) { super(i+20); vf = i; sf = i + 2; } } public static void main(String[] args) { // Is it Okay to create an instance of static nested class? C c1 = new C(100); B b1 = c1; System.out.println("B.sf = " + B.sf + ", b1.sf = " + b1.sf); System.out.println("C.sf = " + C.sf + ", c1.sf = " + c1.sf); System.out.println("b1.vf = " + b1.vf); System.out.println("c1.vf = " + c1.vf); } } My question is, is it okay to create an instance of a static nested class like above? I fear that I am ignoring the meaning of "static" here. How should I refer and acknowledge the concept that Java allows me to create objects of static class. If I don't create a static class of B or C, then I can't use them inside public static void main method and may not execute the program with a main entry point and thus I am forced to do it.
has answer: http://stackoverflow.com/a/25578610
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25578591
type: Question
downvote count: 0

http://stackoverflow.com/q/25618452
tagged with: casting
has title: Cast a raw map to a generic map using a method, cleanly and safely in a fail early manner
linked to: http://stackoverflow.com/q/2767212
tagged with: java-5
linked to: http://stackoverflow.com/q/6093363
answer count: 1
linked to: http://stackoverflow.com/q/1129795
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40027673
has comment: http://stackoverflow.com/comment/40025331
upvote count: 1
score: 1
linked to: http://stackoverflow.com/q/509076
tagged with: java
has comment: http://stackoverflow.com/comment/40023035
tagged with: generics
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/6157835
has body: Casting, instanceof, and @SuppressWarnings("unchecked") are noisy. It would be nice to stuff them down into a method where they won't need to be looked at. CheckedCast.castToMapOf() is an attempt to do that. castToMapOf() is making some assumptions: (1) The map can't be trusted to be homogeneous (2) Redesigning to avoid need for casting or instanceof is not viable (3) Ensuring type safety in an fail early manner is more important than the performance hit (4) Returning Map&lt;String,String&gt; is sufficient (rather than returning HashMap&lt;String, String&gt;) (5) The key and value type args are not generic (like HashMap&lt;String, ArrayList&lt;String&gt;&gt;) (1), (2) and (3) are symptoms of my work environment, beyond my control. (4) and (5) are compromises I've made because I haven't found good ways to overcome them yet. (4) Is difficult to overcome because even if a HashMap.class was passed into a Class&lt;M&gt; I haven't been able to figure out how to return a M&lt;K, V&gt;. So I return a Map&lt;K, V&gt;. (5) Is probably an inherent limitation of using Class&lt;T&gt;. I'd love to hear alternative ideas. Despite those limitations can you see any problems with this code? Am I making any assumptions I haven't identified? Is there a better way to do this? If I'm reinventing the wheel please point me to the wheel. :) public class CheckedCast { public static final String LS = System.getProperty("line.separator"); /** Check all contained items are claimed types and fail early if they aren't */ public static &lt;K, V&gt; Map&lt;K, V&gt; castToMapOf( Class&lt;K&gt; clazzK, Class&lt;V&gt; clazzV, Map&lt;?, ?&gt; map) { for ( Map.Entry&lt;?, ?&gt; e: map.entrySet() ) { checkCast( clazzK, e.getKey() ); checkCast( clazzV, e.getValue() ); } @SuppressWarnings("unchecked") Map&lt;K, V&gt; result = (Map&lt;K, V&gt;) map; return result; } /** Check if cast would work */ public static &lt;T&gt; void checkCast(Class&lt;T&gt; clazz, Object obj) { if ( !clazz.isInstance(obj) ) { thro…
has answer: http://stackoverflow.com/a/25620186
downvote count: 0
accepted answer: http://stackoverflow.com/a/25620186

http://stackoverflow.com/comment/91492714
has text: @PeterLawrey creating a dedicated class or using an array, is mostly a matter of coding style.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25570609
score: 2

http://stackoverflow.com/comment/40008669
score: 0
comment on: http://stackoverflow.com/a/25610865
type: Comment
type: AnswerComment
has text: Can you please explain more?

http://stackoverflow.com/comment/40012509
score: 0
comment on: http://stackoverflow.com/a/25572311
type: Comment
type: AnswerComment
has text: @T_01 I have added configuration to the maven compiler plugin to be added to your `pom.xml`. It shouldn't be necessary but give it a try.

http://stackoverflow.com/comment/40027387
has text: Your solution would pop up the text layout
type: AnswerComment
comment on: http://stackoverflow.com/a/25620241
score: 0
type: Comment

http://stackoverflow.com/q/25609641
favorite count: 0
type: Question
has body: Based off the way they solved this problem on paper: http://www.wikihow.com/Find-the-Greatest-Common-Divisor-of-Two-Integers I am attempting to solve for the greatest common divisor in Java using 108 as m and 30 as n. The problem is that when I run the program, the result ends up being 0. I know I can do this method because I wrote the code myself, yet I hit a stumbling block every time I write a method like this: public static double getGcd_nr(int m, int n){ int dividend = m; int divisor = n; int quotient = dividend/divisor; int remainder = dividend % divisor; int gcd = 0; for(int i = divisor * quotient + remainder; i &gt; 0; i--){ dividend = divisor; divisor = remainder; if (remainder == 0){ gcd = divisor; } } return gcd; } May you please help me accomplish what I need to accomplish. I need to write my own code and not copy someone else's.
tagged with: recursion
type: UnansweredQuestion
tagged with: double
tagged with: java
tagged with: int
has comment: http://stackoverflow.com/comment/40006318
has answer: http://stackoverflow.com/a/31654409
downvote count: 0
score: 1
upvote count: 1
answer count: 1
has title: Finding the greatest common divisor

http://stackoverflow.com/a/25699241
score: 1
upvote count: 1
has body: To capture the overlapping characters, you need to include the capturing group inside a lookbehind or lookahead. (?&lt;=([A-Za-z]-[A-Za-z])) DEMO
answers question: http://stackoverflow.com/q/25699170
type: Answer
downvote count: 0

sharedpreferences
tags question: http://stackoverflow.com/q/25573332
tags question: http://stackoverflow.com/q/25685342
type: Tag
tags question: http://stackoverflow.com/q/25620543
tag name: sharedpreferences
tags question: http://stackoverflow.com/q/25639759
tags question: http://stackoverflow.com/q/25569055

http://stackoverflow.com/comment/40189890
type: Comment
comment on: http://stackoverflow.com/a/25710568
score: 0
type: AnswerComment
has text: for(int k=j; k<nElems; k++) // higher ones down arr.setElem(k, arr.getElem(k+1) ); nElems--; // decrement size for(j=0; j<nElems; j++) // display items System.out.print( arr.getElem(j) +" "); System.out.println(" ");

http://stackoverflow.com/q/25581190
has body: I'd like to position a JDialog nearby it's parent as showed in this picture: How can I do that? Thanks
type: Question
tagged with: position
answer count: 2
tagged with: layout
possible better answer: http://stackoverflow.com/a/25581722
tagged with: swing
tagged with: jdialog
has title: Position JDialog nearby its parent
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25581229
accepted answer: http://stackoverflow.com/a/25581229
has answer: http://stackoverflow.com/a/25581722

http://stackoverflow.com/a/25576796
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25572947
has body: If you are using different user to test, then the user that is configured in the datasource In the datasource Connection Pool config, go to advanced section Type this in the "Init SQL" section (see the SQL word before the instruction, its needed) SQL ALTER SESSION SET CURRENT_SCHEMA=DEVLPMT See http://docs.oracle.com/middleware/1212/wls/JDBCA/jdbc_datasources.htm#CJAFCBBD
type: Answer
answers question: http://stackoverflow.com/q/25572947
score: 0

http://stackoverflow.com/a/25602332
downvote count: 0
upvote count: 1
has body: When no mongod process is running on the local machine, you need to start one. There are different methods to start another program from a Java program. The most crude way is to use Runtime.exec(String) which executes a command as if it were entered into the operating systems command shell. It returns a Process object which allows you to retrieve the output of the process you start and gives you some control over the process. A more sophisticated but also more verbose way is to use the class ProcessBuilder. The main advantage is that the process builder allows you to write code which is more operating-system independent. Keep in mind that either method only works when mongodb runs on the same server as your application. In a usual production-setup, mongodb runs on multiple dedicated servers which are physically separated from the application server. Starting a process on a different machine isn't that simple for obvious reasons. There are software solutions available which allow you to remotely manage multiple processes on many servers at once (the server admins at our company like Control-M), but this is in the realm of server administrations.
type: Answer
answers question: http://stackoverflow.com/q/25600736
score: 1

http://stackoverflow.com/a/25628445
has body: Maybe it's not stuck. It's just calling new DateTimeZone() in a loop, and the constructor does some computations. Every time you look at this thread, it's inside DateTimeZone() - but it's a different DateTimeZone() each time. Which then gets discarded. Happened to me quite a few times.
has comment: http://stackoverflow.com/comment/40042179
answers question: http://stackoverflow.com/q/25627312
score: 0
type: Answer

http://stackoverflow.com/comment/40102688
has text: I understand that Android PUSH notifications generally uses Google Cloud Messaging (GCM) or uses Parse Cloud. That would mean I will have to change the entire structure of how my datas are stored.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25662719

http://stackoverflow.com/a/25567571
answers question: http://stackoverflow.com/q/25567418
type: Answer
has comment: http://stackoverflow.com/comment/40006901
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25567418
has comment: http://stackoverflow.com/comment/39957794
has comment: http://stackoverflow.com/comment/39954753
has body: All native code used should be compiled for the 64-bit architecture you use. Java code itself is portable from a 32-bit architecture to a 64-bit architercture, though non-deterministic issues that are architercture-dependent can become visible. For instance, non-thread-safe code can behave differently on different platforms.
has comment: http://stackoverflow.com/comment/39929585

http://stackoverflow.com/a/25696261
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25680728
type: Answer
has body: When Jackson sees your type for the first time, (depending on the type) it will build a BeanSerializer with the appropriate JsonSerializers for each property. This BeanSerializer is cached and reused for future serializations of the same Type. As such, a single instance of JsonDateTimeSerializer (per type), which will have been registered with the JsonDateTimeSerializer, will be reused for all serializations. It must therefore be thread safe if you plan to use the ObjectMapper across multiple threads. (You should since the ObjectMapper itself is thread safe.)
accepted answer of: http://stackoverflow.com/q/25680728
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/40193505
has text: thanks. and how can i extract the variables?
score: 0
comment on: http://stackoverflow.com/a/25712441
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40095965
comment on: http://stackoverflow.com/q/25658482
type: QuestionComment
has text: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid string or buffer length at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113) at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3906) at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5697) at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:353) at sun.jdbc.odbc.JdbcOdbcConnection.buildTypeInfo(JdbcOdbcConnection.java:1503) at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:381)
score: 0
type: Comment

http://stackoverflow.com/q/25624161
has answer: http://stackoverflow.com/a/29987953
has answer: http://stackoverflow.com/a/25687100
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: junit
upvote count: 1
has body: I'm in the midst of testing my application which is using an HTTP-server. Instead of mocking I decided to go with a HTTP server fixture. Meaning that I do not have to mock any productional code. To accomplish this goal I currently chose for a free to use 3rd party library fixd. I was able to successfully create several unit tests - which are working by means of a GET request. Most are quite simple, i.e.: @Test public void verifyConnectionTest() { try { final String body = FileUtils.readFileToString(RESOURCE); final String path = "/"; this.server.handle(Method.GET, path).with( new HttpRequestHandler() { @Override public void handle(final HttpRequest request, final HttpResponse response) { response.setStatusCode(200); response.setContentType("text/xml"); response.setBody(body); } }); // Setting up my HTTP client // Execute some tasks // asserting of everything was valid } catch (final IOException e) { fail(e.getMessage()); } } But I now have to send a POST request with multipart/form-data. Which does not make much of a difference other than changing the method and content-type: @Test public void executeStepTest() { try { final String body = FileUtils.readFileToString(SERVICE_RESPONSE); final String path = "/"; this.server.handle(Method.POST, path, "multipart/form-data").with( new HttpRequestHandler() { @Override public void handle(final HttpRequest request, final HttpResponse response) { response.setStatusCode(200); response.setContentType("text/xml"); response.setBody(body); } }); // Setting up my HTTP client // Execute some tasks // asserting of everything was valid } catch (final IOException e) { fail(e.getMessage()); } } However I get the following error: [ERROR] could not find a handler for POST - / - multipart/form-data; boundary=bqCBI7t-VW1xaJW7BADmTiGMg9w_YM2sHH8ukJYx and my guess is that fixd doesn't recognize the boundary-party. Since the documentation does not show an example I'm quite stuck on this part. I tried using some wildcards such as '*', no succes.…
tagged with: http
has title: Cannot find a handler for POST with boundary
favorite count: 0
tagged with: unit-testing
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/29987953
accepted answer: http://stackoverflow.com/a/25687100
downvote count: 0

http://stackoverflow.com/comment/40033366
type: AnswerComment
has text: I changed the code slightly. I didn't want to elaborate on wrapper, just wanted to show an example when it will say the map was changed even though its content will be identical (or in general equal) to the original content.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25623351

http://stackoverflow.com/q/25636822
tagged with: android-activity
has comment: http://stackoverflow.com/comment/40056092
type: Question
tagged with: android-service
has answer: http://stackoverflow.com/a/25636871
has comment: http://stackoverflow.com/comment/40056022
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25637157
tagged with: eclipse
has body: I have two Projects , A(main project) and B(library project). B is included in the build path of A. I have to start few activities of B from some activities of A. This works fine until recently, I had to Start an Activity of A from an Activity of B. To do that, I tried Adding A to the build path of B, but what this does , is, run the building process in an endless Loop.So, apparently , this is not the correct way to achieve what I want. My question is, How do I access classes of a Main Project from a Library that is Included in the Main Project?
score: 0
answer count: 2
has title: Correct way to Include Main Project in Build Path of library project
tagged with: java
has comment: http://stackoverflow.com/comment/40056036

http://stackoverflow.com/comment/40102542
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25662572
has text: Show your code please.

http://stackoverflow.com/comment/39958019
type: QuestionComment
has text: If you mean **path to 32 bit java** is set in classpath, you can remove that part only from classpath.
comment on: http://stackoverflow.com/q/25579876
score: 1
type: Comment

http://stackoverflow.com/comment/39970187
comment on: http://stackoverflow.com/q/25589697
score: 0
has text: What you've modeled here can be described more accurately as a monomial.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40164339
score: 7
type: QuestionComment
type: Comment
has text: Please explain, 1) what you're trying to achieve, 2) what you're getting, 3) please show any and all error messages (if any), 4) please post a [minimal example program](http://stackoverflow.com/help/mcve).
comment on: http://stackoverflow.com/q/25696273

http://stackoverflow.com/comment/39994759
has text: When you did with Hibernate, you did with JPA only. Whats your actual question ?
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25603295
type: Comment

http://stackoverflow.com/a/25653879
has body: I whipped up a prototype using BoxLayout, for no other reason than I rarely use it and felt like trying it. Normally, GridBagLayout would be my first choice for this. EDIT: Added a pic (thanks trashgod!) import java.awt.*; import java.awt.event.*; import javax.swing.*; public class MessageAppDemo implements Runnable { private String[] messages = new String[] { "Hello?", "Hey, what's up?", "Where are you?", "Right behind you.", "Stop following me!", "But you owe me money.", "I'll gladly repay you on Tuesday.", "You said that last week!", "But now I actually have a job." }; private int msgCounter = 0; private JPanel panel; private JScrollPane scrollPane; private Timer timer; public static void main(String[] args) { SwingUtilities.invokeLater(new MessageAppDemo()); } public void run() { panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); scrollPane = new JScrollPane(panel); scrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_NEVER); scrollPane.setAutoscrolls(true); JFrame frame = new JFrame("Message App"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(scrollPane, BorderLayout.CENTER); frame.setSize(260, 180); frame.setLocationRelativeTo(null); frame.setVisible(true); timer = new Timer(1500, new ActionListener() { public void actionPerformed(ActionEvent event) { if (msgCounter &lt; messages.length) { addMessage(messages[msgCounter]); } else { timer.stop(); } } }); timer.start(); } private void addMessage(String text) { boolean rightAligned = msgCounter % 2 != 0; Color color = rightAligned ? Color.CYAN : Color.ORANGE; JLabel label = new JLabel(text); label.setOpaque(true); label.setBackground(color); label.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(Color.BLUE), BorderFactory.createEmptyBorder(2,4,2,4) )); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.setBorder(BorderFactory.createEmptyBorder(2,4,2,4)); if (rightAligned) { p.add(B…
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25652405
score: 5
upvote count: 5

http://stackoverflow.com/q/25571960
tagged with: quartz-scheduler
possible better answer: http://stackoverflow.com/a/25572366
has title: Quartz job Vs. Thread for immediate one time task
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25572211
upvote count: 9
tagged with: java
has answer: http://stackoverflow.com/a/25574145
has answer: http://stackoverflow.com/a/25572366
answer count: 4
accepted answer: http://stackoverflow.com/a/25572227
score: 9
type: AnsweredQuestion
has body: Let's say I have some unit of work that needs to get done and I want to do it asynchronously relative to the rest of my application because it can take a long time e.g. 10 seconds to 2 minutes. To accomplish this I'm considering two options: Schedule a Quartz job with a simple trigger set to fire only once and as soon as possible. Create a Runnable instance, hand it off to a Thread, and call run();. In the context of the above I have the following questions: What does using the Quartz job get me that the thread doesn't have? What does using the runable get me that using the quartz job doesn't? In terms of best practices, what criteria ought be used for deciding between Quartz jobs and runnables for this use case?
has answer: http://stackoverflow.com/a/25572227
tagged with: runnable
tagged with: multithreading
downvote count: 0

http://stackoverflow.com/comment/40039811
has text: That's better! It's only a bit clumsy!
type: AnswerComment
comment on: http://stackoverflow.com/a/25624818
score: 1
type: Comment

http://stackoverflow.com/comment/40107099
type: Comment
comment on: http://stackoverflow.com/q/25661611
has text: Turn on devMode and set logging to debug. Is the `execute()` method being called at all? You might also try adding `namespace="/"` to your package declaration.
score: 0
type: QuestionComment

http://stackoverflow.com/a/25611272
has comment: http://stackoverflow.com/comment/40009244
downvote count: 0
has body: Try this (it's important not forgetting the case when s.length() &lt; 2) : public static boolean isPalindrome(String s) { int length = s.length(); if (s.isEmpty() || length == 1) return true; return s.charAt(0) != s.charAt(length - 1) ? false : isPalindroma(s.substring(1,length - 1)); }
type: Answer
answers question: http://stackoverflow.com/q/25611250
score: 1
has comment: http://stackoverflow.com/comment/40009228
upvote count: 1
has comment: http://stackoverflow.com/comment/40009174

soa
type: Tag
tags question: http://stackoverflow.com/q/25632410
tag name: soa

http://stackoverflow.com/a/25697928
downvote count: 0
has body: A ModelAndView contains a Model which is a kind of Map. It can contain as many objects as you need. Simply modify your code like : @RequestMapping(value="/do_register", method= RequestMethod.GET) public ModelAndView RegistrationForm(@ModelAttribute Subscriber subscriber, BindingResult result) { ... // I want to pass both "myCities" and "interest" to my view File ModelAndView mav = ModelAndView("regForm"); mav.addAttribute("interests", interest); mav.addAttribute("records", myCities); return mav; } And you find your objects in the JSP with ${records} and ${interests}
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25697558
type: Answer
answers question: http://stackoverflow.com/q/25697558
upvote count: 2
score: 2

log4j2
tags question: http://stackoverflow.com/q/25635377
tags question: http://stackoverflow.com/q/25694782
tags question: http://stackoverflow.com/q/25668685
tag name: log4j2
type: Tag
tags question: http://stackoverflow.com/q/25555172
tags question: http://stackoverflow.com/q/25662269
tags question: http://stackoverflow.com/q/25683210
tags question: http://stackoverflow.com/q/25649134
tags question: http://stackoverflow.com/q/25669636

http://stackoverflow.com/q/25580065
tagged with: tfs
answer count: 1
has body: Using TFS in eclipse. And while checking in whole project this error occurs. I can check in seperate files. The local item 'D:\LUDev\Stalker\AndroidApp\gen\com\stalker\androidappa\BuildConfig.java' no longer exists. (The local item 'D:\LUDev\Stalker\AndroidApp\gen\com\stalker\androidappa\BuildConfig.java' no longer exists.) I don't have D:\LUDev\Stalker\AndroidApp\gen\com\stalker\androidappa... this directory in my local as well as server directory.
type: Question
score: 0
tagged with: android
tagged with: java
tagged with: azure-devops
has title: tfs android not checking in
has comment: http://stackoverflow.com/comment/63221443
has answer: http://stackoverflow.com/a/25594861
type: UnansweredQuestion

http://stackoverflow.com/comment/39922118
has text: Yes. I need the newer version because Hibernate Validator 5.1.2.Final needs javax.el-api version 2 minimum, and the one included in j2ee.jar is older. Sadly it's always loaded the one in j2ee.jar first so I get java.lang.NoSuchMethodError: javax.el.ExpressionFactory.newInstance
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25563795

http://stackoverflow.com/comment/40151718
type: AnswerComment
comment on: http://stackoverflow.com/a/25633611
has text: Thanks, I will try this, altough I can think that if my system is used by multiple users I can end up killing someone else's transaction, am I wrong? thx
type: Comment
score: 0

http://stackoverflow.com/comment/40073015
comment on: http://stackoverflow.com/a/25599818
has text: Still getting the hang of the device monitor but it did seem that there were some memory savings using a sampled image as opposed to unsampled. The file is generated by the camera so the original bitmap is fairly large.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25657845
has answer: http://stackoverflow.com/a/25660317
tagged with: listview
tagged with: arraylist
type: AnsweredQuestion
score: 0
linked to: http://stackoverflow.com/q/25375831
has answer: http://stackoverflow.com/a/25658031
tagged with: android-listview
tagged with: java
has title: Showing data from Arraylist of Hashmap
type: Question
possible better answer: http://stackoverflow.com/a/25658031
answer count: 2
has comment: http://stackoverflow.com/comment/40094426
has comment: http://stackoverflow.com/comment/79944163
has comment: http://stackoverflow.com/comment/40094729
tagged with: android
accepted answer: http://stackoverflow.com/a/25660317
has comment: http://stackoverflow.com/comment/40094593
has body: I'm getting json data and putting it in hashmap and hashmap into an arraylist. All is happening in fragment extending ListFragment protected String doInBackground(String... urls) { JSONObject jsonObject = new JSONObject(); try { jsonObject.put("full_name", etUserSearch.getText().toString()); responseReceive = JsonPostClient.SendHttpPost(urls[0], jsonObject); } catch (JSONException e) { e.printStackTrace(); } try { Success = responseReceive.getJSONArray("Success"); for (int i = 0; i &lt; Success.length(); i++) { JSONObject c = Success.getJSONObject(i); String full_name = c.getString(TAG_FULL_NAME); String user_name = c.getString(TAG_USER_NAME); String user_id = c.getString(TAG_USER_ID); HashMap&lt;String, String&gt; friends = new HashMap&lt;String, String&gt;(); // adding each child node to HashMap key =&gt; value friends.put(TAG_FULL_NAME, full_name); friends.put(TAG_USER_NAME, user_name); friends.put(TAG_USER_ID, user_id); // adding contact to contact list FriendSearchList.add(friends); } } catch (JSONException e) { // TODO Auto-generated catch block Log.d("hello", ""); e.printStackTrace(); } return null; } protected void onPostExecute(String result) { super.onPostExecute(result); if (pDialog.isShowing()) pDialog.dismiss(); printFriends(); }; I'm checking that data is valid by printFriends() method and wanna show only 'TAG_FULL_NAME' data in a listview. My ListView initialization View rootView = inflater.inflate(R.layout.tab_add_friends, container, false); lv = (ListView) rootView.findViewById(R.id.listView); Method for checking data and loading in ListView public void printFriends() { int len = FriendSearchList.size(); for (int i = 0; i &lt; len; i++) { String f_name = FriendSearchList.get(i).get(TAG_FULL_NAME); String u_name = FriendSearchList.get(i).get(TAG_USER_NAME); String u_id = FriendSearchList.get(i).get(TAG_USER_ID); Log.d("full_name", f_name); Log.d("user_name", u_name); Log.d("user_id", u_id); } ListAdapter adapter = new SimpleAdapter(getActivity(), Fri…

http://stackoverflow.com/comment/40101537
has text: What have you got so far? It'll be easier to help you if you can provide some context in the form of code...
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25661897
type: QuestionComment

http://stackoverflow.com/comment/40172787
has text: It doesn't make sense to use integer variable to store floating values. So simply you can't make it with int.
score: 0
comment on: http://stackoverflow.com/q/25701145
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40040211
comment on: http://stackoverflow.com/a/25624407
has text: Great answer ! I did implement similar class (though not specialized) since scala 2.7 without noticing they exists. Do you know when they were introduced ?
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40046634
type: AnswerComment
has text: @chiastic-security I couldn't help myself and implemented a [similar solution](https://dl.dropboxusercontent.com/u/4971686/published/maaartin/so/FileNumberSum.java) taking 1.9 seconds.
comment on: http://stackoverflow.com/a/25608015
score: 0
type: Comment

http://stackoverflow.com/q/25609319
has comment: http://stackoverflow.com/comment/40005877
has body: I am creating a web portal and database to teach students how to program. I want to have a editor on the page so that the students can see what they are doing if you know what I mean. I can do basic HTML but trying to do an editor is bit advanced for me which I am willing to learn. What is the best way of going about it I have heard of codemirror but not sure how to use it. Many Thanks
type: Question
has title: how to create an java editor in a web page
tagged with: codemirror
tagged with: editor
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: web
accepted answer: http://stackoverflow.com/a/25619173
answer count: 1
has comment: http://stackoverflow.com/comment/40013217
has answer: http://stackoverflow.com/a/25619173

http://stackoverflow.com/a/25613039
type: Answer
has comment: http://stackoverflow.com/comment/40012328
has comment: http://stackoverflow.com/comment/40013169
accepted answer of: http://stackoverflow.com/q/25612993
has comment: http://stackoverflow.com/comment/40013299
has comment: http://stackoverflow.com/comment/40012803
upvote count: 3
has comment: http://stackoverflow.com/comment/40013210
answers question: http://stackoverflow.com/q/25612993
has body: Say you have two classes, A and B, and you want B to call method1() in A, then B needs a valid instance of A to call the method off of. For example... public class Foo { public static void main(String[] args) { A a = new A(); B b = new B(a); // pass A reference into B b.someMethodInB(); } } class A { // the method that we're interested in! public void method1() { System.out.println("method1 in A"); } } class B { private A a; //give B a field to hold A's reference // Allow B's constructor to accept the A reference public B(A a) { this.a = a; // and assign it to a field } public void someMethodInB() { a.method1(); // now B can call A's method } } Edit Edits based on your code. Note additions made to make the code snippet compilable. Please remember to do this next time: import java.awt.event.*; import java.util.List; import javax.swing.JButton; public class Foo { public List&lt;Product&gt; productList; public static void main(String[] args) { Foo f = new Foo(); A a = new A(f); } public void addNewProduct(String name) { Product product = new Product(); product.setName(name); productList.add(product); } } class A { private JButton saveButton = new JButton(); private Foo foo; public A(final Foo foo) { this.foo = foo; saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { foo.addNewProduct("Hello World"); } }); } } class Product { public void setName(String name) { // TODO Auto-generated method stub } } Edit 3 I just noticed that you are creating an instance of the GUI inside of your ProductList class. Often it is done the other way around, but if this is the way you want to do it, then if the GUI is not created in the static world then pass your reference into the GUI via its constructor by passing in this: DesktopGUI gui = new DesktopGUI(this); // Note change frame = gui.getFrame();
has comment: http://stackoverflow.com/comment/40012611
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40012343
downvote count: 0
has comment: http://stackoverflow.com/comment/40012907
has comment: http://stackoverflow.com/comment/40012564
has comment: http://stackoverflow.com/comment/40013052
has comment: http://stackoverflow.com/comment/40012787
has comment: http://stackoverflow.com/comment/40012694
has comment: http://stackoverflow.com/comment/40012596
score: 3
has comment: http://stackoverflow.com/comment/40012435
has comment: http://stackoverflow.com/comment/40013179
has comment: http://stackoverflow.com/comment/40012769
has comment: http://stackoverflow.com/comment/40012728

http://stackoverflow.com/comment/40102898
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25662864
has text: @SJuan76 I am trying to avoid dublicate two entries such as filename in the stack. For filename case, I donot want let user to choose same filename twice. If I let, the whole stack can be filled with, e.g., (filename1, date1), (filename2, date3), (filename1, date1), (filename2, date3) ...

http://stackoverflow.com/q/25630916
tagged with: java
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40046334
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40045589
has answer: http://stackoverflow.com/a/25631680
accepted answer: http://stackoverflow.com/a/25631680
tagged with: android
has body: I need your help. So, what i intend to do is to read a value from a file and to increase this value by one, then write it in the same file, i don`t know where is my error. This is the procedure which i use to do all of this : And together with the folders : I really appreciate your help until now, would be really thankful for any advice. The problem i am facing i can`t find the file on device, the text file should be a permanent file created on the device in order to store some data, even if the app is closed or the phone is switched off.
score: -1
has title: Working with files Android programming
has comment: http://stackoverflow.com/comment/40045541
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/a/25696174
has comment: http://stackoverflow.com/comment/40164192
type: Answer
has comment: http://stackoverflow.com/comment/40164395
has comment: http://stackoverflow.com/comment/40164328
has body: Object howmanytimestheitemappears[] = hashmapofcount.entrySet().toArray(); for (int i = 0; i &lt; howmanytimestheitemappears.length; i++) { int q = (Integer)howmanytimestheitemappears[i];/ .... } howmanytimestheitemappears[i] is of type HashMap$Entry. To get the key you need to call howmanytimestheitemappears[i].getKey() Read http://docs.oracle.com/javase/7/docs/api/java/util/Map.Entry.html.
has comment: http://stackoverflow.com/comment/40164249
answers question: http://stackoverflow.com/q/25696108
has comment: http://stackoverflow.com/comment/40164268
score: 0
has comment: http://stackoverflow.com/comment/40164206
has comment: http://stackoverflow.com/comment/40164519

http://stackoverflow.com/a/25685030
downvote count: 0
answers question: http://stackoverflow.com/q/25672533
upvote count: 1
has body: Put the following to Manifest, in your Alert activity : android:excludeFromRecents="true" //this will make the Activity be exclude from recents list. You can also add android:launchMode="singleInstance" and android:taskAffinity="" (if you know what they do) In the Alert class, use this to detect home button pressed event: @Override public void onPause() { if (!isFinishing()) { createNotf(); //Handle home button press here. } super.onPause(); } Use this to handle back button pressed: (You have to have this code if you want to detect home button press using isFinishing(); @Override public void onBackPressed() { //Handle BackButton event here. } For my case only, when the user press home button, I will create a notification, so he can either click on the notification or open the app again to access to Alert Screen.: private void createNotf() { Intent screenIntent = new Intent(MyAlert.this, MyAlert.class); screenIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); screenIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); PendingIntent pIntent = PendingIntent.getActivity(MyAlert.this, MainActivity.SEND_ALARM_CODE, screenIntent, PendingIntent.FLAG_CANCEL_CURRENT); Notification.Builder ntfBuilder = new Notification.Builder(this) .setAutoCancel(true) .setContentTitle("ALARM_RUNNING") .setLargeIcon(bitmap) .setSmallIcon(R.drawable.ic_launcher) .setContentText("CLICK_TO_OPEN_ALERTSCREEN.") .setContentIntent(pIntent); NotificationManager myNotfM = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); myNotfM.notify(999, ntfBuilder.build()); } When the Alert stop, that notification will also be clear: @Override public void onDestroy() { super.onDestroy(); NotificationManager mntfM = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mntfM.cancel(999);}
score: 1
type: Answer

http://stackoverflow.com/q/25590937
answer count: 1
has answer: http://stackoverflow.com/a/25590970
type: Question
score: 0
has comment: http://stackoverflow.com/comment/39972056
tagged with: java
accepted answer: http://stackoverflow.com/a/25590970
has title: Why do chaining declarations followed by an instantiation cause a NullPointerException?
has body: I thought I understood NullPointerException, but apparently not. This here throws an error: (main is a class) main.topicActionWeight.add( Float.parseFloat(this.actionGenreWeightCombo.getSelectedItem().toString())); TopicActionWeight is a list. Here is my declaration of the list: public static List&lt;Float&gt; topicActionWeight, topicAdventureWeight, topicRPGWeight, topicStrategyWeight, topicSimulationWeight = new ArrayList&lt;&gt;(); The lists I declare aren't pointers, are they? They are created.. Yes, I have tried new ArrayList&lt;Float&gt;();
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39972067

http://stackoverflow.com/comment/40157596
score: 0
type: Comment
type: QuestionComment
has text: This is for an assignment and I am not allowed to use any of Java's built-in library functions to do the conversion.
comment on: http://stackoverflow.com/q/25692730

http://stackoverflow.com/q/25634257
type: Question
tagged with: browser
has title: GWT SinkEvent is not working except on firefox
answer count: 2
tagged with: onclicklistener
has answer: http://stackoverflow.com/a/32546863
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40228181
downvote count: 0
has comment: http://stackoverflow.com/comment/40234347
tagged with: gwt
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/25686967
has body: I am trying to sink an event on anchor element which is inside and the listeners on the is just working fine but it's not working on the anchors on any other element. The weird thing that it's working on FireFox only The html output is something like: Some Text Some TextAnchor JAVA Code for the listener this.eventListener = new EventListener() { @Override public void onBrowserEvent(Event e) { Element elem = e.getTarget(); //This means we want to use the option selection switch (e.getTypeInt()) { case Event.ONCLICK: if (LIElement.is(elem) && !elem.hasClassName('myClass')) { selectOption((LIElement) elem); } else { LIElement li = (LIElement) elem.getParentElement(); createContact(li); } break; case Event.ONMOUSEOVER: //do something break; case Event.ONMOUSEOUT: //do something break; } }//End of onBrowserEvent };//End of event listener I am using this to create elements: LIElement li = Document.get().createLIElement(); AnchorElement createContactLI = Document.get().createAnchorElement(); createContactLI.addClassName(NEW_CONTACT_CLASS); createContactLI.setInnerText("Add new contact"); createContactLI.setId("myID"); li.appendChild(createContactLI); ulPanel.appendChild(li); This to sink events: Event.sinkEvents(ulPanel, Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT); Event.setEventListener(ulPanel, this.eventListener);` What I tried Sinked the event of the anchor , DID NOT WOK Wrap the anchorElement in anchor and added ClickHandler , Didn't work Converting the anchorElement to liElement , Didn't work BTW Break points is not fired when dealing with the anchorElement Also tried CSS and z-indexing , Didn't work What I am going to do - Write the whole feature as widgets , which will take me a long time Your help is really really really appreciated
favorite count: 0

serialization
tags question: http://stackoverflow.com/q/25694795
tags question: http://stackoverflow.com/q/25705097
tags question: http://stackoverflow.com/q/25646564
tags question: http://stackoverflow.com/q/25616528
tags question: http://stackoverflow.com/q/25587338
tags question: http://stackoverflow.com/q/25686813
type: Tag
tags question: http://stackoverflow.com/q/25675011
tags question: http://stackoverflow.com/q/25704585
tags question: http://stackoverflow.com/q/25583421
tags question: http://stackoverflow.com/q/25699232
tags question: http://stackoverflow.com/q/25661763
tags question: http://stackoverflow.com/q/25621097
tags question: http://stackoverflow.com/q/25612420
tags question: http://stackoverflow.com/q/25603581
tags question: http://stackoverflow.com/q/25692444
tag name: serialization
tags question: http://stackoverflow.com/q/25666385
tags question: http://stackoverflow.com/q/25591971
tags question: http://stackoverflow.com/q/25670077
tags question: http://stackoverflow.com/q/25698687

http://stackoverflow.com/a/25680420
has body: From the Wikipedia page on HSL and HSV A more perceptually relevant alternative is to use luma, Y′, as a lightness dimension (fig. 12d). Luma is the weighted average of gamma-corrected R, G, and B, based on their contribution to perceived luminance, long used as the monochromatic dimension in color television broadcast. For the Rec. 709 primaries used in sRGB, Y′709 = 0.21R + 0.72G + 0.07B; for the Rec. 601 NTSC primaries, Y′601 = 0.30R + 0.59G + 0.11B; for other primaries different coefficients should be used. so if accuracy is important, I would recommend that you write a comparator that calculates 0.21 * R + 0.72 * G + 0.07 * B and compares on that.
has comment: http://stackoverflow.com/comment/40136246
score: 1
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25680108
has comment: http://stackoverflow.com/comment/40136118

http://stackoverflow.com/comment/39986815
type: Comment
has text: @jdphenix Actually this preempts the `IndexOutOfBoundsException` question and gets us straight to the NPE. (Assuming the OP eventually fixes the original issue.)
type: AnswerComment
comment on: http://stackoverflow.com/a/25598997
score: 0

http://stackoverflow.com/comment/40130350
type: Comment
type: QuestionComment
has text: Also, I've already looked at the oracle tutorial and I'm still stuck without understanding how to move on from there.
comment on: http://stackoverflow.com/q/25677810
score: 0

http://stackoverflow.com/a/25566705
answers question: http://stackoverflow.com/q/25565706
score: 14
upvote count: 14
has comment: http://stackoverflow.com/comment/40021494
downvote count: 0
has body: Although you should not be worried much about the internal structures if you are just beginning to learn Spring but for the sake of knowledge in almost all cases the underlying class is DefaultSingletonBeanRegistry and as you can see by going through the source code here it maintains a ConcurrentHashMap of singleton objects. Also there are similar other map object for other information being stored. private final Map&lt;String, Object&gt; singletonObjects = new ConcurrentHashMap&lt;String, Object&gt;(64);
type: Answer

http://stackoverflow.com/comment/56816579
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25652579
has text: For Kotlin 1.0 and beyond this will no longer be an issue. the ABI version inside the class files will be the same. That is mostly true now in the betas, but there will be one more forced recompilation at the release candidate for 1.0 soon.

http://stackoverflow.com/a/25592831
type: Answer
has body: Do you really need to use an array for your use-case ? Most of the time it is more comfortable working with collections : List&lt;String&gt; fruits = Arrays.asList("Peach", "Orange", "Banana", "Plum", "Apple", "Strawberry", "Mango", "Kiwi"); int i = fruits.indexOf("Apple");
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25592776
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/25592776

http://stackoverflow.com/q/25689872
has comment: http://stackoverflow.com/comment/40152561
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40151924
has comment: http://stackoverflow.com/comment/40151751
answer count: 2
has comment: http://stackoverflow.com/comment/40179310
upvote count: 2
has title: How to parse JSON object by Jackson if type of one field is unknown
has body: I have a JSON response that I try to parse with Jackson, and type of one of fields is unknown. Exapmle: {"name" : "Catalina"} OR {"name" : {"First" : "Catalina", "Last" : "Kyle"}} How I can deserialize that object into POJO: class NamesHolder { public String singleName; public Map&lt;String, String&gt; nameMap; } This is synthetic example but I hope it clear for understanding. In first case I want to have object with singleName == "Catalina" and nameMap == null, and vice versa in other case. UPDATE I am really sorry, at the end of day I misspelled the property name. In both cases they are the same: name.
accepted answer: http://stackoverflow.com/a/25699821
tagged with: jackson
has answer: http://stackoverflow.com/a/25699821
downvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25704725
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25704725

http://stackoverflow.com/comment/40056126
type: QuestionComment
score: 0
has text: put infinite loop in your `run` mehod for listening on queue. It is exiting before anything goes in the list.
comment on: http://stackoverflow.com/q/25636877
type: Comment

http://stackoverflow.com/comment/40056131
comment on: http://stackoverflow.com/q/25636907
has text: There is very good explanation to this question http://stackoverflow.com/questions/47605/string-concatenation-concat-vs-operator
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25644845
answers question: http://stackoverflow.com/q/25644812
score: 0
has body: You have only local variables in constructor. public class BMI { String name; double height, weight; public BMI(String name, double height, double weight){ this.name = name; this.height = height; this.weight = weight; } public double getBMI() { return (weight/height); } public String toString() { return name + "is" + height + "tall and is " + weight + "and has a BMI of" + getBMI() ; } public static void main(String[] args) { BMI obj = new BMI("John",77,44); System.out.println(obj); //or double bmi = obj.getBMI(); System.out.println("BMI = "+bmi); }
type: Answer

http://stackoverflow.com/comment/40116121
type: Comment
comment on: http://stackoverflow.com/a/25670133
score: 0
type: AnswerComment
has text: Ok thank you. Also please can you tell me how to have images (as in the ic_launcher above) to be set dynamically. I mean I am thinking of implementing images for corresponding rating. Eg: if the rating is 4 out of 5, then I will have an image of 4 stars. I am asking for relevant code or example and not how to create the image (in photoshop).

http://stackoverflow.com/q/25690708
has answer: http://stackoverflow.com/a/25718404
tagged with: magnolia
answer count: 2
downvote count: 0
upvote count: 1
tagged with: sql
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/25692717
tagged with: java
has body: I have the below node structure in JCR repo. I am struggling to retrieve the parent (12345) node given child node(789). /12345/items/789 I have tried: SELECT parent.* FROM [nt:base] AS parent INNER JOIN [nt:base] AS child ON ISCHILDNODE(child,parent) WHERE name(child) = '789' but I keep getting "This query result contains more than one selector" result. I have to do this using sql or jcr-sql2, I don't want to use java for example to retrieve parent of parent. thanks in advance
favorite count: 0
type: Question
has title: How do you retrieve parent name from child name using SQL from JCR
tagged with: jcr

http://stackoverflow.com/comment/39955232
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25560383
has text: I have no idea about line of exception. It's not like program do not run at all. It runs and exception occur during the execution, and it repeats every time I am clicking on the table.

http://stackoverflow.com/a/25557286
answers question: http://stackoverflow.com/q/25553813
score: 4
has comment: http://stackoverflow.com/comment/40199165
has comment: http://stackoverflow.com/comment/39909715
has body: Browsers and Java use different set of trusted root certificates, by default Browsers get this info from OS, Java supports own list, that's why it could be green in Browser and doesn't support in Java To check what certificates support your version of Java: &lt;jre_path&gt;\bin\keytool -keystore "&lt;jre_path&gt;\lib\security\cacerts" -storepass changeit -list And if you don't see your certificate just add it to &lt;jre_path&gt;\lib\security\cacerts file.
type: Answer
has comment: http://stackoverflow.com/comment/40260600
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/25688744
accepted answer: http://stackoverflow.com/a/25688865
has comment: http://stackoverflow.com/comment/40149950
has answer: http://stackoverflow.com/a/25688865
has comment: http://stackoverflow.com/comment/40149580
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40150115
tagged with: key
downvote count: 1
favorite count: 0
type: AnsweredQuestion
has title: How to use doubles as keys in Java
tagged with: hashmap
tagged with: double
tagged with: java
has body: I have a csv data file that represent the trajectory of a body. The format is t, x, y, x. I want to store the history of that particle in a sort of HashMap in order to easily access the coordinates at a given time without read the file every time. My fear is that keys and values are objects, not primitives types. So, is a good idea to do something like this? For example I suppose that to fill the HashMap the Doubles have to be globally defined so that their address is well-defined for successive access... Right?
score: -1
has comment: http://stackoverflow.com/comment/40149698
has comment: http://stackoverflow.com/comment/40149594
type: Question
has comment: http://stackoverflow.com/comment/40149848

http://stackoverflow.com/comment/40193690
score: 0
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/60786/discussion-between-bright-and-pointy).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25711799

http://stackoverflow.com/q/25694360
has answer: http://stackoverflow.com/a/25697013
has body: We are having a spring application in production and it seems that it is leaking threads. When I do a thread dump, I see the following threads that seems to be waiting. Here's an example below, but there are thousands of them "SimpleAsyncTaskExecutor-1801" prio=10 tid=0x00007fa668413800 nid=0x376c waiting on condition [0x00007fa4fbaff000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for &lt;0x00000007777e2ba8&gt; (a java.util.concurrent.CountDownLatch$Sync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834) at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:994) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1303) at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:236) at org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel.receive(MessagingTemplate.java:415) at org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel.receive(MessagingTemplate.java:409) at org.springframework.integration.core.MessagingTemplate.doReceive(MessagingTemplate.java:317) at org.springframework.integration.core.MessagingTemplate.doSendAndReceive(MessagingTemplate.java:341) at org.springframework.integration.core.MessagingTemplate.sendAndReceive(MessagingTemplate.java:255) at org.springframework.integration.core.MessagingTemplate.convertSendAndReceive(MessagingTemplate.java:290) at org.springframework.integration.gateway.MessagingGatewaySupport.doSendAndReceive(MessagingGatewaySupport.java:224) at org.springframework.integration.gateway.MessagingGatewaySupport.sendAndReceive(MessagingGatewaySupport.java:203) at org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean…
tagged with: multithreading
answer count: 1
downvote count: 0
upvote count: 1
tagged with: integration
favorite count: 0
type: Question
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25697013
has title: Spring Integration: Application leaking SimpleAsyncTaskExecutor threads?
score: 1
tagged with: java

http://stackoverflow.com/a/25707481
downvote count: 1
type: Answer
upvote count: 4
score: 3
has body: Short answer: No. By default, servlets are not thread safe, and getter/setter methods (auto-generated by annotations, or manually coded) are not thread safe. if you need read/write access, and you also need thread safety, then you need to synchronize access. Look at Handling threading issues in the Oracle documentation. Personally, I prefer to hand-code getter and setter methods. In part, for situations like this.
answers question: http://stackoverflow.com/q/25707433
has comment: http://stackoverflow.com/comment/40184357

http://stackoverflow.com/q/25640323
has comment: http://stackoverflow.com/comment/40066604
tagged with: spring
tagged with: properties
type: AnsweredQuestion
tagged with: spring-boot
accepted answer: http://stackoverflow.com/a/25646561
has comment: http://stackoverflow.com/comment/40066447
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25646561
answer count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40063189
has title: External configuration in Spring Boot and one-off testing
has body: Spring boot has an ability to externalize the configuration, which means you can work with the same application code in different environments. You can bundle an application.properties inside your jar that provides a sensible default name. When running in production, an application.properties can be provided outside of your jar that overrides name; and for one-off testing, you can launch with a specific command line switch: java -jar app.jar --name="Spring" What does one-off testing actually mean? How can I work with the same application code in different environments?
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39976059
comment on: http://stackoverflow.com/q/25590422
type: Comment
score: 0
type: QuestionComment
has text: possible duplicate of [Values of excel field is getting 3.0E9 where I need 3000000000 when trying to parse](http://stackoverflow.com/questions/25397377/values-of-excel-field-is-getting-3-0e9-where-i-need-3000000000-when-trying-to-pa)

http://stackoverflow.com/comment/40034657
score: 0
comment on: http://stackoverflow.com/q/25624672
type: Comment
type: QuestionComment
has text: @stealthjong: You mean a wrapper around the referenced class? Could you provide me with a short example please?

http://stackoverflow.com/q/25556004
score: 7
tagged with: android
upvote count: 7
tagged with: java
has comment: http://stackoverflow.com/comment/39906816
has comment: http://stackoverflow.com/comment/39907022
type: Question
answer count: 2
tagged with: parse-platform
has answer: http://stackoverflow.com/a/25561427
has comment: http://stackoverflow.com/comment/39906892
tagged with: pointers
has body: In my current class, say A, I have a column which is a pointer to another class, say B. Can anyone please let me know how I can set a value for this column in Android? I have tried fetching the required row from class B as a ParseObject, and doing a: classAObject.put("column_name",classBParseObject); But, this is just creating an empty row in my class A, with no pointers. Any help in this regard is much appreciated.
has comment: http://stackoverflow.com/comment/39907356
favorite count: 0
has answer: http://stackoverflow.com/a/28403968
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39907066
possible better answer: http://stackoverflow.com/a/28403968
has comment: http://stackoverflow.com/comment/39906935
downvote count: 0
accepted answer: http://stackoverflow.com/a/25561427
has title: Parse: How to set a pointer in Android?

http://stackoverflow.com/comment/40091155
comment on: http://stackoverflow.com/q/25652892
has text: That's fair. (You can't use cell editors in a `List`, I don't think.) I have done something similar to this with a resize listener but I recall it being prickly.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25695205
tagged with: interface
has comment: http://stackoverflow.com/comment/40162328
accepted answer: http://stackoverflow.com/a/25695384
has comment: http://stackoverflow.com/comment/40162219
has answer: http://stackoverflow.com/a/25695514
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25695384
answer count: 3
has body: Trying to get a handle on "callback interface". The concept as I understand it make sense except for the following //FromSomeClass1 MyInterface conect; public void setInterface(MyInterface myInter) { this.conect=myInter; } interface MyInterface { public void update(String str); } (Fuzziness starts here) So when another class attempts to //FromSomeClass2 implements MyInterface ...onCreate() { SomeClass1 newC = new SomeClass1() newC.setInterface(this) ; } update(String str){ ....code } this will not work because I am passing to a new object ? Unless I make the "conect" variable in Class1 static (Good Idea bad Idea...consequences ???) Simply what is the correct way to pass the object back to "setInterface" method . Hope that made sense and Thank You. p.s. To all those who want a good understanding of call backs this link will help.
downvote count: 0
tagged with: java
favorite count: 0
possible better answer: http://stackoverflow.com/a/25695439
type: Question
has title: How to pass Object Context to a callback interface in Java
has answer: http://stackoverflow.com/a/25695439
upvote count: 2

http://stackoverflow.com/q/25706971
answer count: 2
has comment: http://stackoverflow.com/comment/40183541
possible better answer: http://stackoverflow.com/a/25707125
accepted answer: http://stackoverflow.com/a/25706998
has answer: http://stackoverflow.com/a/25706998
has body: I'm making a family tree program. I've been trying to figure out how to copy objects from a Hashtable into an ArrayList (just the object Person, not the String). I have a Hashtable of children, which are Person objects. I want to check to see if the currentPerson I am working on in the program has children, and if so, add those children to an ArrayList childList. I've been working on this for a couple of hours and cannot seem to figure it out. import java.util.ArrayList; import java.util.HashSet; import java.util.Hashtable; public class FamilyInfo { //////////// instance variables // hash table that tells the father of a named person, if known private Hashtable&lt;String, Person&gt; fathers; // hash table that tells the mother of a named person, if known private Hashtable&lt;String, Person&gt; mothers; // hash table that tells the children of a named person, if any are known. // In theory the father, mother and children tables should be kept consistent private Hashtable&lt;String, HashSet&lt;Person&gt;&gt; children; /** * constructor -- initializes instance variables */ public FamilyInfo() { // initialize everything to be empty collections of the appropriate type fathers = new Hashtable&lt;String, Person&gt;(); mothers = new Hashtable&lt;String, Person&gt;(); children = new Hashtable&lt;String, HashSet&lt;Person&gt;&gt;(); } public ArrayList&lt;String&gt; grandchildNames(Person currentPerson) { // return a dummied up name telling that the method is not implemented ArrayList&lt;String&gt; rtnVal = new ArrayList&lt;String&gt;(); //Create an ArrayList that will hold the child ArrayList&lt;Person&gt; childList = new ArrayList&lt;Person&gt;(); //Create an ArrayList that will hold the granchildren ArrayList&lt;Person&gt; grandchildList = new ArrayList&lt;Person&gt;(); //Add children to the child list if(children.get(currentPerson.getName()) != null) { //add the children to childList from the children hashtable } return rtnVal; }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40183528
score: 0
has title: How do I iterate through a Hashtable, then add the objects to an ArrayList?
tagged with: java
has answer: http://stackoverflow.com/a/25707125
type: Question

http://stackoverflow.com/a/25682290
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25662899
type: Answer
has body: OK, I managed to do this by checking whether the last hovered element on the Menubar was the menuItem that opens the window. To do this, I had to subclass the default MenuBar class and exposing the getSelectedItem() method (it was protected by default, why?) @UiField MyMenuBar myMenuBar; .... menuItem.setScheduledCommand(new ScheduledCommand() { @Override public void execute() { if (!wasHoveredWhenClosed) { window.init(); window.addCloseHandler(new CloseHandler&lt;PopupPanel&gt;() { @Override public void onClose(final CloseEvent&lt;PopupPanel&gt; event) { wasHoveredWhenClosed = myMenuBar.getSelectedItem() != menuItem; } }); window.show(); } else { wasHoveredWhenClosed = false; } } });
accepted answer of: http://stackoverflow.com/q/25662899
score: 0

http://stackoverflow.com/q/25650629
has comment: http://stackoverflow.com/comment/40111199
score: 0
answer count: 2
tagged with: assert
has comment: http://stackoverflow.com/comment/40094829
has comment: http://stackoverflow.com/comment/40080893
has body: While automating the test script, I've been trying to refactor / extract a method from this line: assertEquals("Enter your password.", textError); the result being: public void assertEquals() { assertEquals("Enter your password.", textError); } When I give it a parameter: public void assertEquals(String textValue) { assertEquals(textValue, textError); } I receive an error: The method assertEquals(String) in the type LoginPageTests is not applicable for the arguments (String, String) And when I add the second String: public void assertEquals(String textValue, String textError) { ... } tests fail. What's my problem, please? Here's the entire class: import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; import com.thoughtworks.selenium.*; public class LoginPageTests { private static Selenium selenium; LoginPage loginPage = new LoginPage(selenium); @BeforeClass public static void setUp() throws Exception { selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://gmail.com/"); selenium.start(); selenium.windowMaximize(); selenium.open("/"); } @Test // correct login, no pwd public void TestMethod0() throws Exception { loginPage.typeEmail("111"); loginPage.typePwd(""); loginPage.submit(); assertTrue(loginPage.countError() &gt; 0); loginPage .getText("//span[@id='errormsg_0_Passwd' and @class='error-msg']"); assertEquals("Enter your password.", loginPage.textError); } @Test // correct login, wrong pwd OR wrong login, correct pwd public void TestMethod1() throws Exception { loginPage.typeEmail("222"); loginPage.typePwd("foo"); loginPage.submit(); loginPage .getText("//span[@id='errormsg_0_Passwd' and @class='error-msg']"); assertEquals("The email or password you entered is incorrect. ?", loginPage.textError); } @Test // no login, correct pwd public void TestMethod2() throws Exception { loginPage.typeEmail(""); loginPage.typePwd("foo"); loginPage.submit(); loginPage .getText("//span[@id='errormsg_0_Email…
tagged with: java
has comment: http://stackoverflow.com/comment/40088248
tagged with: selenium
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40091059
has answer: http://stackoverflow.com/a/25677503
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40128840
has comment: http://stackoverflow.com/comment/40087396
has title: Refactoring code for automation with Selenium
has answer: http://stackoverflow.com/a/25655259
tagged with: selenium-webdriver

http://stackoverflow.com/a/25611235
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25611178
score: 1
has body: When you write sum = d1+d2; it isn't sure what exactly to add. Since your Die class has a method for getting it's value, use that instead. sum = d1.getFaceValue() + d2.getFaceValue(); Those methods return ints which can then be added. Also, as taken from manouti's comment, the sum you are using in your game is going to always be 2 since you calculate it, then roll, then use the sum from the first part. You should calculate the sum immediately after rolling the dice.
answers question: http://stackoverflow.com/q/25611178
type: Answer
downvote count: 0

http://stackoverflow.com/comment/42763192
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27108351
has text: Will try that and will let you know
type: Comment

http://stackoverflow.com/comment/39957376
comment on: http://stackoverflow.com/q/25579876
has text: I'm going to try uninstalling, and reinstalling the JRE instead of the JDK.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39937998
type: AnswerComment
has text: use IndicesAliasesRequestBuilder instead of IndeicesAliasesRequest. Then you can call execute().actionGet(); If you want to make sure re-index succeeded completely without issue, you need to get the response. calling BulkRequestBuilder.execute().actionGet() returns a BulkResponse object. this object has a method called 'hasFailures()' as well as an iterator<BulkItemResponse>. Each BulkItemResponse has an 'isFailed()' method as well if you wnat to know which one failed.
comment on: http://stackoverflow.com/a/25559402
type: Comment
score: 0

http://stackoverflow.com/a/25615631
downvote count: 0
upvote count: 4
type: Answer
accepted answer of: http://stackoverflow.com/q/25615423
score: 4
answers question: http://stackoverflow.com/q/25615423
has body: Try executing the program as it is windows OS java -cp .;path\of\your\mysql-connector-java-5.1.6.jar className In case you don't have the mysql-connector-java-[version].jar get it from here
type: AcceptedAnswer

http://stackoverflow.com/q/25702200
answer count: 0
upvote count: 2
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/40195065
favorite count: 0
tagged with: audio
linked to: http://stackoverflow.com/q/557903
has comment: http://stackoverflow.com/comment/40175611
has body: Hello I have kind a weird problem. import java.io.*; import javax.sound.sampled.*; public class Sound { public void newGame() { AudioInputStream audioInputStream = null; try { audioInputStream = AudioSystem.getAudioInputStream(getClass().getClassLoader().getResource("files" + File.separator + "newGame.wav")); AudioFormat audioFormat = audioInputStream.getFormat(); DataLine.Info info = new DataLine.Info(Clip.class, audioFormat); Clip clip = (Clip) AudioSystem.getLine(info); clip.open(audioInputStream); clip.start(); } catch (UnsupportedAudioFileException | IOException | LineUnavailableException e) { System.out.println(e.getMessage()); System.exit(-1); } finally { try { if(audioInputStream != null) { audioInputStream.close(); } } catch (IOException e) { System.out.println(e.getMessage()); System.exit(-1); } } } } I use this code to play sound at the beggining of the new game. When I run my project from Netbeans IDE everything works just fine but when I build the project and I run it by clicking on the .jar file I begin a new game and the sound is played just for like a half second instead of four seconds. I have no idea why.
tagged with: java
has title: Java clip too short when project runned outside netbeans
type: Question
score: 2
has comment: http://stackoverflow.com/comment/40185434
tagged with: netbeans

http://stackoverflow.com/a/25594228
has comment: http://stackoverflow.com/comment/40018342
downvote count: 0
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25589714
has body: Codename One supports pointer* events that accepts int[] as the argument. Same signature as above only with two arrays e.g.: public void pointerPressed(int[] x, int[] y) public void pointerDragged(int[] x, int[] y) public void pointerReleased(int[] x, int[] y) You can also override the pinch method to capture that specific gesture: http://www.codenameone.com/blog/in-a-pinch
has comment: http://stackoverflow.com/comment/40017600
score: 1
answers question: http://stackoverflow.com/q/25589714
type: Answer
has comment: http://stackoverflow.com/comment/40004708
has comment: http://stackoverflow.com/comment/39987137

http://stackoverflow.com/q/25624500
type: Question
has title: Hql clause is null in clause case , not working as in mysql
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25629579
score: 0
has comment: http://stackoverflow.com/comment/40039055
has comment: http://stackoverflow.com/comment/40034127
tagged with: java
answer count: 1
tagged with: mysql
accepted answer: http://stackoverflow.com/a/25629579
has body: I made one query in mysql. SELECT COALESCE(SUM(t2.ammout * CASE WHEN t2.idAccountDeb = :accountSelec AND (t2.idAccountDeb &lt;&gt; t2.idAccountCred OR t2.idAccountCred IS NULL) THEN 1 WHEN t2.idAccountCred = :accountSelec AND (t2.idAccountDeb &lt;&gt; t2.idAccountCred OR t2.idAccountDeb IS NULL) THEN -1 ELSE 0 END),0) FROM TransactionAccount t2 WHERE (t2.idAccountDeb = :accountSelec OR t2.idAccountCred = :accountSelec) AND t2.dtInf &lt;= :dateSelec I tried to convert in Hql SELECT COALESCE(SUM(t2.ammout * CASE WHEN t2.accountDeb = :accountSelec AND (t2.accountDeb &lt;&gt; t2.accountCred OR t2.accountCred IS NULL) THEN 1 WHEN t2.accountCred = :accountSelec AND (t2.accountDeb &lt;&gt; t2.accountCred OR t2.accountDeb IS NULL) THEN -1 ELSE 0 END),0) FROM TransactionAccount t2 WHERE (t2.accountDeb = :accountSelec OR t2.accountCred = :accountSelec) AND t2.dtInf &lt;= :dateSelec But in hql is returning 0.00, this END),0) . In mysql, 150.97. This occurs, when account debit or account credit is null. What am I doing wrong? Example: If transaction contain one account credit or account debit with value null,the query can not capture in the clause "is null". My beans: @Entity public class Account implements Serializable { @Id @GeneratedValue private long id; @Column(length = 40) private String cod; private boolean credit; private String name;//CTA @OneToOne @JoinColumn(name = "idCompany") private Company company; @Version private int version; //getter and setters } @Entity public class Transaction implements Serializable { @Id @GeneratedValue private long id; private String history; @JoinColumn(name = "idAccountDeb") @OneToOne private Account accountDeb; @JoinColumn(name = "idAccountCred") @OneToOne private Account accountCred; private BigDecimal ammount; @Temporal(TemporalType.DATE) private Date dtInf; @Temporal(TemporalType.TIMESTAMP) private Date dtPosted; @Temporal(TemporalType.TIMESTAMP) private Date dtModif; private TypeTransaction type; @Version private int version; }
tagged with: hql

http://stackoverflow.com/comment/40109021
comment on: http://stackoverflow.com/a/25649753
type: Comment
has text: You have logins and passwords in the UserList file. Also your way works with terminal by java -jar <<nameOfTheJar>>, but when I want to double click that jar with a mouse it is not working. Do u have any idea how to change it ?
type: AnswerComment
score: 0

http://stackoverflow.com/a/25598789
accepted answer of: http://stackoverflow.com/q/25597814
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25597814
has body: When you go Long sum; ... sum += 1; the JVM, in theory, allocates a new Long each time, cause Longs are immutable. Now, a really smart compiler could do something smart here, but this explains why your time for the second loop is so much larger. It is allocating Integer.MAXINT new Sum objects. Yet another reason Autoboxing is tricky. The two other loops do not require allocating new Objects. One uses a primitive int, and in the other you can increment Performance.sum without needing to allocate a new Performance each time. Accessing the primitive int on the stack or in the heap should be roughly equally fast, as shown. Your timings have very little to do with heap vs. stack speed of access, but everything to do with allocating large numbers of Objects in loops. As others have noted, micro benchmarks can be misleading.
upvote count: 1
type: Answer

http://stackoverflow.com/q/25587858
upvote count: 2
type: AnsweredQuestion
score: 2
has body: Android SQLLite gives me the following error: SQLiteStatement tgStatement = dbo.compileStatement("INSERT OR REPLACE INTO Game_Team" + "(teamId, gameId, pos, score) VALUES (?,?,?,?) "); Thats why I try to do: tgStatement.bindLong(0, 1); I get an error java.lang.IllegalArgumentException: Cannot bind argument at index 0 because the index is out of range. The statement has 4 parameters. So, my question is, if there are 4 parameters, why is it complaining about argument at index 0? how is that out of range?
tagged with: java
tagged with: sqlite
answer count: 3
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/25587954
has answer: http://stackoverflow.com/a/25587879
has title: java.lang.IllegalArgumentException: Cannot bind argument at index 0 because the index is out of range. The statement has 4 parameters
has answer: http://stackoverflow.com/a/25587954
type: Question
accepted answer: http://stackoverflow.com/a/25587890
tagged with: android
has answer: http://stackoverflow.com/a/25587890

http://stackoverflow.com/q/25609869
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25653995
tagged with: java
has body: I've been trying to marshal/unmarshal some JSON and XML files for my project using Eclipse MOXy. After a set of tests I ran into javax.xml.bind.PropertyException and it seems that my jaxb.properties file isn't being read and therefore the JAXBContextFactory being used is wrong. I am using Eclipselink (MOXy) 2.5.2. I have added jaxb.properties to the same folder where my class is, with the following content: javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory And this is my test class: public static void main(String[] args) throws Exception { JAXBContext jaxbContext = JAXBContext.newInstance(SIRFCatalog.class); System.out.println(jaxbContext.getClass()); // SIRFCatalog catalog; // Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); // ** The exception is thrown in the line below:** // jaxbUnmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); // jaxbUnmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); // FileInputStream fis = new FileInputStream(new File("/home/philviana/a.json")); // catalog = (SIRFCatalog) jaxbUnmarshaller.unmarshal(fis); } When I run the test above (please see that the useful code is commented out), I get the following output: class com.sun.xml.bind.v2.runtime.JAXBContextImpl which indicates that MOXy's JAXB context factory isn't being lodead. So in other words, I want to use org.eclipse.persistence.jaxb.JAXBContextFactory as my JAXBContextFactory (comes from MOXy) but instead I'm getting the RI's class com.sun.xml.bind.v2.runtime.JAXBContextImpl. The jaxb.properties file is under the same directory as my class with the main method (only class of my project). These are my JARs: eclipselink.jar com.sun.tools.xjc_2.2.0.jar com.sun.xml.bind_2.2.0.v201004141950.jar javax.activation_1.1.0.v201108011116.jar javax.mail_1.4.0.v201005080615.jar javax.xml.bind_2.2.0.v201105210648.jar javax.xml.stream_1.0.1.v201004272200.jar org.eclipse.persistence.antlr-2.5.2.jar org.ec…
has answer: http://stackoverflow.com/a/25653995
tagged with: jaxb
tagged with: moxy
tagged with: eclipse
has title: MOXy Marshalling/Unmarshalling error: javax.xml.bind.PropertyException due to wrong JAXBContextFactory being used
tagged with: http://stackoverflow.com/tag/xml
score: 2
upvote count: 2
type: AnsweredQuestion
downvote count: 0
answer count: 1

http://stackoverflow.com/q/25610400
has title: Android: memory/resource leak
answer count: 1
has answer: http://stackoverflow.com/a/25610551
has comment: http://stackoverflow.com/comment/40008299
tagged with: ddms
type: AnsweredQuestion
has body: I have a memory allocation error while running an android app I am developing. This only happens when I rotate the screen repeatedly, each rotation resulting in a little more memory being leached until the app crashes. I was kind of reluctant to make this post because the problem itself seems quite simple to solve (avoid static context references and static resource references, I think) but in the last 10 hours I've had no luck. I've had a look at some heap dump files with MAT but have no idea what it all means, I'm a first time user of that. I haven't posted any code as it's partially sensitive and I'm not sure which parts of the code to post so I will give a brief outline of it here. The activity causing the problem instantiates a sound manager class but this class is instantiated within another activity also and causes no problems there. The UI is all created in XML and consists of 25 Button elements with the same 9patch background, 3 TextViews and a Coach with 5 images within. The MAT says that suspect problem 1 is android.widget.FrameLayout and suspect problem 2 is byte [] Any help would be insanely appreciated and if any more information is required I'll go ahead and edit to include it. Thank you so much, Tim. After some more trial and error (commenting out every bit of code and introducing each part bit by bit) I learned that my problem was caused by this line, which related to Google AdMob interstitial ads: interstitial.loadAd(adRequest); changing the following line solved the issue: interstitial = new InterstitialAd(this); to interstitial = new InterstitialAd(getApplicationContext());
score: 0
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25610551
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40007994
tagged with: admob
type: Question
has comment: http://stackoverflow.com/comment/40007748

ubuntu-14.04
tags question: http://stackoverflow.com/q/25612668
type: Tag
tags question: http://stackoverflow.com/q/25695299
tag name: ubuntu-14.04
tags question: http://stackoverflow.com/q/25563539

http://stackoverflow.com/comment/40277912
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25683101
type: Comment
has text: First, when I try to compile the code you gave me, I get this error: Error: /Users/Alfred/Sounds.java:15: cannot find symbol symbol: class Main. Second, is the "/path/to/sounds/" a comment on what url is supposed to be, or is it a placeholder for something I need to add? I'm not sure if I'm even asking the right questions, but thanks for the help!

http://stackoverflow.com/comment/40205101
comment on: http://stackoverflow.com/q/25697135
score: 1
has text: You need some time measurent functions. I dont know which ones exist for java on android, but google and stackoverflow will probably help you. This for example: http://stackoverflow.com/questions/5369682/get-current-time-and-date-on-android
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25591678
upvote count: 1
answers question: http://stackoverflow.com/q/25591633
type: AcceptedAnswer
has body: try Setting scaleType to your ImageView android:scaleType="fitXY" Edit : Try Changing LinearLayout height : &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"&gt;
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25591633
has comment: http://stackoverflow.com/comment/39973510

http://stackoverflow.com/comment/40014086
type: QuestionComment
comment on: http://stackoverflow.com/q/25613927
type: Comment
has text: Have you tried using an enhanced for loop and the .remove() method?? And a synchronized class?
score: 1

http://stackoverflow.com/q/25684807
score: 2
upvote count: 2
has title: Can't start fragment from activity
type: AnsweredQuestion
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25685329
tagged with: java
has comment: http://stackoverflow.com/comment/40142507
tagged with: overlapping
has comment: http://stackoverflow.com/comment/40142797
has answer: http://stackoverflow.com/a/25685368
accepted answer: http://stackoverflow.com/a/25685368
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40142583
possible better answer: http://stackoverflow.com/a/25685329
has comment: http://stackoverflow.com/comment/40142987
tagged with: android
has comment: http://stackoverflow.com/comment/40142429
has body: I am trying to start a fragment from activity but it doesn't work, can somebody help? This is the main.java public class MainActivity extends FragmentActivity { Button clickButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); clickButton = (Button)findViewById(R.id.button1); click(); } @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 void click() { clickButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Log.i("click","clickt"); FragmentOne fragmentOne = new FragmentOne(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.fragmentcontainer, fragmentOne); transaction.addToBackStack(null); transaction.commit(); } }); } This is the main layout &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" 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.testfragment.MainActivity" &gt; &lt;FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2" android:id="@+id/fragmentcontainer"&gt; &lt;/FrameLayout&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/textVie…
has comment: http://stackoverflow.com/comment/40142799

http://stackoverflow.com/comment/40132326
type: Comment
score: 0
type: AnswerComment
has text: Hey My friends I have done searching by reading @Mostfoolish and thanks man. I found this I am sharing with you which will helpful to all of you. 1. what are the functionality provided by the cglib to spring framework ? 2. what are the functionality provided by the asm to spring framework ? 3. Difference between cglib and asm ?
comment on: http://stackoverflow.com/a/25666829

http://stackoverflow.com/comment/39967464
type: Comment
type: AnswerComment
has text: I need that URL to be reverted back to me so that I can save that url to my server and use it where ever i want to.
comment on: http://stackoverflow.com/a/25588306
score: 0

http://stackoverflow.com/comment/123923661
type: Comment
score: 2
has text: Thanks @Sam, I've had some issues in my todo list, and I thought it had something to do with some concurrency issues on the stream, but now that I think about it , it may very well be this the problem since my wifi sometimes disconnects, I think it may also arise in non SIM devices, that are connected with wifi only, since I've tried reconnecting to the wifi (which is supposed to be working fine), and no reaction occurs, and a hard listener reconnection (un-register then register) is required.
type: AnswerComment
comment on: http://stackoverflow.com/a/66517237

http://stackoverflow.com/a/25596854
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39983894
score: 1
type: Answer
has body: You could take a very simple approach: public interface Foo { String getName(); } public class Named implements Foo { String name; public String getName() { return name; } } public class FooImpl1 extends Named { {name = "foo name1";} } public class FooImpl2 extends Named { {name = "foo name2";} }
has comment: http://stackoverflow.com/comment/39983917
answers question: http://stackoverflow.com/q/25596352

http://stackoverflow.com/a/25591186
has body: I found my problem, it was not a problem with the cache it was with the Persistence Manager. I was using 2 instances of the PM and this was the reason for the discrepancies.
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25589524
type: Answer

http://stackoverflow.com/q/25597592
has comment: http://stackoverflow.com/comment/39984732
has comment: http://stackoverflow.com/comment/39985649
has comment: http://stackoverflow.com/comment/39985522
score: 2
upvote count: 2
type: AnsweredQuestion
tagged with: java
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25599126
favorite count: 0
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/39984668
accepted answer: http://stackoverflow.com/a/25612776
type: Question
has answer: http://stackoverflow.com/a/25612776
has body: I am making a java servlet and am trying to make it display a preview of 3 different articles. I want it to preview the first sentence of each article, but can't seem to get split to work properly since I am reading the articles in with tokenizer. So I have something like: while ((s = br.readLine()) != null) { out.println("&lt;tr&gt;"); StringTokenizer s2 = new StringTokenizer(s, "|"); while (s2.hasMoreElements()) { if (index == 0) { out.println("&lt;td class='first'&gt;" + s2.nextElement() + "&lt;/td&gt;"); } out.println("&lt;/tr&gt;"); } index = 0; } How do I make s2.nextElement print out only the first sentence instead of the whole article? I imagine I could do split with a delimiter of ".", but can't get the code to work right. Thanks.
possible better answer: http://stackoverflow.com/a/25598240
has title: Split command on a nextElement
has answer: http://stackoverflow.com/a/25598240

http://stackoverflow.com/q/25609682
accepted answer: http://stackoverflow.com/a/25796749
downvote count: 0
tagged with: java
answer count: 1
has body: I am trying to use the same iterator over a period of time in leveldb. Once I create an iterator, if there are changes from another thread, will leveldb iterator provide those changes? Or do I have to create an another iterator?
tagged with: leveldb
favorite count: 0
has comment: http://stackoverflow.com/comment/40006924
type: Question
has answer: http://stackoverflow.com/a/25796749
has title: Does iterator continuously provide current view of the underlying data in LevelDB?
has comment: http://stackoverflow.com/comment/40028895
score: 2
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/q/25665867
tagged with: regex
tagged with: manifest.mf
linked to: http://stackoverflow.com/q/13548573
type: AnsweredQuestion
has title: How to load a whole directory using Class-Path: jar manifest header?
upvote count: 3
downvote count: 0
answer count: 1
tagged with: jar
duplicate of: http://stackoverflow.com/q/13548573
tagged with: relative-path
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/32246212
score: 3
has answer: http://stackoverflow.com/a/32246212
has body: If in the manifest for a jar file that needs to load non executable jars, I have the Class-Path: specification and then a directory holding the jars as the class path instead of a jar file. Will the manifest then load the whole directory or will it just fail? Update: I tried to use Class-Path: foo/* however it failed to load the foo directory. Does the manifest classpath not support regex>
tagged with: java

http://stackoverflow.com/q/25562045
has answer: http://stackoverflow.com/a/25562086
has comment: http://stackoverflow.com/comment/39918154
type: Question
has comment: http://stackoverflow.com/comment/39919081
possible better answer: http://stackoverflow.com/a/25562072
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/39918197
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/25562072
has answer: http://stackoverflow.com/a/25562075
has comment: http://stackoverflow.com/comment/39918176
has comment: http://stackoverflow.com/comment/39918143
has comment: http://stackoverflow.com/comment/39918181
duplicate of: http://stackoverflow.com/q/218384
type: AnsweredQuestion
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39918159
has title: Scanner nextLine issue
tagged with: java
accepted answer: http://stackoverflow.com/a/25562086
has comment: http://stackoverflow.com/comment/39919098
has body: I am writing a code which reads the following input 3 Ruby Diamond Sapphire Here is my program import java.util.Scanner; public class GemStones { private int numOfStones; private String[] gemArray; public void solve() throws Exception{ Scanner in = new Scanner(System.in); //Reading the integer numOfStones = Integer.parseInt(in.nextLine()); //in.nextLine(); System.out.println(numOfStones); //reading the strings for(int i=0;i&lt;numOfStones;i++){ gemArray[i] = in.nextLine(); System.out.println(gemArray[i]); } for(int i=0;i&lt;numOfStones;i++){ System.out.println(gemArray[i]); } in.close(); } public static void main(String[] args) throws Exception { GemStones check = new GemStones(); check.solve(); } } I have a problem reading the strings following it. Whenever I try to read the strings it shows me error! please help me.. The following is the error I get in the console 3 Ruby Diamond Sapphire3Exception in thread "main" java.lang.NullPointerException at com.sudarabisheck.easy.GemStones.solve(GemStones.java:23) at com.sudarabisheck.easy.GemStones.main(GemStones.java:37)

http://stackoverflow.com/a/25576244
answers question: http://stackoverflow.com/q/25576178
has body: In persistence.xml among others, you should have something like this: &lt;persistence-unit name="myPersistenceUnit"&gt; When you're creating the EntityManagerFactory make sure to give the same name as defined in the file: Persistence.createEntityManagerFactory("myPersistenceUnit"); In your case you have "Sub" in code and "Application" in the file; the code wants to create one with the name "Sub" but that is not defined, hence the error message: No Persistence provider for EntityManager named Sub.
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/39946426
has comment: http://stackoverflow.com/comment/39946206
has comment: http://stackoverflow.com/comment/39946862
has comment: http://stackoverflow.com/comment/39945995
has comment: http://stackoverflow.com/comment/39946688

http://stackoverflow.com/comment/39960909
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25584813
score: 0
has text: Please edit that into the *question*, rather than just putting it in a comment.

http://stackoverflow.com/comment/40053887
type: Comment
comment on: http://stackoverflow.com/q/25635472
score: 0
type: QuestionComment
has text: Nevermind it worked now. Simple mistake on my end.

http://stackoverflow.com/comment/40251312
comment on: http://stackoverflow.com/q/25712595
type: Comment
type: QuestionComment
has text: I'm not sure what you mean? If I do a `remove` of the fragment it won't get `null` after that and my `getFragmentManager().findFragmentByTag("help_fragment") == null` doesn't work. Here is my current code:[link](https://gist.github.com/anonymous/26742ae64779e749aab0) But because of the "backstack poping" the visual results are not very good because if you change from about to help you'll see the main screen every time :(. Also If I use the popBackstack everytime the "go back" history is screwed up. I really need help :D.
score: 0

http://stackoverflow.com/q/25620325
has comment: http://stackoverflow.com/comment/40030007
has answer: http://stackoverflow.com/a/25622687
has comment: http://stackoverflow.com/comment/40032693
accepted answer: http://stackoverflow.com/a/25622687
type: AnsweredQuestion
has body: is there a possibility to display the progress of the serialization/deserialization process? Because I have a huge amount of Objects (200.000) and it takes 10 to 20 seconds, so I want to show the user a progress bar. Or is there a better solution/library?
answer count: 2
downvote count: 0
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40029899
has title: XStream Java display progress
has comment: http://stackoverflow.com/comment/40028485
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25643738
tagged with: xstream
has comment: http://stackoverflow.com/comment/40033092
has answer: http://stackoverflow.com/a/25643738

http://stackoverflow.com/a/25589992
has comment: http://stackoverflow.com/comment/39971432
score: 0
has comment: http://stackoverflow.com/comment/39972507
has comment: http://stackoverflow.com/comment/39972389
answers question: http://stackoverflow.com/q/25589873
has comment: http://stackoverflow.com/comment/39972194
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39972106
has comment: http://stackoverflow.com/comment/39972250
has comment: http://stackoverflow.com/comment/39971230
has comment: http://stackoverflow.com/comment/39972343
has comment: http://stackoverflow.com/comment/39971304
has comment: http://stackoverflow.com/comment/39972656
has comment: http://stackoverflow.com/comment/39971668
type: Answer
has comment: http://stackoverflow.com/comment/39972170
has comment: http://stackoverflow.com/comment/39972860
upvote count: 1
has comment: http://stackoverflow.com/comment/39971396
has body: Try this one. public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print(" please tell input with format of TITLE-CHARACTER-YEAR "); String input = scanner.nextLine(); //reads the input from console String arr[] = new String[3]; // size ur wish arr=input.split("-"); //splits the input with the - delimiter into array of strings String name=arr[1]; //contains character int year=Integer.parseInt(arr[2]); //contains year if(year&lt;2000) System.out.println( name + " 90's"); else if(year&gt;=2000 &amp;&amp; year&lt;2006) System.out.println(name + " early 2000's"); else if(year&gt;=2006) System.out.println(name + " latest"); } There are also many other ways to do it, the simple and easy to understand is this For codingbat.com check out this one. public String methodName(String input){ String arr[] = new String[3]; // size ur wish arr=input.split("-"); //splits the input with the - delimiter into array of strings String name=arr[1]; //contains character int year=Integer.parseInt(arr[2]); //contains year if(year&lt;2000) return name + " 90's"; else if(year&gt;=2000 &amp;&amp; year&lt;2006) return name + " early 2000's"; else if(year&gt;=2006) return name + " latest"; else return "wrong format"; }
downvote count: 1
accepted answer of: http://stackoverflow.com/q/25589873

http://stackoverflow.com/comment/40169697
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25699248
has text: `\w` includes `0-9`, `_` also.

http://stackoverflow.com/comment/40068423
has text: I meant the Bluetooth Chat example.
comment on: http://stackoverflow.com/a/25638926
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25660386
type: Answer
has body: I am testing the web application in my locally. However it is to be deployed over a particular node after build and release. The problem here was that the pdf file is retrieval only from the application context inside a jsp. However when I use request.getServletContext.getRealPath("/resources/myattmts/") it tries to access the actual war file in the tmp/deployment server (the actual physical location where the application is running and the file is present). And is not able to read it from there. Instead I changed the value of the hidden variable "myResourceFile" in the jsp to the application context path as jsp change: &lt;input type="hidden" id="myResourceFile" value="&lt;%=request.getContextPath("/resources/myattmts/")%&gt;"/&gt; So the file path now reads as "`http://localhost:8080/app-name/resources/myattmts/fileName.pdf" instead of the actual physical path (in the previous case which was not accessible to the jsp) as "E:/MyServer/deployments/tmp/app.war/resources/myattmts/fileName.pdf"
accepted answer of: http://stackoverflow.com/q/25601315
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/25601315

http://stackoverflow.com/comment/40093518
type: AnswerComment
has text: @Mer: Imagine you have a method that takes `T... args` (`args` has type `T[]`) and simply returns `args`, as type `T[]`. Now by passing to this varargs function and getting the result, you have accomplished `new T[...]`, which is not allowed in Java. If you understand why `new T[...]` is not allowed, and why you cannot safely replace it with `(T[])new Object[...]`, you will understand why this is unsafe.
comment on: http://stackoverflow.com/a/25655726
type: Comment
score: 2

http://stackoverflow.com/q/25705336
tagged with: applet
type: Question
has comment: http://stackoverflow.com/comment/40193658
has comment: http://stackoverflow.com/comment/40200429
type: UnansweredQuestion
has body: So I'm running into a problem here getting an applet to run. The .class file is in another directory and I've learned that you can use the codebase attribute to point to where the file is. Here is my calling code. &lt;applet codebase="/Cartographer/bin" code="CartographerApplet.class" width="300" height="150"&gt;&lt;/applet&gt; Now the .class file i'm looking for is in a package I've deemed Cartographer. My question is, is there something I'm missing? Or is my code completely wrong? I have a hunch that I'm not doing the codebase part correctly because I don't really know how to provide a shortened path without giving the whole C:\ect\ect\ect path. Edit: The root directory has the folder Cartographer in it which houses the java project for creating the app. So the path I have is what points to the .class file I need. I've tried using the code attribute with and without the Cartographer package attached to the beginning and I keep getting a class not found exception.
has comment: http://stackoverflow.com/comment/40190639
score: 0
answer count: 0
has title: Calling applet from a different directory
tagged with: java
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/comment/40027168
comment on: http://stackoverflow.com/q/25620837
score: 0
has text: http://stackoverflow.com/questions/12069494/rgb-similar-color-approximation-algorithm for *visual* closeness.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40137743
has text: the "connection.getContentLength();" is -1 and responseCode is 200
score: 0
comment on: http://stackoverflow.com/q/25682102
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25650209
score: 4
has comment: http://stackoverflow.com/comment/40107393
upvote count: 4
has body: This is not possible in Retrofit public interface ContentInterface&lt;T&gt; { @GET("/public/content/{category}") ContentResponse&lt;T&gt; getContent(@Path(PathParameters.CATEGORY) String category); } Retrofit uses the signature of the method at runtime to determine the return Type. In this case it would be a raw Class of ContentResponse and with a ParameterizedType of T which obviously wouldn't work. The way to make this work is to add the ParameterizedType in the interface like so. EDIT: Notice how the ContentInterface is no longer typed with T public interface ContentInterface { @GET("/public/content/{category}") ContentResponse&lt;String&gt; getContent(@Path(PathParameters.CATEGORY) String category); } But then that defeats the purpose because you can't have 2 method definition which has the same signature. This won't compile because of type erasure. public interface ContentInterface { @GET("/public/content/{category}") ContentResponse&lt;String&gt; getContent(@Path(PathParameters.CATEGORY) String category); ContentResponse&lt;Map&lt;String, String&gt; getContent(@Path(PathParameters.CATEGORY) String category); } So in the end you'd still need to create 2 different methods to interact with the 2 different type of data. public interface ContentInterface { @GET("/public/content/{category}") ContentResponse&lt;String&gt; getContentAsString(@Path(PathParameters.CATEGORY) String category); ContentResponse&lt;Map&lt;String, String&gt; getContentAsMap(@Path(PathParameters.CATEGORY) String category); } See @JakeWharton response here about generalization with Retrofit and why they don't really support it. I believe the same idea applies to this.
answers question: http://stackoverflow.com/q/25619909
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40085836
has comment: http://stackoverflow.com/comment/40084032
has comment: http://stackoverflow.com/comment/53990220
accepted answer of: http://stackoverflow.com/q/25619909
has comment: http://stackoverflow.com/comment/40084418
type: Answer

http://stackoverflow.com/comment/40020618
type: QuestionComment
comment on: http://stackoverflow.com/q/25616820
type: Comment
has text: what do you mean `returns non-Fragment type`???
score: 0

http://stackoverflow.com/comment/40029464
comment on: http://stackoverflow.com/a/25622051
has text: It's working but not sufficient because of I want to fetch all the fields which are defined into ContentEntity.java file. For above solution, I'm getting only one field value i.e. ID. Also, My query has changed, its displaying without joins.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39995641
type: QuestionComment
has text: Maybe your tests are in up-to-date status, try to add `test.dependsOn cleanTest`
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25602146

http://stackoverflow.com/q/25681540
tagged with: java
has comment: http://stackoverflow.com/comment/40137411
has comment: http://stackoverflow.com/comment/40141101
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25686467
has body: Edit: I just found out that not a IOExcpetion but a FilerException is thrown. Therefore I changed that in the description and the title. I'm working with Annotation Processing to generate some files for my java project. Now I always get an FilerException when the Annotation Processing tries to generate my files. This is the way I create the files (GenClass and GenAnnotation are custom classes that abstract the generated classes. They weren't changed in about half a year so I'm sure the error isn't somewhere there. The way I write the files also didn't change in the last year.): public static boolean generateJavaSourceFile(final ProcessingEnvironment processingEnv, final GenClass element, final String fileName, final Class&lt;?&gt; generatorClass) { boolean succeed = false; Writer fw = null; Filer f = processingEnv.getFiler(); // Mark the class as generated GenAnnotation generatedAnnotation = getAnnotation(generatorClass); element.pushImport(generatedAnnotation); element.addAnnotation(generatedAnnotation); try { JavaFileObject jfo = f.createSourceFile(fileName, (Element[]) null); // create new java source file fw = jfo.openWriter(); // write the GenClass object into file fw.write(element.toString()); succeed = true; } catch (FilerException e) { LOGGER.severe("Couldn't generate file (" + fileName + ")!"); processingEnv.getMessager().printMessage(Kind.ERROR, "Could not create source file " + fileName + " because it already exists"); throw new RuntimeException(e.getMessage(), e); } catch (IOException e) { LOGGER.severe("Couldn't generate file (" + fileName + ")!"); throw new RuntimeException(e.getMessage(), e); } finally { if (fw != null) { try { fw.close(); // flush and close the stream } catch (IOException e) { LOGGER.severe("Couldn't close file [" + fileName + "]!"); } } } LOGGER.fine(fileName + " written"); return succeed; This is the message of the exception: Source file already created: /path/to/the/file/to/create I did change something on my processors, however t…
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40139550
has answer: http://stackoverflow.com/a/25686467
tagged with: annotation-processing
has comment: http://stackoverflow.com/comment/40137451
answer count: 1
has comment: http://stackoverflow.com/comment/40139708
type: Question
has title: Filer always throws FilerException
has comment: http://stackoverflow.com/comment/40140880

http://stackoverflow.com/q/25657304
tagged with: swing
type: AnsweredQuestion
score: 0
tagged with: components
has comment: http://stackoverflow.com/comment/40093514
tagged with: java
tagged with: objective-c
type: Question
has comment: http://stackoverflow.com/comment/40093532
has title: Is there custom components in Objective-C like Java?
has body: In java, I know you can extend JComponent and override paintComponent(Graphics), like below: public class MyComp extends JComponent { public void paintComponent(Graphics g) { super.paintComponent(g); g.drawRect(0, 0, 5, 5); } } I was wondering if there was a way to do something similar to this in Objective-C.
has answer: http://stackoverflow.com/a/25657432
answer count: 1
accepted answer: http://stackoverflow.com/a/25657432

http://stackoverflow.com/a/47290850
score: 1
answers question: http://stackoverflow.com/q/25593874
has body: Below are some examples that you should be able to peak through to get more knowledge on arrays and two dimensional arrays //X HEADING PLUS MATH for (int i =0; i &lt; 13; i ++){ System.out.print(i + "\t"); } System.out.print("\n"); //MATH PORTION PLUS HEADING for (int y =1; y &lt; 13; y++){ System.out.print(y + "\t"); for (int x=1; x&lt;13; x++){ System.out.print((x*y) + "\t"); } System.out.print("\n"); } System.out.print("\n"); //MATH PORTION // for (int y =1; y &lt; 13; y++){ for (int x=1; x&lt;11; x++){ System.out.print((x*y) + "\t"); } System.out.print("\n"); } System.out.print("\n");*/ //************************************// //EXAMPLE USING TWO DIMENSIONAL ARRAY // //W/OUT HEADERS***********************// //************************************// //JFrame frame = new JFrame ("HW09"); //int length = Integer.parseInt(JOptionPane.showInputDialog(frame, "Enter the multiplication table length")) + 1; int length = 13; int[][] multi = new int[length][length];//created 2 dim array //formatting heading for (int i = 0; i&lt;length; i++) { multi[0][i] = i; multi[i][0] = i; } //fills array with values for (int yPos = 1; yPos&lt;length; yPos++){//loops through all y positions for ( int xPos =1; xPos &lt; length; xPos++){//loops through x positions of y position multi[xPos][yPos] =(xPos)*(yPos); } } //prints out values for (int yPos = 0; yPos&lt;length; yPos++){//loops through all y positions for ( int xPos =0; xPos &lt; length; xPos++){//loops through horizontal positions of y position System.out.print(multi[xPos][yPos] + "\t"); } System.out.print("\n"); } System.out.print("\n"); //************************************/ // EXAMPLE USING TWO ARRAYS // //************************************// int[] y = new int[] {1,5,6,9};//array for x int[] x = new int[] {2,5,7,8,10};//array for y //prints out horizontal header System.out.print("x\t"); for (int i =0; i &lt; x.length; i ++){ System.out.print(x[i] + "\t"); } System.out.print("\n"); //prints out y header and then does math for (…
type: Answer
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/40166234
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25697406
has text: Maybe a coincidence but i got the doubt especially because of the comment.

http://stackoverflow.com/a/25619194
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25614241
score: 1
has body: The paint process is internally handled so you can not control the frequency of it's execution. However, you can create separate threads or timers which can invoke processes at your desired frequency. Use the paint method only to render on your canvas, do other logic and processing in another function.
upvote count: 1

http://stackoverflow.com/q/25697609
has comment: http://stackoverflow.com/comment/40166767
has comment: http://stackoverflow.com/comment/40166753
linked to: http://stackoverflow.com/q/17268212
accepted answer: http://stackoverflow.com/a/25697644
score: 4
upvote count: 4
answer count: 4
type: AnsweredQuestion
has body: How HashMap internally differentiate between null and 0 as key. As per this post the hash code for null key is 0, Is it correct? If yes then both should go in same bucket at index 0 and there should be one value in the HashMap but this is not how HashMap works. Can somebody explain me? what is the hash code for null key in HashMap? Sample code: HashMap&lt;Integer,String&gt; map=new HashMap&lt;Integer,String&gt;(); map.put(null, "abc"); map.put(0, "xyz"); // will it override the value for null as key? System.out.println(map.get(null)); // abc System.out.println(map.get(0)); // xyz
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40166716
has answer: http://stackoverflow.com/a/25697741
has answer: http://stackoverflow.com/a/25697644
has answer: http://stackoverflow.com/a/25697887
has comment: http://stackoverflow.com/comment/40166795
favorite count: 0
has answer: http://stackoverflow.com/a/25697740
has title: HashMap having null as key
possible better answer: http://stackoverflow.com/a/25697740
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/40166734

http://stackoverflow.com/q/25688335
tagged with: java
has body: So in my code, I had JTable table = new JTable(); table.requestFocus(); table.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent arg0) { } @Override public void focusGained(FocusEvent arg0) { System.out.println("Table Focus gained !!!!!!!!!!!!!!!!!!"); } }); But when I test the code, the table doesn't have focus. So can a JTable as a whole have focus or only a cell of table can have focus? Extend the question above, can JTable as a whole has a KeyListener?
answer count: 1
type: Question
tagged with: swing
has title: can Jtable has focus as a whole?
accepted answer: http://stackoverflow.com/a/25689011
has answer: http://stackoverflow.com/a/25689011
type: AnsweredQuestion
tagged with: jtable
score: 0
tagged with: focus

http://stackoverflow.com/q/25691228
has comment: http://stackoverflow.com/comment/40857704
tagged with: java
downvote count: 5
has comment: http://stackoverflow.com/comment/40158479
score: -3
has comment: http://stackoverflow.com/comment/40158566
type: Question
has comment: http://stackoverflow.com/comment/40154501
answer count: 2
upvote count: 2
has answer: http://stackoverflow.com/a/25692168
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40154483
tagged with: arrays
has answer: http://stackoverflow.com/a/25691233
favorite count: 0
has title: why does this keep saying wrong type what can i do to fix it
has comment: http://stackoverflow.com/comment/40154979
has body: it is saying cannot convert double[] to double. what am i doing wrong here? i can to call this method to add to arrays that were asked for earlier in the program. i asked earlier, apparently in the wrong place, and someone said check my methods return type and what i am returning. to me they are the same right? double[] and im returning sum[] public static double[] add(double[] operand1, double[] operand2){ double[] sum = new double[operand1.length]; for (int i = 0; i &lt; operand1.length; ++i) { sum[i] = operand1[i] + operand2[i]; return sum[i];

http://stackoverflow.com/comment/39946324
comment on: http://stackoverflow.com/q/25568584
type: Comment
has text: You could also script the DB, rebuild it as DB_Test, fill it with fake data, and run your tests on there. A bit of effort up front, but it could be very useful if you plan to continue work on this software for a long time.
type: QuestionComment
score: 0

http://stackoverflow.com/a/25593724
has body: JSoup is a good solution for parsing HTML pages and retrieving data from it. The Select() method just accepts a css selector and will return the html elements that comply with that selector. These 2 links should get you started: http://jsoup.org/cookbook/extracting-data/selector-syntax http://jsoup.org/cookbook/extracting-data/dom-navigation There are other parsers out there, but I do not have experience with them. JSoup is widely adopted and very easy to use.
downvote count: 0
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/25593631
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25593631

http://stackoverflow.com/a/25588498
accepted answer of: http://stackoverflow.com/q/25588493
has comment: http://stackoverflow.com/comment/39967666
type: Answer
answers question: http://stackoverflow.com/q/25588493
type: AcceptedAnswer
score: 6
downvote count: 0
has comment: http://stackoverflow.com/comment/39967696
has body: You can use the Thread.sleep() method to wait a number of milliseconds: Thread.sleep(2000); System.out.println("Two seconds have passed");
upvote count: 6

http://stackoverflow.com/comment/40132348
has text: basically u wanna finish all activity when app closes?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25679111
score: 0

http://stackoverflow.com/comment/39968056
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25588719
has text: just read the json -> convert to java object -> apply changes -> recreate the json again -> finally write in the file back. All the steps should be done in a transaction to avoid multiple threads issues.
type: Comment

http://stackoverflow.com/comment/39968646
type: AnswerComment
type: Comment
has text: but then, there is another error 55447 ERROR reading: A result set was generated for update. any idea?is it i need a resultset statement to run it?
score: 0
comment on: http://stackoverflow.com/a/25589076

http://stackoverflow.com/q/25600243
has title: How to resolve CDT build variable ${ProjName} programatically?
answer count: 1
downvote count: 0
upvote count: 1
tagged with: eclipse-plugin
favorite count: 0
type: Question
tagged with: eclipse-cdt
has body: How to resolve the CDT build variable {ProjName} programmatically? Here is what I am trying to do: I am trying to get the artifactName of a configuration and then replace the {ProjName} in it with the project name. Now, I don't want to replace just this variable by searching for it, because user may specify any other variable name there. private String getResolvedArticatName(final IConfiguration configuration){ String artifactName = configuration.getArtifactName(); String resolvedArtifactName = resolve(artifactName); return resolvedArtifactName; } private String resolve(String artifactName){ //resolve the parameter, artifactName, and return it; } PS: I posted answer to this question for my future reference.
accepted answer: http://stackoverflow.com/a/25602051
has answer: http://stackoverflow.com/a/25602051
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/25650359
tagged with: itemlistener
has body: Question: "Create the beverageJComboBoxItemStateChanged method (which immediately follows loadCategory) and insert code that adds the String representation of the selected item to the ArrayList billItems. [Hint: Use the ItemEvent.SELECTED constant to determine whether an item is selected.]" Now the method is: private void beverageJComboBoxItemStateChanged( ItemEvent event ) {} The Instance variable ArrayList is: private void beverageJComboBoxItemStateChanged( ItemEvent event ) How do I create the ItemEvent.SELECTED inside the method I mentioned above?
has answer: http://stackoverflow.com/a/25651008
tagged with: java
answer count: 1
tagged with: methods
favorite count: 0
tagged with: jcombobox
type: Question
has comment: http://stackoverflow.com/comment/40080407
has comment: http://stackoverflow.com/comment/40080260
has title: Implementing an event listener
upvote count: 0
type: UnansweredQuestion
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/40080298
tagged with: swing

http://stackoverflow.com/comment/40018411
type: AnswerComment
has text: try { PublisherModels<PublisherLookupItem> publisherModels = new ObjectMapper().readValue( " {\"models\":[{\"id\":6002,\"publisherName\":\"AbacusT\",\"active\":false}]}", PublisherModels.class); List<PublisherLookupItem> list = publisherModels.getModels(); PublisherLookupItem publisherLookupItem = list.get(0); System.out.println(publisherLookupItem.getPublisherName()); } catch (Exception e) { e.printStackTrace(); }
score: 0
comment on: http://stackoverflow.com/a/25615985
type: Comment

http://stackoverflow.com/a/25579136
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39968936
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25579031
has body: An HTTP POST request cannot be redirected. 10.3 Redirection 3xx This class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request. The action required MAY be carried out by the user agent without interaction with the user if and only if the method used in the second request is GET or HEAD. Reference: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3
accepted answer of: http://stackoverflow.com/q/25579031

http://stackoverflow.com/q/25621373
answer count: 0
has comment: http://stackoverflow.com/comment/40035511
tagged with: java
has comment: http://stackoverflow.com/comment/40028441
has comment: http://stackoverflow.com/comment/40027550
has title: Different servlet versions web apps on one App Server
tagged with: tomcat
type: Question
has body: Please help me. I have an old Servlet 2.5 application with JSF 1.2 and tomcat 6.0.14 I need to move it to JSF 2.2 and tomcat 8 but changing all pages and controllers is impossible. Is there a way to run 2 apps at the same time? One app is growing and another is old. I know about nginx solution but may be there's a way to run both apps in one container? What would you suggest the best? Thank you
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40029170
has comment: http://stackoverflow.com/comment/40034476

http://stackoverflow.com/q/25643159
linked to: http://stackoverflow.com/q/9554636
answer count: 0
has comment: http://stackoverflow.com/comment/40067144
tagged with: java
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40066857
has body: I just want to run two frames concurrently, one contains drag and drop feature which i am using to write file to ftp server and other one to display the progress bar to show how much file is written(uploaded you can say). But the problem is my progress bar frame remains white i.e, GUI is not done on it.why??? please give me a solution. here is my first class which is a homePage frame which calls another class called ProgressSample which writes data to the output stream and also updates the progress bar simultaneously. FTPConnect.java SwingWorker&lt;Void , Integer&gt; worker = new SwingWorker&lt;Void , Integer&gt;(){ @Override protected Void doInBackground() throws Exception { ProgressSample.main(secondLocalFile , bytesIn , inputStream , outputStream); return null; } protected void done(){ ProgressSample.frame.dispose(); } }; worker.execute(); this is the second class ... when i call its main(......) method just a frame with white color on it appears nothing is added on it plz plz plz help me with ur suggestions as soon as possible... ProgressSample.java package encdec; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JProgressBar; public class ProgressSample { static JFrame frame; JProgressBar progressBar; public static void main(File file , byte[] bytesIn, InputStream inputStream , OutputStream outputStream)throws IOException { ProgressSample obj=new ProgressSample(); obj.redfile(file , bytesIn , inputStream , outputStream); } public ProgressSample() { frame = new JFrame(); frame.setBounds(100, 100, 400, 200); frame.getContentPane().setLayout(null); progressBar = new JProgressBar(); progressBar.setBounds(102, 40, 150, 16); frame.getContentPane().add(progressBar); progressBar.setStringPainted(true); frame.setVisible(true); } public void redfile(File f , byte[] bytesIn, InputSt…
has comment: http://stackoverflow.com/comment/40067179
has title: running two frames concurrently at the same time
has comment: http://stackoverflow.com/comment/40093993
score: 0

http://stackoverflow.com/comment/39988487
comment on: http://stackoverflow.com/q/25599641
score: 0
has text: I want to use table viewer where i need to create a table which updates the second coloumn with a text and the text colour has to be changing like red ,blue etc
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40007217
has text: This line `line = bufferedReader.readLine();`, which is written just before `String [] PinSearch = {};`, is returning `null`. Since there is nothing more to read from the file, that is why the `do-while` loop ended at first place. So seems like `line 144` is what is giving `null` to the `line` variable, and on line `146` you using that `null` reference, for invoking `split`
comment on: http://stackoverflow.com/q/25610084
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25651823
has comment: http://stackoverflow.com/comment/40082938
has answer: http://stackoverflow.com/a/25651997
downvote count: 2
answer count: 1
has title: How for each works while passing two array variables in varargs argument?
upvote count: 1
score: -1
has body: While running this code i am getting an output 14.But i am unable to understand that how for each loop works on two array variables passing in single varargs argument. public class Venus { public static void main(String[] args) { int [] x = {1,2,3}; int y[] = {4,5,6}; new Venus().go(x,y); } void go(int[]... z) { for(int[] a : z) System.out.print(a[0]); } }
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40082929
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25651997

http://stackoverflow.com/q/25646790
tagged with: java
has title: Swing constants vs component constants
answer count: 3
downvote count: 0
has body: Which is preferred and why? JLabel.RIGHT or SwingConstants.RIGHT ? edit thank you for your prompt replies, and although my question is answered, it raises another (directly related to my intial question). if one is "preferred", why allow the other? JLabel jlabel = new JLabel("JLabel",JLabel.RIGHT); // my preference JLabel jlabel = new JLabel("JLabel",SwingConstants.RIGHT);
favorite count: 0
possible better answer: http://stackoverflow.com/a/25646992
tagged with: jlabel
has answer: http://stackoverflow.com/a/25647096
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/25646992
tagged with: swing
accepted answer: http://stackoverflow.com/a/25646937
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25646937

http://stackoverflow.com/q/25583733
score: -6
favorite count: 0
has answer: http://stackoverflow.com/a/25583801
type: Question
has comment: http://stackoverflow.com/comment/39958851
tagged with: algorithm
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39958960
tagged with: data-structures
has answer: http://stackoverflow.com/a/25583803
tagged with: big-o
downvote count: 6
has title: Deciding a Big-O notation for an algorithm
has body: I have questions for my assignment. I need to decide what is the Big-O characterization for this following algorithm: I'm guessing the answer for Question 1 is O(n) and Question 2 is O(log n), but I kinda confused how to state the reason. Are my answers correct? And could you explain the reason why the characterization is like that?
answer count: 2
has comment: http://stackoverflow.com/comment/39958848
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39958886

http://stackoverflow.com/comment/40082793
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25651185
has text: Can controller implement the interfaces as a no op (or less likely an abstract method), and derived classes which actually need the contracts to be implemented, override Controllers implementations? Then all derived types of Controller would have .publish, and .update, and only those with an override actually do anything.

http://stackoverflow.com/a/25610750
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25610352
has comment: http://stackoverflow.com/comment/40049755
has comment: http://stackoverflow.com/comment/40049700
has comment: http://stackoverflow.com/comment/40049664
score: 1
type: Answer
has body: Myself, I'd just give my class a PropertyChangeSupport field, give it an addPropertyChangeListener(...) and removePropertyChangeListener(...) methods, only allow the atomic variable to be changed in a setXxx(...) method, and in that same method, fire a property change event. I would take care that the fire event be called on the GUI's event thread. Note that if your GUI is a Swing GUI, then if you use a SwingPropertyChangeSupport, the threading issue is taken care of for you. For example, from my answer to a similar question here: public class ServerManager implements Runnable { public static final String IS_RUNNING = "is running"; // for the Event's name // if not a Swing app, then use a PropertyChangeSupport field private SwingPropertyChangeSupport propChngSupport = new SwingPropertyChangeSupport(this); private volatile boolean isRunning = false; // other variables // addPropertyChangeListener(...) {...} goes here // removePropertyChangeListener(...) {...} goes here public void setIsRunning(boolean isRunning) { boolean newValue = isRunning; boolean oldValue = this.isRunning; this.isRunning = isRunning; propChngSupport.firePropertyChange(IS_RUNNING, oldValue, newValue); } public void run() { // .... } // other methods } As for your specific questions: Do I need to register a listener to do this or is there a simpler way? I don't see anything difficult about registering listeners. Where and how do I register the listener? The observer would register on the observed by calling some addListenerXxx(...) type method. Do I have to setup a separate interface class (I'd like to avoid this if possible). Not if you use PropertyChangeListener or Java's Observer/Observable class/interface combination Could you please some real example I could use - abstract explanations aren't helping me so far! You need to ask more specific questions than this one.
answers question: http://stackoverflow.com/q/25610352
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39937325
score: 0
comment on: http://stackoverflow.com/q/25571674
type: Comment
type: QuestionComment
has text: is another thread/process modifying the directory contents while you are trying to delete them?

http://stackoverflow.com/comment/40119803
type: QuestionComment
comment on: http://stackoverflow.com/q/25672246
score: 0
type: Comment
has text: Now i did. i forgot, im sorry. The code that highlights my problem is Builder.getInstance().plaatje.setText("UP");

http://stackoverflow.com/a/25700401
downvote count: 0
type: Answer
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25681351
score: 1
accepted answer of: http://stackoverflow.com/q/25681351
has comment: http://stackoverflow.com/comment/40190169
has comment: http://stackoverflow.com/comment/40224001
has body: Have a look at Lucas Rochas smoothie library. This libary implements fast scrolling grids. I use it on my Playlist Manager(google play). http://lucasr.org/2013/01/06/introducing-smoothie/

http://stackoverflow.com/comment/60207746
score: 0
type: AnswerComment
has text: Minor points: In your `StateMachine`, you'll want to 1) implement `StateEventListener` and 2) make the methods public in both the `State` and `StateMachine`
comment on: http://stackoverflow.com/a/25581346
type: Comment

http://stackoverflow.com/a/25554990
has body: You could search through the string and replace all character versions of /n with //n. String s = convertNewLineChars("\n"); public String convertNewLineChars(String s) { //for each character in string, replace '\n' with \\n } Edit Use an enum for all your possible special characters public enum SpecialCharacter { NEWLINE('\n', "\\\\n"), //see note at the bottom of the answer for why RETURN('\r', "\\\\r"); //there are four backslashes. private char character; private String charAsString; private SpecialCharacter(char character, String charAsString) { this.character = character; this.charAsString = charAsString; } public char getCharacter() { return this.character; } public String getCharAsString() { return this.charAsString; } public static SpecialCharacter[] getAllCharacters() { return new SpecialCharacter[] {NEWLINE, RETURN}; //etc... } } Create a static method for removing these characters public static String removeSpecialCharacters(String s) { String returnString = s; for (SpecialCharacter character : SpecialCharacter.getAllCharacters()) { returnString = returnString.replaceAll("["+character.getCharacter()+"]", character.getCharAsString()); } return returnString; } Then you can say something like: String s = removeSpecialCharacters("\nfdafhoean\noasd\r\rjfoi"); System.out.println(s); This will work for any SpecialCharacter you add to the enum. *Note that replaceAll() will consume the extra backslash... if you simply call System.out.println(SpecialCharacter.NEWLINE.getCharAsString()); you will receive the output of \\n
has comment: http://stackoverflow.com/comment/39904924
type: Answer
answers question: http://stackoverflow.com/q/25554846
score: 0

http://stackoverflow.com/comment/40012884
score: 0
has text: Okay, now it's working. Every class in a different file, but the variables (declared inside the class) remain the same.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25613172

http://stackoverflow.com/q/25617866
has answer: http://stackoverflow.com/a/25618144
accepted answer: http://stackoverflow.com/a/25618144
tagged with: ascii
type: Question
possible better answer: http://stackoverflow.com/a/25617909
has answer: http://stackoverflow.com/a/25617975
upvote count: 1
has comment: http://stackoverflow.com/comment/40021878
has body: I'm trying to convert from a URL-encoded ASCII byte array to UTF-8 in Java. The input ASCII string Fa%C3%A7ade should be converted to the output UTF-8 string Façade.
tagged with: string
has title: Convert from URL encoding to UTF-8
downvote count: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25617909
score: 0
answer count: 3
tagged with: java
tagged with: utf-8

http://stackoverflow.com/comment/40098664
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25660093
has text: Here is something nicely explained :) http://stackoverflow.com/questions/4140448/difference-between-and-in-servlet-mapping-url-pattern

http://stackoverflow.com/q/25654178
has comment: http://stackoverflow.com/comment/40087565
has comment: http://stackoverflow.com/comment/40087792
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40087681
answer count: 1
tagged with: scripting
has answer: http://stackoverflow.com/a/25654404
has comment: http://stackoverflow.com/comment/40087590
has comment: http://stackoverflow.com/comment/40087741
favorite count: 0
type: Question
upvote count: 2
type: UnansweredQuestion
tagged with: javascript
has body: I have the following in a js file: function serialize() { return new Uint8Array(1024); } I invoke that function with the java scripting api like so: byte[] bytes = (byte[]) ((Invocable)engine).invokeFunction(SERIALIZE_FUNC); Which immediately throws the exception: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "Uint8Array" is not defined. (&lt;Unknown source&gt;#1) in &lt;Unknown source&gt; at line number 1 sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "Uint8Array" is not defined. (&lt;Unknown source&gt;#1) I dont know much about javascript, but I thought this is how you define an array in JavaScript?
has comment: http://stackoverflow.com/comment/40087707
has title: How to return array from javascript call in java?
has comment: http://stackoverflow.com/comment/40087638

http://stackoverflow.com/q/25566851
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/25569430
has body: i´m running grails 2.2.3 on tomcat6 when i add dependency of groovy http-buidler to my build-config.groovy dependencies { ... runtime 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.0-RC2' ... } it wont compile anymore with following stack: INFO: Initializing Spring root WebApplicationContext ERROR error, Full Stack Trace: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.&lt;init&gt;(Z)V at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.compileStaticMethod(CallSiteGenerator.java:231) at org.codehaus.groovy.reflection.CachedMethod.createStaticMetaMethodSite(CachedMethod.java:264) at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.createStaticMetaMethodSite(StaticMetaMethodSite.java:111) at groovy.lang.MetaClassImpl.createStaticSite(MetaClassImpl.java:2993) at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:59) at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:144) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at org.grails.plugin.resource.CSSRewriterResourceMapper.&lt;clinit&gt;(CSSRewriterResourceMapper.groovy:24) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean.afterPropertiesSet(GrailsApplicationFactoryBean.java:79) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBea…
tagged with: grails
accepted answer: http://stackoverflow.com/a/25568867
has answer: http://stackoverflow.com/a/25569430
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25568867
answer count: 2
tagged with: groovy
has title: Grails - java.lang.NoSuchMethodError after adding dependency http builder
type: Question

http://stackoverflow.com/comment/40132222
type: AnswerComment
comment on: http://stackoverflow.com/a/25679112
score: 1
type: Comment
has text: getResources() is not found for java file buddy

http://stackoverflow.com/q/25619867
type: Question
has answer: http://stackoverflow.com/a/25620342
answer count: 2
downvote count: 0
has title: Soft input layout doesn't change as intended
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25620241
has body: I have a problem with my android soft input layout. What I need is a phone layout which only accepts numeric values. I have done this before by modifying xml: android:inputType="phone" android:digits="0123456789" and it worked like a charm. Now the current EditText is generated dynamically, and I have to do it programmatically. I've already tried mEditTextET.setInputType(InputType.TYPE_CLASS_PHONE | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED); mEditTextET.setKeyListener(DigitsKeyListener.getInstance("0123456789")); but it shows text layout instead of phone layout. Any ideas?
has comment: http://stackoverflow.com/comment/40025461
has comment: http://stackoverflow.com/comment/40024841
tagged with: android-layout
upvote count: 1
score: 1
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40025117
favorite count: 0

http://stackoverflow.com/comment/39928206
type: Comment
type: QuestionComment
score: 0
has text: This could be the culprit. But i just tried to get a cursor with all documents with `find()`, which should indeed be able to be called without a query, then passed that cursor to `remove` and it resulted in the same error. Can `remove` not handle a cursor?
comment on: http://stackoverflow.com/q/25565608

http://stackoverflow.com/comment/40168406
comment on: http://stackoverflow.com/a/25686724
has text: Can end with a space. Had similar, mine could start with a space (edited). But not sure, if that's a requirement.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39999977
type: Comment
comment on: http://stackoverflow.com/q/25605981
score: 0
has text: @tobias_k I've added a screenshot of my workspace
type: QuestionComment

http://stackoverflow.com/comment/39980663
score: 0
comment on: http://stackoverflow.com/q/25590303
type: Comment
type: QuestionComment
has text: I don't have any other idea: did the gson jar get copied to the war `WEB-INF/lib` directory?

http://stackoverflow.com/q/25685926
has comment: http://stackoverflow.com/comment/40144304
has title: Unparseable date: ",Fri, 05 Sep 2014 06:01 (at ofest 0) - Android
has comment: http://stackoverflow.com/comment/40144258
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40144431
score: -1
has comment: http://stackoverflow.com/comment/40144404
has comment: http://stackoverflow.com/comment/40144371
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40144359
has answer: http://stackoverflow.com/a/25686142
answer count: 2
has body: I have a date which is like so Fri, 05 Sep 2014 06:01 And I want to convert this into the format: 05/09/2014 I am using the following code to do so: pubDateFormat = pubDate.substring(0, 23); DateFormat dateFormatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm", Locale.ENGLISH); Date date = dateFormatter.parse(pubDateFormat); dateFormatter = new SimpleDateFormat("dd/MM/yyyy"); But, it bringing back the above error messages...I do not know why. If someone could give me some help, that would be great...thanks!
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25686445

http://stackoverflow.com/a/25591269
has body: It's impossible, you must rewrite java program to applet.
score: 0
has comment: http://stackoverflow.com/comment/39973016
has comment: http://stackoverflow.com/comment/39972790
has comment: http://stackoverflow.com/comment/39972811
answers question: http://stackoverflow.com/q/25591169
type: Answer

http://stackoverflow.com/a/25617856
score: 3
has body: PreparedStatement prepareStatement = connection.prepareStatement("insert...", new String[] { "your_primary_key_column_name" }); prepareStatement.executeUpdate(); ResultSet generatedKeys = prepareStatement.getGeneratedKeys(); if (null != generatedKeys &amp;&amp; generatedKeys.next()) { Long primaryKey = generatedKeys.getLong(1); } I have found the answer this is perfectly works. I can insert from JAVA and its return with the key. Full version: CREATE TABLE STUDENTS ( STUDENT_ID NUMBER NOT NULL PRIMARY KEY, NAME VARCHAR2 (50 BYTE), EMAIL VARCHAR2 (50 BYTE), BIRTH_DATE DATE ); CREATE SEQUENCE STUDENT_SEQ START WITH 0 MAXVALUE 9999999999999999999999999999 MINVALUE 0; And the Java code String QUERY = "INSERT INTO students "+ " VALUES (student_seq.NEXTVAL,"+ " 'Harry', 'harry@hogwarts.edu', '31-July-1980')"; // load oracle driver Class.forName("oracle.jdbc.driver.OracleDriver"); // get database connection from connection string Connection connection = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:sample", "scott", "tiger"); // prepare statement to execute insert query // note the 2nd argument passed to prepareStatement() method // pass name of primary key column, in this case student_id is // generated from sequence PreparedStatement ps = connection.prepareStatement(QUERY, new String[] { "student_id" }); // local variable to hold auto generated student id Long studentId = null; // execute the insert statement, if success get the primary key value if (ps.executeUpdate() &gt; 0) { // getGeneratedKeys() returns result set of keys that were auto // generated // in our case student_id column ResultSet generatedKeys = ps.getGeneratedKeys(); // if resultset has data, get the primary key value // of last inserted record if (null != generatedKeys &amp;&amp; generatedKeys.next()) { // voila! we got student id which was generated from sequence studentId = generatedKeys.getLong(1); } } source : http://viralpatel.net/blogs/oracle-java-jdbc-get-primary-key-insert-sql/
answers question: http://stackoverflow.com/q/25607985
type: Answer
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25607985

http://stackoverflow.com/q/25560056
upvote count: 0
has answer: http://stackoverflow.com/a/25560069
tagged with: java
downvote count: 2
has title: Writing a temp. array
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25560123
answer count: 2
type: UnansweredQuestion
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/39914629
has body: Ive already wrote code that will take the temp for each month and then show and calculate the total, average, most and least rainfall for the year and output that. How do I replace the most and least rainfall with actually months names? code so far: import java.util.Scanner; import java.text.DecimalFormat; public class Rainfall { public static void main(String[] args) { String [] months={"Janurary","Febuary","March","April","May","June","July","August","September","October","November","December"}; final int MONTHS = 12; double[] rain = new double[MONTHS]; initRain(rain); double total = totalRain(rain); double average = averageRain(rain, total); int most = mostRain(rain); int least = leastRain(rain); // Decimal Format DecimalFormat digit = new DecimalFormat("#.0"); // Output System.out.println("The total rainfall of the year is " + digit.format(total)); System.out.println("The average rainfall of the year is " + digit.format(average)); System.out.println("The month with the highest amount of rain is " + (most + 1)); System.out.println("The month with the lowest amount of rain is " + (least + 1)); } public static void initRain(double[] array) { Scanner keyboard = new Scanner(System.in); for (int x = 0; x &lt; array.length; x++) { System.out.print("Enter Rainfall for month " + (x + 1) + ": "); array[x] = keyboard.nextDouble(); } } public static double totalRain(double[] array) { double total = 0; for (int x = 0; x &lt; 12; x++) total += array[x]; return total; } public static double averageRain(double[] array, double total) { return total / array.length; } public static int mostRain(double[] array) { double maximum = array[1]; int value = 0; for (int i=0; i &lt; 12; i++) { if (array[i] &gt;= maximum) { maximum = array[i]; value = i; } } return months[index]; } public static int leastRain(double[] array) { double minimum = array[0]; int value = 0; for (int i=0; i &lt; 12; i++) { if (array[i] &lt;= minimum) { minimum = array[i]; value = i; } } return value; } }

http://stackoverflow.com/a/25607933
score: 3
accepted answer of: http://stackoverflow.com/q/25607888
upvote count: 3
answers question: http://stackoverflow.com/q/25607888
has comment: http://stackoverflow.com/comment/40003261
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: replace Arrays.sort(standardShiftItemsPerEmployee.toArray()); by Collections.sort(standardShiftItemsPerEmployee)
has comment: http://stackoverflow.com/comment/40003312

afnetworking
type: Tag
tags question: http://stackoverflow.com/q/25658114
tag name: afnetworking

http://stackoverflow.com/a/25554517
has body: Your problem is that you're trying to use JavaScript variable in server-side code. You should be able do &lt;x:parse xml="${directoryInfo}" var="output"/&gt; or to specifically target session you can do &lt;x:parse xml="${sessionScope.directoryInfo}" var="output"/&gt; JavaScript means nothing to server-side languages, they just treat is as generic text.
answers question: http://stackoverflow.com/q/25553881
upvote count: 2
has comment: http://stackoverflow.com/comment/39909235
accepted answer of: http://stackoverflow.com/q/25553881
type: Answer
has comment: http://stackoverflow.com/comment/39906615
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25556216
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
has body: Because the value is populated from the hidden field name attribute bound to action's int attribute that contains 0 value. You don't have a value in the value attribute because your expression returns nothing i.e. don't have level in the value stack. That is how it works: the tag reads the value from the value attribute and if it's null then it uses a value from the name attribute as OGNL expression. After the expression is evaluated the returned value rendered to the value attribute of the input tag.
type: Answer
answers question: http://stackoverflow.com/q/25555907
accepted answer of: http://stackoverflow.com/q/25555907

http://stackoverflow.com/comment/40027568
type: AnswerComment
score: 1
has text: @ooxi Is there any way to have the IDE (Eclipse in my case) automatically add the generated sources to the build path, like it does for each source and resource declared in the POM, thus requiring no manual intervention?
type: Comment
comment on: http://stackoverflow.com/a/25579554

http://stackoverflow.com/comment/39955796
comment on: http://stackoverflow.com/q/25581905
score: 1
type: Comment
type: QuestionComment
has text: As @assylias points out, your entire question appears to be based on a faulty premise.

http://stackoverflow.com/q/25669500
possible better answer: http://stackoverflow.com/a/25669557
has answer: http://stackoverflow.com/a/25669685
favorite count: 0
has answer: http://stackoverflow.com/a/25669554
accepted answer: http://stackoverflow.com/a/25669554
has body: I want to know if there is a way to check if a given string contains only combination of alphabets and numbers and nothing else. for just alphanumeric i can use http://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html for just numbers i can use Interger.parse or some regular expression. But is there some library which does the combined check. I googled but didnt came across anything. Everywhere it's done separately.
type: Question
has comment: http://stackoverflow.com/comment/40115266
has comment: http://stackoverflow.com/comment/40115142
has answer: http://stackoverflow.com/a/25669557
has title: way to check both for alphabets and numeric charcters only
has answer: http://stackoverflow.com/a/25669561
tagged with: regex
answer count: 4
upvote count: 2
type: AnsweredQuestion
score: 1
tagged with: java
downvote count: 1

http://stackoverflow.com/q/25709155
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
tagged with: java
answer count: 1
has body: I want to include a create method for each BO that extends the abstract class BusinessObject. I came up with the method shown below, but at compile time I get the following exception at the createDao(...) statement: 'invalid inferred types for D; inferred type does not conform to declared bound(s)' This is what the create method looks like. public abstract class BusinessObject { ... public &lt;T extends BusinessObject&gt; T create(T bo) throws InstantiationException, SQLException, NamingException { final Dao&lt;T, Long&gt; dao = DaoManager.createDao(getConnectionSource(), bo.getClass()); bo.setTimestampAdded(System.currentTimeMillis()); bo.setTimestampModified(System.currentTimeMillis()); bo.setDateAdded(new Date(System.currentTimeMillis())); bo.setDateModified(new Date(System.currentTimeMillis())); dao.create(bo); return bo; } } While on the subject, maybe someone can also link me to a decent, comprehensive tutorial on the matter of generics. There's a lot of basic tutorials out there but not much about intermediate stuff.
has title: OrmLite Generic create method
tagged with: generics
tagged with: ormlite
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25709614
accepted answer: http://stackoverflow.com/a/25709614

http://stackoverflow.com/comment/40062344
type: Comment
type: QuestionComment
has text: Do not provide clarifications in comments. Instead, edit your question to make it clearer.
score: 0
comment on: http://stackoverflow.com/q/25639562

http://stackoverflow.com/comment/39936182
type: Comment
comment on: http://stackoverflow.com/a/25571314
type: AnswerComment
score: 0
has text: oh yes type tokens, I even encountered Neil Gafter's Super Type tokens, but it really looks peculiar to me, but I tried it and its good, I can construct different types using his approach, [link](http://gafter.blogspot.com/2006/12/super-type-tokens.html) , I was just hoping if I can achieve what I want with my design and similar resources, utilizing every thing that I can find., I'm gonna try your code, and I will thank you in advance. Greatly appreciated.

http://stackoverflow.com/a/25676957
type: Answer
answers question: http://stackoverflow.com/q/25676631
score: 0
has body: Try this: Build.VERSTION.RELEASE http://developer.android.com/reference/android/os/Build.VERSION.html

http://stackoverflow.com/comment/40281942
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25595844
type: Comment
has text: possible duplicate of [Fastest way to sum integers in text file](http://stackoverflow.com/questions/25606833/fastest-way-to-sum-integers-in-text-file)

http://stackoverflow.com/comment/40044574
has text: @KieranS: in that case you should lock the `map` before retrieving the list of markers and only unlock (end the scope) if no action will be performed on that list anymore.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25626212
type: Comment

http://stackoverflow.com/comment/40110034
comment on: http://stackoverflow.com/a/25651040
has text: Unfortunately it did not work. I am running java version 1.7.0_21 on a Windows 7 computer. BTW there is no list at the site my link points to - there is a demo app that I find useful for investigating various L&F - they are not all the same! Set the L&F to Metal and select Label and you will see all the defaults for JLabel.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25627408
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40039279
favorite count: 0
type: Question
has body: I'm currently implementing a generic model for pivot-like data visualization in ColdFusion 9. I'm not interested in supporting multiple measures and the model exposes a numeric valueAt(string colKey, string rowKey) function that can be called by a view in order to retrieve the resulting aggregation of a measure based on column and row dimensions. For example, with the data set below, if the measure was AVG(Age) and the column dimension Rank, then model.valueOf('3', '') would return 2.33. Wine Age Rank WineA 3 3 WineB 4 2 WineC 2 3 WineD 2 3 Now, the data structure that naturally came to my mind was to use a java.util.HashMap to store the computed data, using a combination of column and row values converted to string as keys. This means that depending on the data set, I might potentially have a very large number of keys that will start with the same prefix. I purposely created a large data set (1 million entries) with multiple strings having the same prefix and checked the percentage of bucket collisions I would get using the default java String.hashCode() algorithm and MurmurHash3. Here's how I build the data set sample: &lt;cfset maxItemsCount = 1000000&gt; &lt;cfset tokens = ['test', 'one', 'two', 'tree', 'four', 'five']&gt; &lt;cfset tokensLen = arrayLen(tokens)&gt; &lt;cfset items = []&gt; &lt;cfset loopCount = 1&gt; &lt;cfloop condition="arrayLen(items) lt maxItemsCount"&gt; &lt;cfset item = ''&gt; &lt;cfloop from="1" to="#tokensLen#" index="i"&gt; &lt;cfset item = listAppend(item, tokens[i] &amp; loopCount, '_')&gt; &lt;cfset arrayAppend(items, item)&gt; &lt;/cfloop&gt; &lt;cfset ++loopCount&gt; &lt;/cfloop&gt; With an array initialized to 2 * entries count, I got 27% collisions with String.hashCode() and 22% for Murmur. It took around 2580 milliseconds with java.util.HashMap only to store and retrieve keys once. I'm looking for ideas on how to improve performance, whether by using a different data structures (perhaps nested hash maps?) or find a way to reduce…
has answer: http://stackoverflow.com/a/25628140
tagged with: performance
tagged with: hashmap
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40040057
has comment: http://stackoverflow.com/comment/40040102
tagged with: coldfusion
has title: Fast value access from string-based key path
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/39925919
score: 0
type: QuestionComment
type: Comment
has text: So therefore statically linking would have made even more of an impact. Did you try it?
comment on: http://stackoverflow.com/q/25565486

http://stackoverflow.com/q/25664494
tagged with: nexus
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40105722
downvote count: 0
tagged with: maven
has answer: http://stackoverflow.com/a/25666275
has comment: http://stackoverflow.com/comment/40106481
score: 6
has comment: http://stackoverflow.com/comment/40107827
has comment: http://stackoverflow.com/comment/40105594
has title: Maven dependency not getting corresponding POM file downloaded
tagged with: java
has answer: http://stackoverflow.com/a/25666428
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/66959564
has comment: http://stackoverflow.com/comment/40106152
answer count: 2
has body: I've got a maven project that has a dependency that it gets from a remote Nexus repository. I believe that the dependency was not built with maven, and just uploaded with a barebones POM file. The layout on the server looks fine though, so it was probably deployed with maven. When maven downloads the dependency to my local repository, it downloads the jar file, but doesn't get the POM. At build time, there's a warning that the POM couldn't be found, and no dependency information available. I'm not actually using any of its code directly (it's actually a transitive dependency), so build completes successfully. The real problem arises when I try to perform site generation for my project. The part that tries to generate the dependency graph report fails, because it can't find the POM for this dependency to work with. I can't figure out why I'm not getting the POM downloaded, when the jar file for it gets downloaded just fine. The POM file for that particular dependency looks like this (you can see why I don't think it's built with maven :)) 4.0.0 com.company.component my-artifact 1.0.1 You'll notice that the root element doesn't contain any namespace or schema information. Could this be related? Could it be Nexus not recognizing it as a POM? Apart from the possibility of some small syntactical character missing or mistaken, this is my current train of thought...please don't let it influence any ideas you may have! :) Also, while troubleshooting, I've pasted the contents of the remote POM file into the correct file location in my local .m2 repo. Everything works fine when I do that. This isn't an acceptable fix though, because we will need the build to be done on our CI build servers. Any help/suggestions greatly appreciated! Edit: I've managed to temporarily solve my actual problem, but the strangeness here still exists. I solved the problem by explicitly excluding the thing that depends on this from the dependency that's in my pom (the trouble dep is two steps away at…
upvote count: 6

http://stackoverflow.com/comment/40097820
comment on: http://stackoverflow.com/q/25645944
score: 0
has text: If i understand your request correct you have a part which is generated and an other part which is build as usual. In such cases you should make a separate module with your generated code and a second module which contains the usual part. The consequence of such a thing is to create a multi module build. This makes life easier. Apart from that why do you add things which are already default like `src/main/resources` folder? `src/main/webapp` should never be a part of the resources so you have a war packaging combined with several other things. You are violating separation of concerns.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39902640
score: 0
type: AnswerComment
has text: You can. But it is not good idea because you will work on low level. It is better to use high level things that do this work for you. I try to explain on example. You use memory barrier to guarantee visibility between write and read of variable (or several). But it is better show you intentions directly by manually puting volatile on variable declaration and let Java do it for you which remove boilerplate code and also it help you not to forget put barrier when you add new access to variable to you code.
comment on: http://stackoverflow.com/a/25553354
type: Comment

http://stackoverflow.com/q/25700300
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40171282
tagged with: log4j
type: Question
has title: Java Tomcat log4j can not find appender
type: UnansweredQuestion
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40171735
has body: When executing my application i got: No appenders could be found for logger (org.displaytag.properties.TableProperties) But i have /usr/share/tomcat-7/webapps/sample2/WEB-INF/classes/mypackage/log4j.properties (where all java files are located) with content: log4j.rootLogger=DEBUG, org.displaytag.properties.TableProperties log4j.appender.org.displaytag.properties.TableProperties=org.apache.log4j.ConsoleAppender Why Log4j can not find that appender ? I have tried to put log4j.properties in multiple other locations +restart tomcat but it did not help. Thanks,
answer count: 0

http://stackoverflow.com/comment/40000467
score: 0
has text: Why would you get an exception? Instead `add` return false, as documented.
comment on: http://stackoverflow.com/q/25605887
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25676415
has comment: http://stackoverflow.com/comment/40127677
has comment: http://stackoverflow.com/comment/40127503
upvote count: 5
accepted answer of: http://stackoverflow.com/q/25675832
score: 5
has body: You can make use of a NavigableMap (like TreeMap) which has very useful methods exactly for this purpose. Initialize your map with all the values that you have computed and empty lists for each: NavigableMap&lt;Date, List&lt;Stat&gt;&gt; map = new TreeMap&lt;&gt;(); // add all your weekly values associated with empty lists Then for each of your Stat objects, find the proper list simply by: final Entry&lt;Date, List&lt;Stat&gt;&gt; entry = map.floorEntry(stat.getDate()); entry.getValue().add(stat);
has comment: http://stackoverflow.com/comment/40127542
type: Answer
answers question: http://stackoverflow.com/q/25675832
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39990143
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25600758
has text: Avoid using `null` layouts, pixel perfect layouts are an illusion within modern ui design. There are too many factors which affect the individual size of components, none of which you can control. Swing was designed to work with layout managers at the core, discarding these will lead to no end of issues and problems that you will spend more and more time trying to rectify
score: 0

http://stackoverflow.com/comment/40133205
has text: I am creating a job in Jenkins web page using CLI options. I need to refresh this Jenkins page in order to see the job created. how can I do it using Java or ant script. I only pass the URL.
comment on: http://stackoverflow.com/q/25679530
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25670635
has comment: http://stackoverflow.com/comment/40116828
tagged with: client
has title: Is it possible to read incoming data stream, using java, from Server to .exe client (Coded using C++)?
type: Question
has answer: http://stackoverflow.com/a/25670752
has body: Is it possible to read datastream sent from C++ server program to C++ client over socket connection in java? I have details like port number and server IP. Or do I need decompile the whole C++ client into Assembly and then somehow translate it into java to do that? I'm really not sure what kind of data it's transforming, though.. Somebody told me to code HTTP server and run it on my Router but I'm not really sure if that would work? Here’s the diagrammatic way to look at it. Server generates data. it puts it in a packet. it encrypts the packet. and sends it over the wire. It gets to a user’s Computer (= client). (I should be in the control now on..) (If I could somehow read data at this part?) The client reads the encrypted packet. (If I could somehow read data at this part?) (The later, the better :D) The client decrypts the packet. (If I could somehow read data at this part?) (The later, the better :D) The client does something. As said, the client is .exe file and it's coded using C++. And I don't have source code of it.
type: UnansweredQuestion
tagged with: sockets
answer count: 1
linked to: http://stackoverflow.com/q/41691079
has comment: http://stackoverflow.com/comment/40116969
score: 0
has comment: http://stackoverflow.com/comment/40119082
tagged with: java
tagged with: stream
has comment: http://stackoverflow.com/comment/40116916

http://stackoverflow.com/comment/40043452
has text: possible duplicate of [Spring Qualifier and property placeholder](http://stackoverflow.com/questions/7812745/spring-qualifier-and-property-placeholder)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25629826
score: 0

http://stackoverflow.com/comment/75575928
comment on: http://stackoverflow.com/a/28109402
score: 0
type: AnswerComment
has text: I don't see that there's any progress: 1 Vote for this issue, 2 Start watching this issue, Created: 26/Oct/12 9:39 AM, Updated: 10/Mar/16 1:24 PM
type: Comment

http://stackoverflow.com/comment/40007672
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25610298
has text: @PeterLawrey So it's not an absolute limit, but 1024 is the default. Thanks!
score: 1

http://stackoverflow.com/q/25630492
tagged with: regex
has body: I have a list of strings, like c++, c, java, c#, .net. I have to find the occurrences of these strings in some text. I tried, String pattern = "(?i)\\b"+Pattern.quote(str)+"\\b"; But it doesn't match with c++. Then, I removed \b and it started matching every c in the text. How do I match the whole word? Sample String: C, c#, C++ college cat cow
upvote count: 2
type: AnsweredQuestion
score: 0
downvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40044736
answer count: 1
has answer: http://stackoverflow.com/a/25630568
accepted answer: http://stackoverflow.com/a/25630568
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40044696
has title: Whole word regex match

http://stackoverflow.com/a/25591743
has body: String message; if(word2.compareTo(word1) &lt; 0) { //word2 &lt; word1 if(word3.compareTo(word1) &lt; 0) { //word3 &lt; word1 if(word3.compareTo(word2) &lt; 0) { //word3 &lt; word2 message = word3 + word2 + word1; } else { //word2 &lt;= word3 message = word2 + word3 + word1; } } else { //word1 &lt;= word3 message = word2 + word1 + word3; } } else { //word1 &lt;= word2 if(word3.compareTo(word2) &lt; 0) { //word3 &lt; word2 if(word3.compareTo(word1) &lt; 0) { //word3 &lt; word1 message = word3 + word1 + word2; } else { //word1 &lt;= word3 message = word1 + word3 + word2; } } else { //word2 &lt;= word3 message = word1 + word2 + word3; } } This is using the lexicographic/alphabetical order. If you want to compare the words using their lengths, you have to replace each s1.compareTo(s2) by s1.length() - s2.length() (you should have a positive integer if s1 is bigger than s2).
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25591586
has comment: http://stackoverflow.com/comment/39973950
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25591586

http://stackoverflow.com/q/25700328
score: 1
upvote count: 1
tagged with: java
downvote count: 0
favorite count: 0
type: Question
has body: I am trying to enable secure (SSL) JMX connection for service on Jetty server. All steps are done on one PC for simplifying. I generate key: keytool -genkey -alias myKeyServer -keyalg RSA -validity 365 -keystore myKeyServerStore.keystore -storepass 12345678 -keypass 12345678 -dname "CN=John Galt, OU=ADS, O=Company, L=Jersey, S=Jersey, C=US" Then export it: keytool -export -alias myKeyServer -keystore myKeyServerStore.keystore -file myKeyServer.cer -storepass 12345678 Then importing it: keytool -import -alias myKeyServer -file myKeyServer.cer -keystore myKeyServer.truststore -storepass 12345678 -noprompt Then I start standalone Jetty: java -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=1616 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=true -Djavax.net.ssl.keyStore=\"C:\Java\jdk1.7.0_07\bin\myKeyServerStore.keystore\" -Djavax.net.ssl.keyStorePassword=12345678 -Djavax.net.ssl.trustStore=\"C:\Java\jdk1.7.0_07\bin\myKeyServer.truststore\" -Djavax.net.ssl.trustStorePassword=12345678 -Dcom.sun.management.jmxremote.ssl.need.client.auth=true -Dcom.sun.management.jmxremote.registry.ssl=true -jar start.jar It starts successfully. Then I launch JConsole: jconsole -J-Djavax.net.ssl.trustStore=\"C:\Java\jdk1.7.0_07\bin\myKeyServer.truststore\" -J-Djavax.net.ssl.trustStorePassword=12345678 -J-Djavax.net.ssl.keyStore=\"C:\Java\jdk1.7.0_07\bin\myKeyServerStore.keystore\" -J-Djavax.net.ssl.keyStorePassword=12345678 192.168.0.1:1616 And after it I get an Exception in Jetty server console: java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) at javax.net.ssl.DefaultSSLSocketFactory.throwException(Unknown Source) at javax.net.ssl.DefaultSSLSocketFactory.createSocket(Unknown Source) at javax.rmi.ssl.SslRMIServerSocketFactory$1.accept(Unknown Source) at sun.rmi.transport.tcp.TCPTran…
has comment: http://stackoverflow.com/comment/40249301
type: UnansweredQuestion
tagged with: jconsole
tagged with: jmx
tagged with: jetty
tagged with: ssl
has title: How to enable SSL for JMX for Jetty server
answer count: 0

http://stackoverflow.com/comment/40112113
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25668020
score: 1
has text: Might as well run with the --stacktrace option to get more information.

http://stackoverflow.com/comment/39984889
comment on: http://stackoverflow.com/q/25596619
type: QuestionComment
has text: @MadProgrammer I made a resource package... and dragged the images into it... I've tried adding a source folder... that didn't work either... I've read it may just be Eclipse but I can't comprehend not being about to get this working within Eclipse...
score: 0
type: Comment

http://stackoverflow.com/q/25710543
has title: Java Android Camera
tagged with: android
tagged with: java
has body: I have this simple camera intent app but I want to know how to add filters to it. I am a beginner in Java I followed a guide to make the camera work. Can anyone help me on how to add filters with buttons onClick activity? public class MainActivity extends Activity { private static String logtag = "CameraApp"; private static int TAKE_PICTURE = 1; private Uri imageUri; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button cameraButton = (Button)findViewById(R.id.button_camera); cameraButton.setOnClickListener(cameraListener); } private OnClickListener cameraListener = new OnClickListener() { public void onClick(View v) { takePhoto(v); } }; public void takePhoto(View v) { Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); File photo = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "pic.jpg"); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo)); imageUri = Uri.fromFile(photo); startActivityForResult(intent, TAKE_PICTURE); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch(requestCode) { if(resultCode == Activity.RESULT_OK) { Uri selectedImage = imageUri; getContentResolver().notifyChange(selectedImage, null); ImageView imageView = (ImageView)findViewById(R.id.image_view_camera); ContentResolver cr = getContentResolver(); Bitmap bitmap; try { bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImage); imageView.setImageBitmap(bitmap); Toast.makeText(MainActivity.this, selectedImage.toString(), Toast.LENGTH_LONG).show(); } catch(Exception e) { Toast.makeText(MainActivity.this, "failed to load", Toast.LENGTH_LONG).show(); Log.e(logtag, e.toString()); } } } } }
tagged with: eclipse
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/25710780
answer count: 1
has answer: http://stackoverflow.com/a/25710780
type: AnsweredQuestion

http://stackoverflow.com/comment/40112672
type: QuestionComment
type: Comment
score: 0
has text: http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.11.2
comment on: http://stackoverflow.com/q/25667960

http://stackoverflow.com/a/25578591
has comment: http://stackoverflow.com/comment/39949775
has body: Ah, I missed the CTOR. Here it is with the correct CTOR: SOFieldAccessQuestion.B b = new SOFieldAccessQuestion.B( 0 ); SOFieldAccessQuestion.C c = new SOFieldAccessQuestion.C( 1 );
has comment: http://stackoverflow.com/comment/39949796
type: Answer
answers question: http://stackoverflow.com/q/25578571
score: 0

android-service
tags question: http://stackoverflow.com/q/25553180
tags question: http://stackoverflow.com/q/25562899
type: Tag
tags question: http://stackoverflow.com/q/25706917
tags question: http://stackoverflow.com/q/25636822
tags question: http://stackoverflow.com/q/25648443
tag name: android-service

http://stackoverflow.com/a/25598304
type: Answer
score: 2
downvote count: 0
has body: For lack of an answer but a lot of discussion what's probably happening is your framework sets a custom handler which swallows your exception (almost every web framework for example). Here's some code to illustrate how it works as there is a default handler and then each thread or thread group can have their own handler. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class Tests { public static void main(String ... args) { Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { System.out.print("[Handler Handling]\t"); System.out.print(t.getName()); System.out.print("\n"); e.printStackTrace(System.out); System.out.println("[End Handling]"); } }); new Thread() { { //Disable this handler this.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable throwable) { System.out.print("[Different Handling]\t"); System.out.print(thread.getName()); System.out.print("\n"); throwable.printStackTrace(System.out); System.out.println("[End Different Handler]"); } }); } public void run() { throw new RuntimeException("This is thrown in the child thread."); } }.start(); try { Thread.sleep(500); } catch (InterruptedException e1) { e1.printStackTrace(); } JFrame gui = new JFrame(); gui.setSize(400, 300); gui.setTitle("Swing Thread"); JButton error = new JButton("Throw Error"); error.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { throw new RuntimeException("This exception happens in the Swing thread"); } }); gui.add(error); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setVisible(true); throw new RuntimeException("This is thrown in the main thread."); } } This will provide the following output (or something similar if you click a button): [D…
answers question: http://stackoverflow.com/q/25596969
upvote count: 2

http://stackoverflow.com/q/25565706
tagged with: javabeans
has comment: http://stackoverflow.com/comment/40021485
has title: Spring Core Framework - Where are the beans hold?
favorite count: 0
has answer: http://stackoverflow.com/a/25565970
tagged with: java
score: 10
has comment: http://stackoverflow.com/comment/39924993
upvote count: 10
has comment: http://stackoverflow.com/comment/39924972
type: Question
answer count: 2
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25566705
has body: I am a junior Java developer and I am reading the spring documentation from spring.io. I read that every bean that gets registered in the *.xml file that spring uses to resolve dependencies is declared using &lt;bean&gt; &lt;/bean&gt; tags. My question is: In which data structure are the beans hold after the xml file is read and the beans are instantiated(created)? Thank you
tagged with: spring

http://stackoverflow.com/q/25601726
has title: Android, java: enter search query in activity
tagged with: search
score: 0
tagged with: java
has body: I want a user to type a search query in a mainactivity, and then I'll save this query and do a search in another activity(searchable). But now I only have code for when an item "search" pressed another activity appears and user's typing query there in a searchdialog. How should I make a typing in and opening a search dialog in my main activity, and then, after entering, go to searchable activity? Here's an existing code: AndroidManifest.xml: <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.SEARCH" /> <meta-data android:name="android.app.searchable" android:resource="@xml/searchable" /> MainActivity.java: public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.search: choise = 0; onSearchRequested(); Toast.makeText(this, item.getTitle(), Toast.LENGTH_SHORT).show(); Intent intent_search = new Intent(this, Searchable.class); startActivity(intent_search); return true; ... Searchable.java: if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query1 = intent.getStringExtra(SearchManager.QUERY); ...
answer count: 1
tagged with: android-activity
type: Question
has answer: http://stackoverflow.com/a/25602200
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/25625263
tagged with: securitymanager
has comment: http://stackoverflow.com/comment/40034907
score: -2
tagged with: nio
has answer: http://stackoverflow.com/a/25625435
has comment: http://stackoverflow.com/comment/40035094
has title: Give the permission in java to write on everywhere on the Hard Drive
type: AnsweredQuestion
downvote count: 4
upvote count: 2
has body: I am developing an application in java using the classes form the package nio. I would like to know how to provide the program the rights to write everywhere on the hard drive. because it works on my home directory but not everywhere on the hard drive.
answer count: 1
has comment: http://stackoverflow.com/comment/40035764
linked to: http://stackoverflow.com/q/664432
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40034934
tagged with: java
accepted answer: http://stackoverflow.com/a/25625435

http://stackoverflow.com/comment/39949238
has text: @DavidWallace To be clear, the `volatile` keyword is used to indicate that a variable's value will be modified by different threads. Making the variable `volatile` doesn't affect whether or not the code can be considered "thread-safe".
comment on: http://stackoverflow.com/q/25578210
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39934793
type: Comment
comment on: http://stackoverflow.com/a/25558282
type: AnswerComment
score: 0
has text: Thanks Thomas, that helps. Due to the intermittent nature I can't easily do the debug. However, I can review plugin source perhaps or increment from 2.5.1.rc4 to 2.5.1 which should be safe. Right now, I'm working on getting an easily reproducible case. At 2 hour per iteration test where I can't be sure of failure prevents cycle testing

http://stackoverflow.com/comment/45054194
type: QuestionComment
has text: Hi Daniel , we're actually facing the same problem. Have you found any clue to resolve this issue ? Maybe by upgrading Tomcat ?
comment on: http://stackoverflow.com/q/25668466
score: 1
type: Comment

jersey-client
tags question: http://stackoverflow.com/q/25552060
type: Tag
tag name: jersey-client

http://stackoverflow.com/a/25571735
accepted answer of: http://stackoverflow.com/q/25571428
answers question: http://stackoverflow.com/q/25571428
has body: btnAdd is null which results in the NullPointerException in btnAdd.setOnClickListener(this). This is because the fragment_add_student_details layout contains no View with the btnAdd id.
downvote count: 0
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer

deserialization
type: Tag
tags question: http://stackoverflow.com/q/25556624
tag name: deserialization

http://stackoverflow.com/a/25600964
score: 0
has body: Answer by Uluk Biy is correct (but I can not make a comment an answer). Be sure to thumb him up if this is helpful. Try to get the window object and set "app" after webview's engine loads the url successfully. Namely when the engine's state is State.SUCCEEDED. See WebEngine's javadoc. The WebEngine API page is here: http://docs.oracle.com/javafx/2/api/javafx/scene/web/WebEngine.html
answers question: http://stackoverflow.com/q/25599275
type: Answer

http://stackoverflow.com/q/25590303
has comment: http://stackoverflow.com/comment/39984981
score: 6
tagged with: maven
has answer: http://stackoverflow.com/a/71318750
linked to: http://stackoverflow.com/q/11402633
favorite count: 0
has comment: http://stackoverflow.com/comment/39971288
type: Question
has answer: http://stackoverflow.com/a/25599287
accepted answer: http://stackoverflow.com/a/25599287
has title: Getting java.lang.ClassNotFoundException: com.google.gson.Gson for maven project
answer count: 5
has answer: http://stackoverflow.com/a/46928753
has comment: http://stackoverflow.com/comment/39980663
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 6
tagged with: gson
has answer: http://stackoverflow.com/a/64487929
has body: I am new to maven.I am using apache-maven-3.2.2 for building my project.Its simple project which will received json data from client side and on server side it will convert this json data to its analogous java class.For conversion of json to java format we are using google's Gson library.Without maven my project is running properly.but when I converted it to maven then I got the following error: Caused by: java.lang.NoClassDefFoundError: com/google/gson/Gson at com.edfx.tsn.web.controller.DataController.transferData(DataController.java:51) [classes:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_17] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_17] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_17] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_17] at org.apache.el.parser.AstValue.invoke(AstValue.java:262) [jbossweb-7.0.13.Final.jar:] at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278) [jbossweb-7.0.13.Final.jar:] at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) [jsf-impl-2.1.7-jbossorg-2.jar:] at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final] ... 22 more From the error its pretty clear that its unable to Gson jar. Now below is my pom.xml file 4.0.0 TestJSON TestJSON 0.0.1-SNAPSHOT TestJSON maven-compiler-plugin 3.1 1.7 1.7 com.google.code.gson gson 2.2.4 javax.servlet javax.servlet-api 3.0.1 com.sun.faces jsf-api 2.2.6 com.sun.faces jsf-impl 2.2.6 war I am not getting any error at compile time and my project is getting deployed properly.I am using Jboss7 as.But I am getting this error at runtime when my actionListener method is getting invoked. I have already gone through couple of links in stackoverflow specially the below one GSON is not being…
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/46928753
has comment: http://stackoverflow.com/comment/39977402
downvote count: 0
has answer: http://stackoverflow.com/a/58875482

http://stackoverflow.com/a/25605771
type: Answer
has body: An activity is the java code which attaches actions and puts content to/in a layout. For this the Activity loads the layout.
answers question: http://stackoverflow.com/q/25605676
downvote count: 0
score: 1
upvote count: 1

android-contentprovider
tags question: http://stackoverflow.com/q/25584442
type: Tag
tag name: android-contentprovider
tags question: http://stackoverflow.com/q/25627673

http://stackoverflow.com/q/25696616
score: 1
tagged with: java
tagged with: slick2d
type: Question
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1
favorite count: 0
tagged with: collision
has title: Detecting collision in a 2D environment with Slick
has body: I have been having some trouble detecting the collision in my game. It seems that collision detection only works part of the time on only some of the walls. I am using slick2d for my library. If you need any more code or info I can give it to you. I have to go somewhere right now so I am just typing this out quickly but if you need anything more just ask. Code: @Override public void manageWallCollision(Scene currScene) { for(int i = 0; i &lt; currScene.getMapManager().getWalls().size(); i++){ MapTile currTile = currScene.getMapManager().getWalls().get(i); if(currTile.isCollidable()){ if(this.getBounds().intersects(currTile.getBounds())){ //bottom if(this.y2 &lt; currTile.getY()){ } //right else if(this.x2 &lt; currTile.getX()){ } //left else if(this.y &gt; currTile.getY2()){ } //top else if(this.x &gt; currTile.getX()){ } break; } } } } Any help is appreciated. Thanks. New Code: for(int i = 0; i &lt; currScene.getMapManager().getWalls().size(); i++){ MapTile currTile = currScene.getMapManager().getWalls().get(i); if(currTile.isCollidable()){ if(this.getBounds().intersects(currTile.getBounds())){ //down if(this.y2 &lt; currTile.getY() &amp;&amp; this.y &lt; currTile.getY2() &amp;&amp; this.y2 &lt; currTile.getY2()){ this.setY(currTile.getY() - this.getHEIGHT()); } //up if(this.y &lt; currTile.getY2() &amp;&amp; this.y2 &gt; currTile.getY() &amp;&amp; this.y2 &gt; currTile.getY2()){ this.setY(currTile.getY2()); } //right if(this.x2 &lt; currTile.getX() &amp;&amp; this.x &lt; currTile.getX2() &amp;&amp; this.x2 &lt; currTile.getX2()){ this.setX(currTile.getX() - this.getWIDTH()); } //left if(this.x &lt; currTile.getX2() &amp;&amp; this.x2 &gt; currTile.getX() &amp;&amp; this.x2 &gt; currTile.getX2()){ this.setX(currTile.getX2()); } } } } I am still having issues. It detects the collision fine but wherever it hits on a specific wall it goes to the same spot. Imagine a 2d room. So if it collided with the left wall then it automatically goes to a position on that wall. An…
tagged with: 2d

http://stackoverflow.com/q/25563111
type: Question
has comment: http://stackoverflow.com/comment/39920112
upvote count: 0
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/25563221
has comment: http://stackoverflow.com/comment/39920101
has body: class test8{ static public void main(String args[]){ int d = 9; d += d = 3; System.out.println (d); } } My understanding was the expression inside parentheses evaluates first setting d to 3. So, the above expression is equivalent to d = 3 d+= 3 which should give 6. How does java evaluate this to 12.
has title: Parentheses affecting operator precedence in java
has answer: http://stackoverflow.com/a/25563246
has answer: http://stackoverflow.com/a/25563252
tagged with: java
has answer: http://stackoverflow.com/a/25563178
downvote count: 3
has comment: http://stackoverflow.com/comment/39926290
answer count: 4
favorite count: 0

http://stackoverflow.com/comment/40179449
score: 3
type: Comment
type: QuestionComment
has text: I think the error message is pretty clear.
comment on: http://stackoverflow.com/q/25704788

http://stackoverflow.com/comment/103989611
type: AnswerComment
has text: Wow. I would call that a compiler bug.
comment on: http://stackoverflow.com/a/25706217
score: 0
type: Comment

http://stackoverflow.com/comment/40133567
has text: Nope, works fine for with WebLaf as well...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25679653
score: 0

http://stackoverflow.com/comment/39949309
score: 0
comment on: http://stackoverflow.com/q/25578210
type: Comment
type: QuestionComment
has text: It is not thread safe because when you have multiple threads you will have a `ConcurrentModificationException` on `mainList.add(r.nextInt(200))`.

http://stackoverflow.com/comment/40049105
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25632733
type: QuestionComment
has text: "I thought that ints could be considered as double values too." - nope. ints can be *converted* to double values. You are not saving memory when you return an int from `control` - it's just being silently converted to a double. If a method signature says `double`, it *always* returns double.

http://stackoverflow.com/a/52683024
type: Answer
has comment: http://stackoverflow.com/comment/92775590
score: 0
has comment: http://stackoverflow.com/comment/92775972
has comment: http://stackoverflow.com/comment/92775709
answers question: http://stackoverflow.com/q/25610544
has body: I just want to add a comment regarding naming conventions for the parent POM. Several responses, including the answer by carlspring and the answer by by Steve K, indicated naming the parent pom simply parent: com.example.foo:parent com.example.foo:foo com.example.foo:foo-bar com.example.foo:foo-bat com.example.foo:foo-baz I completely agree with the sentiment, because the parent POM is not a sub-module, which is what foo-parent would seem to imply. Option 1: com.example.foo:parent There is however a big problem using simply parent as the artifact ID, besides the fact that it doesn't give much info when searching for it in the Maven Repository. If you import the project into Eclipse, the IDE will use parent for the project name!! This is unsightly, and trying to import two projects that use this convention will cause pain. But I also don't want to name the artifact foo-parent, because as I mentioned it's not a submodule. Additionally, it will likely be sorted in the middle of the submodules, making it hard to find it in my IDE. Option 2: com.example.foo:foo-.parent After much thought and experimentation, I decided I'd like to propose a convention for parent POM artifact IDs: project-.parent. (Yes, this identifier is allowed by Maven.) This shows that the artifact is part of "project", but by beginning with a . it shows that it is a special POM, sort of like a metadata file or a configuration directory. Plus it sorts it to the front of the modules (although not in front of the single project artifact ID). So the module coordinates would look like this: com.example.foo:foo com.example.foo:foo-.parent com.example.foo:foo-bar com.example.foo:foo-bat com.example.foo:foo-baz There's a drawback, though: many tools don't seem to support thing. It looks like having dots in the artifact ID causes issues with JitPack, JFrog Artifactory, and OSGi Bnd, for example. Option 3: com.example.foo:foo--parent I then thought about using foo--parent, or even just foo--. But as - is used a…

http://stackoverflow.com/q/25637406
has answer: http://stackoverflow.com/a/25637776
tagged with: java
tagged with: file
has title: Path for image in java eclipse on MAC OS
tagged with: macos
type: Question
has comment: http://stackoverflow.com/comment/40057242
linked to: http://stackoverflow.com/q/17398533
has comment: http://stackoverflow.com/comment/40057103
type: UnansweredQuestion
tagged with: swt
tagged with: path
answer count: 1
has body: This is similar to Path for image file in Eclipse src folder, on a Mac question and i am using import org.eclipse.swt.graphics.Image; public class Images { static Image ICON_Search = new Image(App2.display, "src//search.jpg"); static Image ICON_RightArrow = new Image(App2.display, "src//right2.gif"); static Image ICON_LeftArrow = new Image(App2.display, "src//left4.gif"); static Image Background_White=new Image(App2.display,"src//whitebg.png"); } All my images are in src folder of project.This works fine on Windows but when i export it as a jar and run it on MAC OS it raises File not found exception.
score: 0

http://stackoverflow.com/a/25632738
type: Answer
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25632491
score: 2
has body: Start Jboss server with -b 0.0.0.0 ./standalone.sh -b.0.0.0.0 How to share jboss over network
answers question: http://stackoverflow.com/q/25632491

http://stackoverflow.com/q/25593245
downvote count: 0
answer count: 1
has body: I want to make my VBO move and I was wondering if I should update the entire VBO with updated values using glBufferSubData or just use the deprecated glTranslatef to move my thing. And if I were to just update the values in the VBO, should I use a separate VBO for the vertices, normals, and texture coordinates or should I put them all in one? Thanks.
accepted answer: http://stackoverflow.com/a/25593545
upvote count: 1
favorite count: 0
type: Question
has title: Is it better to use the deprecated glTranslatef or update coordinates using glBufferSubData?
has answer: http://stackoverflow.com/a/25593545
type: AnsweredQuestion
tagged with: opengl
score: 1
tagged with: java
tagged with: lwjgl

http://stackoverflow.com/a/65743352
has body: You can print a diamond of asterisks (mathematical operators) with for loops: int m = 4; int n = 4; for (int i = -m; i <= m; i++) { for (int j = -n; j <= n; j++) { int val = Math.abs(i) + Math.abs(j); System.out.print(val > Math.max(m, n) ? " " : "∗"); if (j < n) { System.out.print(" "); } else { System.out.println(); } } } Output: ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ You can create a 2d array with a diamond of asterisks using IntStreams: int m = 4; int n = 4; String[][] arr = IntStream.rangeClosed(-m, m) .mapToObj(i -> IntStream.rangeClosed(-n, n) .map(j -> Math.abs(i) + Math.abs(j)) .mapToObj(j -> j > Math.max(m, n) ? " " : "∗") .toArray(String[]::new)) .toArray(String[][]::new); // formatted output Arrays.stream(arr) .map(row -> Arrays.stream(row) .collect(Collectors.joining(" ", "[ ", " ]"))) .forEach(System.out::println); [ ∗ ] [ ∗ ∗ ∗ ] [ ∗ ∗ ∗ ∗ ∗ ] [ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ] [ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ] [ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ] [ ∗ ∗ ∗ ∗ ∗ ] [ ∗ ∗ ∗ ] [ ∗ ] See also: • Empty diamond shape with numbers • Filling a 2d array with numbers in a rhombus form
score: 1
type: Answer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25712029

http://stackoverflow.com/comment/58175223
type: Comment
has text: @gerferra: Hmm, that would be a rather unexpected location for this functionality. Besides, it wouldn't work for `Record1`, `Record2`, ...
type: AnswerComment
comment on: http://stackoverflow.com/a/25600490
score: 0

http://stackoverflow.com/comment/39949236
type: Comment
comment on: http://stackoverflow.com/a/25578248
score: 0
type: AnswerComment
has text: "synchronization facilities" refers generally to things that can be used to synchronize operations and includes stuff like CAS as well.

http://stackoverflow.com/comment/40086188
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25635831
type: AnswerComment
has text: Works for me on Mac OS 10.9 and Java 8. What are you using?

http://stackoverflow.com/a/25602210
downvote count: 0
answers question: http://stackoverflow.com/q/25601448
has comment: http://stackoverflow.com/comment/53115428
has comment: http://stackoverflow.com/comment/53112988
has body: Did with the help of a callback on the column. Callback&lt;TableColumn&lt;Inventory, String&gt;, TableCell&lt;Inventory, String&gt;&gt; cellFactory = new Callback&lt;TableColumn&lt;Inventory, String&gt;, TableCell&lt;Inventory, String&gt;&gt;() { public TableCell call(TableColumn p) { TableCell cell = new TableCell&lt;Person, String&gt;() { @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); setText(empty ? null : getString()); setStyle("-fx-background-color:"+getString()); } private String getString() { return getItem() == null ? "" : getItem().toString(); } }; return cell; } };
has comment: http://stackoverflow.com/comment/53138340
type: Answer
score: 11
upvote count: 11
accepted answer of: http://stackoverflow.com/q/25601448
has comment: http://stackoverflow.com/comment/53110506
type: AcceptedAnswer

http://stackoverflow.com/a/25601913
score: 0
answers question: http://stackoverflow.com/q/25601567
has comment: http://stackoverflow.com/comment/39992563
has comment: http://stackoverflow.com/comment/39994173
has body: Don't access Swing components from other threads. Use a swing Timer instead. See How to use swing timers
has comment: http://stackoverflow.com/comment/39992834
has comment: http://stackoverflow.com/comment/39993395
type: Answer

http://stackoverflow.com/a/25636863
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40055983
accepted answer of: http://stackoverflow.com/q/25636827
score: 5
answers question: http://stackoverflow.com/q/25636827
type: Answer
has body: First you can get the text paint using TextView.getPaint(), then each time you add a new word(Hi, I, am, etc), call measureText on the paint. If the result length is longer than the available width of your TextView, add a \n before the new word.Reset the data and repeat the steps.
has comment: http://stackoverflow.com/comment/40056469
downvote count: 2
upvote count: 7

http://stackoverflow.com/q/25606267
has body: I am building a android project where am storing some details which includes date as string,but now I need to sort the list view by date.I am bit confused on how to do it.I am done with everything but need to sort the list by date. Here is the overview of how am storing data. I have an arraylist of type Person like ArrayList&lt;Person&gt; personDetails = new ArrayList&lt;Person&gt;(); Person class consists of several variable but I will limit to three 1)name 2)Record created(date) 3)Address then add to Person like personDetails.add(Person Object). Please guide me on how to sort the list by date. Thanks for your time.
has answer: http://stackoverflow.com/a/25606575
has comment: http://stackoverflow.com/comment/40000220
has title: How to sort dates of type string in java
tagged with: sorting
has comment: http://stackoverflow.com/comment/40000273
has comment: http://stackoverflow.com/comment/40000391
tagged with: arraylist
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40000986
answer count: 3
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/25606575
has comment: http://stackoverflow.com/comment/40000187
has answer: http://stackoverflow.com/a/25606380
has answer: http://stackoverflow.com/a/25606471
accepted answer: http://stackoverflow.com/a/25606471
downvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/q/25609440
tagged with: eclipse
has answer: http://stackoverflow.com/a/25611026
answer count: 2
has title: JFace TableViewer with ViewerSorter and StyledCellLabelProvider
type: UnansweredQuestion
tagged with: swt
has body: In my TableViewer there are some TableViewerColumns. I have a text widget and a button 'search'. Whenever i hit search i want to color the table cells text that contain(match) the word inside the text widget. I can do that with setting a StyledCellLabelProvider to each TableViewerColumn and overriding the update method, setStyleRanges for every cell text contain that word. I tried to set a ColumnLabelProvider to every TableViewerColumn because i need to override the getText method' but in this case overriding the update method doesn't seem to work for setStyleRanges. Finally i can't make a StyledCellLabelProvider work along with a ViewerSorter because StyledCellLabelProvider doesn't have a getText method. Is there a way to highlite words and at the same time have the table sorting capabily?
tagged with: tableviewer
type: Question
score: 0
has answer: http://stackoverflow.com/a/25609630
tagged with: java
tagged with: jface

http://stackoverflow.com/comment/40142278
type: AnswerComment
has text: is src/assembly a source folder?
comment on: http://stackoverflow.com/a/25680551
type: Comment
score: 0

http://stackoverflow.com/q/25561752
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25562034
score: 5
has answer: http://stackoverflow.com/a/25562034
tagged with: uiscrollview
tagged with: android
upvote count: 5
has body: I try to take a convert my ScrollView into bitmap, my ScrollView has content that spills out of the screen (hence scrolling made possible), after I Ask here I can capture my Activity in ScrollView, But I got A problem, the Bitmap for saving a Screenshot not create All View, only the last of ScrollView, and the rest of it is Black screen as Below : this is my code for taking a Screenshot for all view in ScrollView: scroll_pp=(ScrollView)polis.findViewById(R.id.scroll_pp); utktest=polis.findViewById(R.id.scroll_pp); int totalHeight = scroll_pp.getChildAt(0).getHeight(); int totalWidth = scroll_pp.getChildAt(0).getWidth(); Bitmap b= MethodSupport.loadBitmapFromView(utktest, totalWidth, totalHeight); String extr = Environment.getExternalStorageDirectory().toString() + File.separator + "Folder"; String fileName = "Test.jpg"; File myPath = new File(extr, fileName); FileOutputStream fos = null; try { fos = new FileOutputStream(myPath); b.compress(Bitmap.CompressFormat.JPEG, 100, fos); fos.flush(); fos.close(); MediaStore.Images.Media.insertImage(getActivity().getContentResolver(), b, "Screen", "screen"); }catch (FileNotFoundException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } public static Bitmap loadBitmapFromView(View v, int width, int height) { Bitmap b = Bitmap.createBitmap(width , height, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); v.draw(c); return b; } So Is there something wrong with my code so I can not display the bitmap in according what I want?
type: AnsweredQuestion
tagged with: screenshot
linked to: http://stackoverflow.com/q/25518449
tagged with: java
has title: Convert all content in a ScrollView to a bitmap?
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/39984096
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25595359
has text: `/levels` is a directory contains 3 files i.e `level1.json`, `level2.json` and `level3.json` .. all of which are in the .jar

http://stackoverflow.com/comment/40171749
type: Comment
comment on: http://stackoverflow.com/a/25700609
score: 0
type: AnswerComment
has text: Quite right about `long` vs `int`. I don't know whether it's worth storing collections... it depends on the application, and whether it's worth retrieving *all* matches rather than just *any* match. I've edited my answer along the lines you suggest, though.

http://stackoverflow.com/q/25555930
has comment: http://stackoverflow.com/comment/39906702
has title: How is a date value represented as a long integer translated into a meaningful date?
has comment: http://stackoverflow.com/comment/39906754
has comment: http://stackoverflow.com/comment/39906686
accepted answer: http://stackoverflow.com/a/25556587
has comment: http://stackoverflow.com/comment/39907863
has answer: http://stackoverflow.com/a/25556587
has body: I want to know, how does this work? When I pass a long integer as a date, how is that value transformed into a Date? Ex: public Date converter(Long time){ //what the magic? } This question is not new Date(long), I know this. But what do I want to know what calculations are used internally to produce the (human-meaningful) date value.
linked to: http://stackoverflow.com/q/7487460
has comment: http://stackoverflow.com/comment/39907551
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39907473
score: 0
has comment: http://stackoverflow.com/comment/39907502
has comment: http://stackoverflow.com/comment/39906653
tagged with: java
has comment: http://stackoverflow.com/comment/39906889
answer count: 1
has comment: http://stackoverflow.com/comment/39906749
has comment: http://stackoverflow.com/comment/39907228
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39907150
has comment: http://stackoverflow.com/comment/39906756

http://stackoverflow.com/q/25684424
tagged with: io
has body: How do i open a chm file through a java program in MAC OS X . I tried using Desktop.getDesktop.open() but it gives me error Failed to open,edit or print BGDesktop.chm.Error Code -10814
tagged with: chm
has title: How do i open a chm file with java in mac os?
has comment: http://stackoverflow.com/comment/40141607
score: 0
has comment: http://stackoverflow.com/comment/40141511
tagged with: java
answer count: 1
tagged with: file
has comment: http://stackoverflow.com/comment/40141725
has answer: http://stackoverflow.com/a/51490069
tagged with: macos
type: Question
has comment: http://stackoverflow.com/comment/40141764
type: UnansweredQuestion

http://stackoverflow.com/comment/39920987
has text: Thanks for the answer! I think, I don't need C3PO pool manager for testing, so I configured default JDBC pool. Is this right?
comment on: http://stackoverflow.com/a/25562742
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25587693
linked to: http://stackoverflow.com/q/6397716
upvote count: 4
type: AnsweredQuestion
answer count: 2
tagged with: java
tagged with: h2
downvote count: 1
has comment: http://stackoverflow.com/comment/39966506
favorite count: 0
linked to: http://stackoverflow.com/q/154636
possible better answer: http://stackoverflow.com/a/25588153
type: Question
score: 3
has comment: http://stackoverflow.com/comment/39966193
has answer: http://stackoverflow.com/a/25588153
accepted answer: http://stackoverflow.com/a/25589920
has comment: http://stackoverflow.com/comment/39966163
has title: How do I create a H2 database inside a java project in Eclipse?
has body: I want to create an embedded H2 database in my simple java project in Eclipse. How do I do this programatically and package the db inside my code ? I tried a SO post for this and got an error in my code. Code - public static void main(String[]args){ JdbcDataSource ds = new JdbcDataSource(); ds.setURL("jdbc:h2:˜/test"); ds.setUser("sa"); ds.setPassword("sa"); try { Connection conn = ds.getConnection(); } catch (SQLException e) { e.printStackTrace(); } } Error - org.h2.jdbc.JdbcSQLException: A file path that is implicitly relative to the current working directory is not allowed in the database URL "jdbc:h2:˜/test". Use an absolute path, ~/name, ./name, or the baseDir setting instead. [90011-181] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:179) at org.h2.message.DbException.get(DbException.java:155) at org.h2.engine.ConnectionInfo.getName(ConnectionInfo.java:398) at org.h2.engine.Engine.openSession(Engine.java:45) at org.h2.engine.Engine.openSession(Engine.java:167) at org.h2.engine.Engine.createSessionAndValidate(Engine.java:145) at org.h2.engine.Engine.createSession(Engine.java:128) at org.h2.engine.Engine.createSession(Engine.java:26) at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:347) at org.h2.jdbc.JdbcConnection.&lt;init&gt;(JdbcConnection.java:108) at org.h2.jdbc.JdbcConnection.&lt;init&gt;(JdbcConnection.java:92) at org.h2.Driver.connect(Driver.java:72) at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:190) at org.h2.jdbcx.JdbcDataSource.getConnection(JdbcDataSource.java:161) at MyCode.main(MyCode.java:8) I saw this link - https://groups.google.com/forum/#!msg/h2-database/SlSwte0DLSU/eWj0UaejdkEJ and Where are my H2 database files?. Its not clear how I can get the exact path to test database on my windows pc. How do I first access the test database and then create another database inside my java project ? Thank you.
has answer: http://stackoverflow.com/a/25589920
has comment: http://stackoverflow.com/comment/39967486
tagged with: eclipse

http://stackoverflow.com/q/25617519
has comment: http://stackoverflow.com/comment/40024494
has comment: http://stackoverflow.com/comment/40025047
upvote count: 2
tagged with: ognl
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40026675
tagged with: jsp
has body: I am working on Struts2 Application; my displaying objects are Map objects: Map<String, HashMap<String, List<PlanDAO>>> channelRoomTypePlanmap = new HashMap<String,HashMap<String,List<PlanDAO>>>(); Map<String, List<RateInventoryDAO>> rateInventoryMap = new HashMap<String, List<RateInventoryDAO>>(); Here, I have two objects, where rateInventoryMap key is dependent on channelRoomTypePlanmap value combination. Like when I print first value of channelRoomTypePlanmap I want to create key using combination of its value, and find it in rateInventoryMap , if its true then it'll print its value. <s:iterator value="channelRoomTypePlanmap"> <s:property value="key" /> <s:iterator value="value"> <s:property value="key" /> <s:iterator value="value"> <s:property value="planName" /> <s:iterator value="rateInventoryMap"> <s:iterator value="value"> <s:property value="currentRate" /> </s:iterator> </s:iterator> </s:iterator> </s:iterator> </s:iterator> I tried this, which is showing in wrong format, means showing all data from second Map in single row for all. I've also heard that scriptlet code should be avoided. How can I join these two Maps on JSP ? Current View using above code_
has title: Join two Map on Jsp page - Struts2 application
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40025299
linked to: http://stackoverflow.com/q/24428474
has comment: http://stackoverflow.com/comment/40025035
tagged with: java
linked to: http://stackoverflow.com/q/23664009
tagged with: dictionary
has comment: http://stackoverflow.com/comment/40025487
has answer: http://stackoverflow.com/a/25619603
accepted answer: http://stackoverflow.com/a/25619603
has comment: http://stackoverflow.com/comment/40024643
has comment: http://stackoverflow.com/comment/40024850
linked to: http://stackoverflow.com/q/15006868
tagged with: struts2
has comment: http://stackoverflow.com/comment/40025907
score: 2
has comment: http://stackoverflow.com/comment/40026445
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40026154
has comment: http://stackoverflow.com/comment/40025874

http://stackoverflow.com/q/25571668
tagged with: web-services
favorite count: 0
tagged with: jboss6.x
type: AnsweredQuestion
tagged with: rest
has body: I am trying to deploy a war (Rest based Webservice)file on a jboss eap 6.3 server . The deployment is failing with the following trace. I looked into all the dependencies, everything looks fine. Am i missing something ? 11:22:57,659 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "RestService.war" (runtime-name: "RestService.war") 11:22:58,074 WARN [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015893: Encountered invalid class name 'com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App' for service type 'javax.ws.rs.ext.MessageBodyReader' 11:22:58,074 WARN [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015893: Encountered invalid class name 'com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$Text' for service type 'javax.ws.rs.ext.MessageBodyReader' 11:22:58,075 WARN [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015893: Encountered invalid class name 'com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General' for service type 'javax.ws.rs.ext.MessageBodyReader' 11:22:58,075 WARN [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015893: Encountered invalid class name 'com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$App' for service type 'javax.ws.rs.ext.MessageBodyReader' 11:22:58,075 WARN [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015893: Encountered invalid class name 'com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Text' for service type 'javax.ws.rs.ext.MessageBodyReader' 11:22:58,075 WARN [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015893: Encountered invalid class name 'com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General' for service type 'javax.ws.rs.ext.MessageBodyReader' 11:22:58,076 WARN [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015893: Encountered invalid class name 'com.sun.jersey.core.impl.provider.e…
downvote count: 0
has answer: http://stackoverflow.com/a/25580971
accepted answer: http://stackoverflow.com/a/25580971
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/29543531
linked to: http://stackoverflow.com/q/6953516
tagged with: jboss7.x
has answer: http://stackoverflow.com/a/29543531
type: Question
answer count: 2
upvote count: 1
has title: Error during deploying REST Webservice on JBOSS EAP 6.3

http://stackoverflow.com/a/26160695
type: Answer
accepted answer of: http://stackoverflow.com/q/25584631
upvote count: 2
has body: You will first need to have the camel-blueprint dependency available in the bundle so that the xml namespace can be found. Then you need to use the correct namespace. The correct one is, xmlns:cxf="http://cxf.apache.org/blueprint/core" An example is: &lt;blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/blueprint" xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws" xmlns:cxf="http://cxf.apache.org/blueprint/core" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0" xsi:schemaLocation=" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd "&gt;
type: AcceptedAnswer
downvote count: 0
score: 2
answers question: http://stackoverflow.com/q/25584631

http://stackoverflow.com/comment/40162773
score: 0
type: Comment
has text: Removing append mode and the truncation works just as well: you don't 'have' to do it this way.
type: AnswerComment
comment on: http://stackoverflow.com/a/25694706

http://stackoverflow.com/q/25584448
has answer: http://stackoverflow.com/a/25584478
has comment: http://stackoverflow.com/comment/39960089
linked to: http://stackoverflow.com/q/3301635
answer count: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25584543
has comment: http://stackoverflow.com/comment/39960126
has answer: http://stackoverflow.com/a/25584737
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39960174
tagged with: immutability
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39960117
downvote count: 0
has body: I have doubt a doubt regarding making an immutable class. As per the java docs. I made the class final( no one can extend) field are private. no setter function. If fields are mutable then send a cloned copy of the field. My doubt is that its compulsory to make a field of my class as final?
linked to: http://stackoverflow.com/q/16061030
has title: is it compulsion to make field as final to make class immutable
score: 3

http://stackoverflow.com/comment/40202632
comment on: http://stackoverflow.com/a/25711047
type: AnswerComment
score: 1
has text: confirmed that this is working for me now. I am still to try this without supplying the '+' symbol, and just have `return "redirect: index";`
type: Comment

http://stackoverflow.com/q/25683484
has comment: http://stackoverflow.com/comment/40140420
has title: Java Run Shell Command on Raspberry Pi
type: Question
tagged with: raspberry-pi
has comment: http://stackoverflow.com/comment/40140298
type: UnansweredQuestion
tagged with: gpio
answer count: 1
has comment: http://stackoverflow.com/comment/40158097
linked to: http://stackoverflow.com/q/39821986
has comment: http://stackoverflow.com/comment/40140500
has comment: http://stackoverflow.com/comment/40140078
has comment: http://stackoverflow.com/comment/40142621
has answer: http://stackoverflow.com/a/68514480
score: 0
has body: I am trying to use the GPIO pins on the Raspberry Pi. Currently I am using ProcessBuilder to execute the commands. However, whenever I run it it always says: Exception in thread "main" java.io.IOException: Cannot run program "echo 18 &gt; /sys/class/gpio/export": error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041) at Testing.initiate(Testing.java:32) at Testing.main(Testing.java:8) Caused by: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.&lt;init&gt;(UNIXProcess.java:135) at java.lang.ProcessImpl.start(ProcessImpl.java:130) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022) ... 2 more Here is the code I am using: ProcessBuilder pb = new ProcessBuilder("echo " + gpiopin + " &gt; /sys/class/gpio/export"); ProcessBuilder pb1 = new ProcessBuilder("echo out &gt; /sys/class/gpio/gpio" + gpiopin + "/direction"); ProcessBuilder pb2 = new ProcessBuilder("echo 1 &gt; /sys/class/gpio/gpio" + gpiopin + "/value"); pb.redirectErrorStream(true); pb1.redirectErrorStream(true); pb2.redirectErrorStream(true); Process ps = pb.start(); Process ps1 = pb1.start(); Process ps2 = pb2.start(); Why is this happening? Also, if there is a better way of doing this how? Thanks Edit: Seems like there are no more errors, but the commands are not running. Could someone please look at my code to make sure i'm not being stupid? import java.util.Scanner; public class Testing { public static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); initiate(18); while(true) { String input = scan.nextLine(); if(input.equals("on")) { System.out.println("on"); bellOn(); }else if(input.equals("off")) { System.out.println("off"); bellOff(); } } } static int gpio = 18; static String gp = "" + gpio; static boolean initiated = false; public static boolean initiate(int gpiopin) throws Exception { gpio = gpiopin; ProcessBuilder pb = new ProcessBuilder…
tagged with: java
has comment: http://stackoverflow.com/comment/40144172
linked to: http://stackoverflow.com/q/10735415

system
tag name: system
tags question: http://stackoverflow.com/q/25587264
tags question: http://stackoverflow.com/q/25683000
tags question: http://stackoverflow.com/q/25578549
tags question: http://stackoverflow.com/q/25591205
type: Tag

http://stackoverflow.com/comment/40069210
has text: In eclipse 4.3 it compiles (no error is shown, so I guess is a bug in that compiler
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25644403
score: 2

http://stackoverflow.com/q/25686026
score: 0
has comment: http://stackoverflow.com/comment/40209255
tagged with: java
has comment: http://stackoverflow.com/comment/40146893
has title: How to re align the components in Grid layout in swt in java?
tagged with: rcp
linked to: http://stackoverflow.com/q/12189543
has comment: http://stackoverflow.com/comment/40208912
type: Question
has body: I have a page. in that three composites are there one by one.simply i am putting the composites into grid layout . composite1 Composite2 Composite3 Based on some condition, i will set visible false composite 1. So remaining components will be visible true. My problem here, when i set visible false composite 1, i want to move Composite 2, composite 3 go to UP. Composite2 Composite3 But i am facing problem here Space Composite2 Composite3 in the place of Composite1 , i am getting space due to setVisible (false). But i want to remove space and Composite2 has to be place in Composite1 instead of space, Composite3 to be place in Composite2. i tried to setComputeSize(0,0) for the the Composite1. But Its not working.Could anyone please help me.
answer count: 0
has comment: http://stackoverflow.com/comment/40210850
type: UnansweredQuestion
tagged with: swt
duplicate of: http://stackoverflow.com/q/12189543
tagged with: jface

http://stackoverflow.com/comment/40067917
type: QuestionComment
score: 0
has text: Could you post a small html sample where you have the same problem?
comment on: http://stackoverflow.com/q/25626743
type: Comment

http://stackoverflow.com/q/25606833
tagged with: java
has comment: http://stackoverflow.com/comment/40064644
has comment: http://stackoverflow.com/comment/40064167
has title: Fastest way to sum integers in text file
answer count: 7
has comment: http://stackoverflow.com/comment/40043193
has comment: http://stackoverflow.com/comment/40021722
linked to: http://stackoverflow.com/q/8809894
has comment: http://stackoverflow.com/comment/40003286
has comment: http://stackoverflow.com/comment/40041034
has answer: http://stackoverflow.com/a/25607002
favorite count: 0
has comment: http://stackoverflow.com/comment/40053727
type: Question
has comment: http://stackoverflow.com/comment/40320304
has comment: http://stackoverflow.com/comment/40001545
linked to: http://stackoverflow.com/q/17637176
has comment: http://stackoverflow.com/comment/40150511
has comment: http://stackoverflow.com/comment/40053792
has comment: http://stackoverflow.com/comment/40053638
upvote count: 52
has comment: http://stackoverflow.com/comment/40186706
has comment: http://stackoverflow.com/comment/40048414
has comment: http://stackoverflow.com/comment/40042952
has answer: http://stackoverflow.com/a/25607155
accepted answer: http://stackoverflow.com/a/25607155
has comment: http://stackoverflow.com/comment/40053488
has answer: http://stackoverflow.com/a/25689416
has comment: http://stackoverflow.com/comment/40017244
has comment: http://stackoverflow.com/comment/40001408
linked to: http://stackoverflow.com/q/25595844
has comment: http://stackoverflow.com/comment/40064613
has answer: http://stackoverflow.com/a/25607283
has answer: http://stackoverflow.com/a/25757572
has body: Question Suppose you have a large ASCII text file, with a random non-negative integer on each line, each in the range from 0 to 1,000,000,000. There are 100,000,000 lines in the file. What's the fastest way to read through the file and calculate the sum of all the integers? Constraint: we've got 10MB of RAM to work with. The file is 1GB in size, so we don't want to read the whole thing in and then process it. Here are various solutions I've tried. I found the results rather surprising. Is there anything faster that I've missed? Please note: all timings given below are for running the algorithm 10 times in total (run once and discard; start timer; run 10 times; stop timer). The machine is a fairly slow Core 2 Duo. Method 1: the natural approach The first thing to try is the obvious approach: private long sumLineByLine() throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new FileReader(file)); String line; long total = 0; while ((line = br.readLine()) != null) { int k = Integer.parseInt(line); total += k; } br.close(); return total; } Note that the maximum possible return value is 10^17, which still easily fits in a long, so we don't have to worry about overflows. On my machine, running this 11 times and discounting the first run takes around 92.9 seconds. Method 2: a minor tweak Inspired by a comment on this question, I tried not creating a new int k to store the result of parsing the line, and instead just to add the parsed value directly to total. So this: while ((line = br.readLine()) != null) { int k = Integer.parseInt(line); total += k; } becomes this: while ((line = br.readLine()) != null) total += Integer.parseInt(line); I was certain that this wouldn't make any difference, and thought it highly likely that the compiler would generate the same bytecode for the two versions. But, to my surprise, it did shave a little time off: we're down to 92.1 seconds. Method 3: manually parsing the integer One thing that bothers me about the c…
has comment: http://stackoverflow.com/comment/40001596
has comment: http://stackoverflow.com/comment/40097875
has answer: http://stackoverflow.com/a/25608015
possible better answer: http://stackoverflow.com/a/25608015
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40002801
tagged with: performance
tagged with: file-io
downvote count: 3
has answer: http://stackoverflow.com/a/25607380
has comment: http://stackoverflow.com/comment/40049631
score: 49

http://stackoverflow.com/q/25643071
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40081545
tagged with: maven
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40081449
has answer: http://stackoverflow.com/a/25662538
has title: Architecture for modular Spring project
type: Question
linked to: http://stackoverflow.com/q/21690215
tagged with: java
tagged with: architecture
tagged with: spring
accepted answer: http://stackoverflow.com/a/25662538
has body: I want create skeleton for big ecommerce project. It will be huge project. It should be a core module and set of additional modules. Now I am thinking about maven modules into Spring MVC project. But I am newbie in maven and Spring How make each module independent from other modules? Any best practice? Any examples or code snippets?
upvote count: 2

http://stackoverflow.com/q/25653356
has comment: http://stackoverflow.com/comment/40086563
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40086159
has comment: http://stackoverflow.com/comment/40086018
has comment: http://stackoverflow.com/comment/40086391
has comment: http://stackoverflow.com/comment/40086241
tagged with: edit
score: 0
tagged with: jnlp
tagged with: windows
tagged with: java
has body: I have a JNLP file as part of a project kept in webapps folder in Red5 server in Windows 8. I deployed the server, and then tried to access the JNLP file in Internet Explorer. A Java popup came, and it said, Launch failed due to application error. I closed the Java popup. I stopped the server. I then opened the JNLP file in the text editor to make necessary changes. But, now when I am trying to save the file, it is saying "Please check whether if this file is opened in another program". My server is shut down, IE is closed. I checked in Task Manager and there is no javaw.exe is running. I even restarted the computer. Still I am unable to save this file due to the same error! Does this mean the JNLP file is still running somewhere? How can I find that app and kill it? Any help is appreciated!
has comment: http://stackoverflow.com/comment/40086332
has title: When trying to edit JNLP file, it is saying file is open in another program, so cannot edit
type: Question

jssor
tag name: jssor
type: Tag
tags question: http://stackoverflow.com/q/25557516

http://stackoverflow.com/q/25618246
favorite count: 0
has answer: http://stackoverflow.com/a/25619708
type: Question
has comment: http://stackoverflow.com/comment/40022749
tagged with: google-maps
type: UnansweredQuestion
tagged with: android
score: 2
upvote count: 2
downvote count: 0
has title: Working on google maps in android not able to call SetOnItemClickListener Event
tagged with: java
answer count: 1
has body: I am beginner in android and I am developing one module where user click on the AutocompleteTextView for the places. I have taken the code from the https://developers.google.com/places/training/autocomplete-android Now i am able to get the Result in the form of List but i am not able to select the text from that autocomplete List. ![enter image description here][1] As you can see i am getting the List but when i click on the selected list it's doing nothing means my setOnItemClickListener is not getting invoked. My mainActivity code is like this public class GoogleMap extends Activity{ private AutoCompleteTextView autoCompView; private ArrayAdapter&lt;String&gt; adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_google_map); autoCompView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView); adapter = new PlacesAutoCompleteAdapter(this,R.layout.activity_google_map); autoCompView.setAdapter(adapter); autoCompView.setThreshold(1); // when the user clicks an item of the drop-down list autoCompView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { Toast.makeText(getBaseContext(), "MultiAutoComplete: " + "you add color "+arg0.getItemAtPosition(arg2), Toast.LENGTH_LONG).show(); } }); }

http://stackoverflow.com/comment/40394388
has text: Why to you use `@ManyToOne`? It looks like a `@OneToOne`. If it is realy a n-1, where is your `Collection` (`Set` or `List`)?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25654463

http://stackoverflow.com/comment/40107756
score: 0
comment on: http://stackoverflow.com/q/25664639
has text: Don't print code in the first place! ;-) Okay, if you really want to, I guess your best bet is to file a bug against IDEA. Link it to the PyCharm issue, if possible, and have all your colleagues vote for the issue.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40178415
comment on: http://stackoverflow.com/q/25702667
type: Comment
score: 0
has text: http://www.jetbrains.com/support/teamcity/index.html
type: QuestionComment

http://stackoverflow.com/comment/40071223
type: AnswerComment
comment on: http://stackoverflow.com/a/25644672
has text: indeed... i observed that i forgot the increment. Thanks again for your answer.
type: Comment
score: 0

http://stackoverflow.com/comment/40180672
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25705126
type: AnswerComment
has text: @eldjon Depends how you define "blocking blocks". And no if I understand correctly. There are some old APIs that are not interruptible designed long time ago where multi-threaded programming wasn't yet so basic thing. Like operations on files - see [RamdomAccessFile.read()](http://docs.oracle.com/javase/7/docs/api/java/io/RandomAccessFile.html#read()). Weather some method is interruptible depends on how was it implemented.

http://stackoverflow.com/q/25629478
score: 2
type: AnsweredQuestion
tagged with: sign
downvote count: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40042920
has comment: http://stackoverflow.com/comment/40043082
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40043040
has comment: http://stackoverflow.com/comment/40042844
has comment: http://stackoverflow.com/comment/40042982
has body: I'm making a simple test in java, (i'm a begineer) and i was trying to make a program that calculates the discriminate of a second degree equation and displays the results, but when i change the sign of nom1 and nom2, the program doesn't displays any result, i've made some tests and i'm sure that the problem is there but i don't know how to resolve it. Any help is welcome. Here is my code: public class test { public static void main(String[] args) { double a = 2; double b = 5; double c = 3; double delta = b*b - 4 * a * c; double den = 2 * a; if(delta == 0){ double nom = b; double pgcd = pgcd(nom, den); double x0nom = nom/pgcd; double x0den = den/pgcd; System.out.println("x0 = "+String.valueOf(x0nom)+" / "+String.valueOf(x0den)); }else if(delta &gt; 0){ // x1: double nom1 = -b + Math.sqrt(delta); double pgcd1 = pgcd(nom1, den); int x1nom = (int) (nom1 / pgcd1); int x1den = (int) (den / pgcd1); // x2: double nom2 = -b - Math.sqrt(delta); double pgcd2 = pgcd(nom2, den); int x2nom = (int) (nom2 / pgcd2); int x2den = (int) (den / pgcd2); System.out.println("pgcd = "+String.valueOf(pgcd1)+" "+String.valueOf(pgcd2)); System.out.println("x1 = "+String.valueOf(x1nom)+" / "+String.valueOf(x1den)); System.out.println("x2 = "+String.valueOf(x2nom)+" / "+String.valueOf(x2den)); }else if(delta &lt; 0){ } } public static double pgcd(double a, double b) { while (a != b) { if (a &lt; b){ b = b - a; }else{ a = a - b; } } return a; } }
has comment: http://stackoverflow.com/comment/40042917
has comment: http://stackoverflow.com/comment/40043198
has title: Having problems with negative signed numbers
has answer: http://stackoverflow.com/a/25629844
accepted answer: http://stackoverflow.com/a/25629844

http://stackoverflow.com/comment/39933506
type: AnswerComment
comment on: http://stackoverflow.com/a/25569430
has text: how the streaming is handled?
score: 0
type: Comment

http://stackoverflow.com/a/25701029
score: 1
has comment: http://stackoverflow.com/comment/40172785
type: Answer
has comment: http://stackoverflow.com/comment/40172865
answers question: http://stackoverflow.com/q/25700987
downvote count: 0
upvote count: 1
has body: Just use lookahead and lookbehind in your regex,, (?&lt;==)(".*?")(?=;) Get the value from group index 1. DEMO Pattern r = Pattern.compile("(?&lt;==)(\".*?\")(?=;)"); Matcher m = r.matcher("String string=\"welcome\";\n" + "String k=\"a\\\"welcome\";"); while(m.find()){ System.out.println("0:"+m.group(1)); } Output: 0:"welcome" 0:"a\"welcome" OR Use the greediness of *, Pattern r = Pattern.compile("(\".*\")"); OR It skips the double quotes which are preceded by a backslash, Pattern r = Pattern.compile("(\\\".*?(?&lt;=[^\\\\])\\\")");

http://stackoverflow.com/comment/39991718
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25601606
has text: @Thomas Good thing you confirmed. I was thinking of accepting his answer also. :)
type: Comment

http://stackoverflow.com/comment/39939998
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25572816
type: AnswerComment
has text: And when returning a value for Math.cos(g) for instance, g would be the value return from deeper functions. How would I incorporate that into my apply method?

http://stackoverflow.com/a/28697722
type: Answer
has comment: http://stackoverflow.com/comment/72029681
score: 22
has body: This worked for me. If you go to your workspace directory perform the following steps: cd .metadata/.plugins mv org.eclipse.core.resources org.eclipse.core.resources.bak Start eclipse. (It should show an error message or an empty workspace because no project is found.) Close all open editors tabs. Exit eclipse. rm -rf org.eclipse.core.resources (Delete the newly created directory.) mv org.eclipse.core.resources.bak/ org.eclipse.core.resources (Restore the original directory.) Start eclipse and start working. Solution, coutersy of the following: http://off-topic.biz/en/eclipse-hangs-at-startup-showing-only-the-splash-screen/
downvote count: 0
answers question: http://stackoverflow.com/q/25598594
upvote count: 22

http://stackoverflow.com/comment/40032722
comment on: http://stackoverflow.com/q/25592918
has text: What was the cause? Please add your solution as an answer.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/25690612
has body: Both are pretty much the same except for the return object. getResourceAsStream eventually calls getResource and returns an opened InputStream from the URL object as shown in the following snippet from the ClassLoader class: public InputStream getResourceAsStream(String name) { URL url = getResource(name); try { return url != null ? url.openStream() : null; } catch (IOException e) { return null; } }
accepted answer of: http://stackoverflow.com/q/25690565
has comment: http://stackoverflow.com/comment/40154838
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25690565
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25704822
upvote count: 4
answers question: http://stackoverflow.com/q/25704778
has body: You can first check if the line intersects the plane containing your face (it is a very simple linear system). If the intersection I exists, and your face is ABCD, you can compute the barycentric coordinates (alpha,beta) of I in ABC. If alpha or beta &lt; 0 meaning that ABC does not contain I), do the same thing with BCD. To sum up (in pseudo-code) : // no intersection, or the line belongs to the plane. Treat both in the same way. if (line is parallel to the plane) return false I = intersection(line,plane(A,B,C)) (a,b) = barycentricCoordinates(i,triangle(A,B,C)) if (a &gt;= 0 and b &gt;= 0) return true (c,d) = barycentricCoordinates(i,triangle(B,C,D)) return c &gt;= 0 and d &gt;= 0 I don't know if it is optimal in terms of performance, but mathematically it works. EDIT : how exactly do you compute I ? To do this, it is more comfortable to work with the cartesian representation of the plane (ABC) and the line L = (U,P) where U is the directing vector (u,v,w) and P a point (x0,y0,z0) belonging to L. first, find the normal vector N = (a,b,c) of (ABC). (ABC)'s equation then is (E0) : a.x + b.y + c.z + d = 0. Determine d by injecting the coordinates of A in this equation. the equation of L is (E1) : (x,y,z) = (x0,y0,z0) + lambda.(u,v,w) Now, if U.N = 0, then the line is parallel to the plane, we consider there is no intersection. Otherwise, we can inject (E1) in (E0) to determine lambda : lambda = - (a.x0 + b.y0 + c.z0 + d) / (a.u + b.v + c.w) Following this, you can compute the coordinates of the point I using this value of lambda in (E1).
has comment: http://stackoverflow.com/comment/40180966
downvote count: 0
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/40181142
has comment: http://stackoverflow.com/comment/40181208
has comment: http://stackoverflow.com/comment/40181324
has comment: http://stackoverflow.com/comment/40181314
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25704778

http://stackoverflow.com/comment/39902041
comment on: http://stackoverflow.com/a/25553478
score: 0
type: Comment
has text: But now getX() and getY() aren't methods anymore
type: AnswerComment

http://stackoverflow.com/comment/40017033
has text: Still sounds like eclipse is running the wrong class...
score: 0
comment on: http://stackoverflow.com/q/25615366
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25560804
has comment: http://stackoverflow.com/comment/39916050
has body: I would say avaliacao.cliente.getIdcliente()); returns a value that does not exist in your cliente database table.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25560742

http://stackoverflow.com/q/25602406
answer count: 2
has title: ZipEntry unknown size although set
has answer: http://stackoverflow.com/a/25605266
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/39995579
type: Question
has comment: http://stackoverflow.com/comment/39995682
type: UnansweredQuestion
tagged with: java
tagged with: size
has answer: http://stackoverflow.com/a/49325918
has body: I searched and read all questions about ZipEntry (JAVA 7) but my problem is nowhere addressed: I successfully zip and unzip files in JAVA, but although, at zip time, I set the uncompressed size by ZipEntry.setSize(long) to values surely smaller than int value, reading back, at unzip time, by ZipEntry.getSize() always returns -1. Although my programs run well, the verification part warns for unknown size. How do I set the uncompressed size?
score: 4
upvote count: 4
tagged with: http://stackoverflow.com/tag/zip

http://stackoverflow.com/a/25637209
answers question: http://stackoverflow.com/q/25637187
upvote count: 2
has body: 'thetext'..you have added spaces in between..remove the space double wto=Double.parseDouble(getIntent().getExtras().getString("thetext"));//here remove the space in name 'thetext' double z=wto*0.75; String weight= Double.toString(z); tvr.setText(weight);
type: AcceptedAnswer
downvote count: 0
score: 2
accepted answer of: http://stackoverflow.com/q/25637187
has comment: http://stackoverflow.com/comment/40056552
type: Answer

http://stackoverflow.com/comment/40068665
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25643204
has text: Post some configuration and your post processor. Make sure you aren't scanning for components twice (which is what appears to happen).

http://stackoverflow.com/a/25699161
has comment: http://stackoverflow.com/comment/40173006
type: Answer
has comment: http://stackoverflow.com/comment/40177646
has comment: http://stackoverflow.com/comment/40169967
answers question: http://stackoverflow.com/q/25698843
has body: Web based usually means that it's available on a website. Swing is not a website. You could use Java Webstart to launch a Swing application, but I wouldn't call that "web based". Then of course you have applets, but I'd advise against that, since many people have disabled the Java plugin for security reasons.
score: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40175170
has comment: http://stackoverflow.com/comment/40169684

http://stackoverflow.com/a/25580472
has comment: http://stackoverflow.com/comment/39962896
type: Answer
score: 0
type: AcceptedAnswer
has body: Run the bash commandjava -version This should tell you the version of the JDK / JRE you are running, including whether it is J2ME, J2SE or J2EE.
accepted answer of: http://stackoverflow.com/q/25580464
answers question: http://stackoverflow.com/q/25580464
has comment: http://stackoverflow.com/comment/39953165

http://stackoverflow.com/comment/40009459
comment on: http://stackoverflow.com/q/25610394
type: QuestionComment
type: Comment
has text: Both `for` loops in `getSubs()` increment `i`...
score: 2

http://stackoverflow.com/comment/40146105
comment on: http://stackoverflow.com/q/25686949
type: Comment
score: 0
has text: `finally` always executes no matter what. But, you can't `return` from a finally block.
type: QuestionComment

http://stackoverflow.com/q/25624280
has comment: http://stackoverflow.com/comment/40036149
has title: Setting the number of viewable item count in listView
has comment: http://stackoverflow.com/comment/40033489
has comment: http://stackoverflow.com/comment/40034261
has comment: http://stackoverflow.com/comment/40034008
tagged with: android
linked to: http://stackoverflow.com/q/14869682
possible better answer: http://stackoverflow.com/a/25624485
has body: Is there a way to set the viewable item count for a listview? or am I obliged to set the height for the listview? For instance, I got a list that includes 9 items. I only want 4 of them to appear at first. Then user needs to scroll to see other items. list_anlam.xml <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/title_popup_hikayeoku" /> <EditText android:id="@+id/kelime_text" android:inputType="text" android:layout_width="fill_parent" android:layout_height="wrap_content" /> list_item.xml : <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:textSize="20sp" android:padding="10dp" /> Where I fill items into listview : HikayeOkuActivity.java is String[] anlamlar = null; anlamlar = MainActivity.dbM.ilkAnlamGetir(selectedText); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item,anlamlar); anlamList.setAdapter(adapter); popupWindow.showAsDropDown(mainLayout, touchedX,touchedY);
has answer: http://stackoverflow.com/a/25624485
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25625786
answer count: 3
tagged with: android-listview
has comment: http://stackoverflow.com/comment/40034218
has answer: http://stackoverflow.com/a/25625786
tagged with: java
has comment: http://stackoverflow.com/comment/40033007
type: Question
has answer: http://stackoverflow.com/a/25625344

http://stackoverflow.com/comment/39901846
has text: Ok, I've managed to keep only the resources :) But now I'm trying to figure out how to keep the classes members and remove all methods, this way we'll be in the limit. Any ideas?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25552704

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/25604454
tags question: http://stackoverflow.com/q/25565583
tags question: http://stackoverflow.com/q/25681351
tag name: android-gridview

http://stackoverflow.com/comment/39956004
type: QuestionComment
score: 0
has text: I am implementing the DataSourceServlet https://developers.google.com/chart/interactive/docs/dev/dsl_javadocs/com/google/visualization/datasource/DataSourceServlet. This servlet only expose the generateDataTable which return a DataTable object. So i think it has to attach to the DataTable object somehow. Are you suggested that I implement a different type of Servlet? I want a servlet that support the query syntax directly from the client side. The query language is here https://developers.google.com/chart/interactive/docs/querylanguage
comment on: http://stackoverflow.com/q/25575605
type: Comment

http://stackoverflow.com/a/25596701
downvote count: 0
has comment: http://stackoverflow.com/comment/40002237
score: 2
has body: To the best of my knowledge, there's currently no API for determining which physical key was pressed in JavaFX. It's hard to see how a third party library could implement this, as it would have to intercept the low-level implementation of JavaFX in a way that is not really accessible to such code. If this is important to you, I'd recommend filing a feature request at https://javafx-jira.kenai.com/
has comment: http://stackoverflow.com/comment/40000366
type: Answer
has comment: http://stackoverflow.com/comment/40002516
answers question: http://stackoverflow.com/q/25595677
has comment: http://stackoverflow.com/comment/39991547
upvote count: 2

http://stackoverflow.com/comment/39954280
comment on: http://stackoverflow.com/q/25577327
type: Comment
has text: here are other two screenshots where probably you understand the situation better: Before rotation: http://postimg.org/image/tc9jpq9zr/ After rotation:http://postimg.org/image/rnq6svvrr/
score: 0
type: QuestionComment

http://stackoverflow.com/a/25572629
answers question: http://stackoverflow.com/q/25552621
accepted answer of: http://stackoverflow.com/q/25552621
score: 1
type: Answer
has body: Apparently the Lenovo A2107A tablet returning "Busy" state after calling the WifiP2pManager instance on its discoveryPeers method, doesn't support WiFi Direct/WiFi P2P, in fact there is no option to lookup for P2P peers on it, hence returning the statusCode 2 Busy status in the onFailure callback, even running Android 4.1.2 that in theory does support WifiDirect which is a bit strange. A couple of helpful projects to understand better the inner workings of this technology are here: https://github.com/ahmontero/wifi-direct-demo https://github.com/mayfourth/WiFi-Direct-File-Transfer
downvote count: 0
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/39977203
comment on: http://stackoverflow.com/q/25593733
type: Comment
has text: based on the left join, the new collection would have all elements of collection1, and only the matching elements of collection2 based on matching ID
type: QuestionComment
score: 2

http://stackoverflow.com/comment/39965296
comment on: http://stackoverflow.com/q/25587265
has text: It depends on where you use this snippet. Is it inside activity or fragment or just plain class?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25639891
type: UnansweredQuestion
has body: I'm getting a connect timed out stacktrace below on first request after less then 5 millisecond although my timeout is configured to be 20000 milliseconds (verified using debug). this occurs only when the Arp need to be established. (reproducible in my server using arp -d) machines(client and server): centos6.5 Linux machine (virtual machine) Jvm - Java7 any ideas? stack trace: Caused by: java.net.SocketTimeoutException: connect timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153) at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:120) at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191) at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138) tcp dump: -sh-4.1$ sudo tcpdump -A host cs-simulator.e4x.com tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 13:59:39.470342 ARP, Request who-has cs-simulator.e4x.com tell 10.101.5.228, length 28 .........PV.bb e........ e./ 13:59:39.470939 ARP, Reply cs-simulator.e4x.com is-at 00:50:56:8f:20:87 (oui Unknown), length 46 .........PV. . e./.PV.bb e.................... 13:59:39.470945 IP 10.101.5.228.40618 &gt; cs-simulator.e4x.c…
tagged with: centos6.5
has comment: http://stackoverflow.com/comment/40061823
score: 2
answer count: 0
upvote count: 2
has title: SocketTimeoutException: connect timed out immediately when arp is not established
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/40064382
downvote count: 0
tagged with: socket-timeout-exception
favorite count: 0
type: Question
tagged with: linux

http://stackoverflow.com/comment/40070851
has text: Try running the JAR from the command line, not by a double click. Then you should be able to see the exception.
comment on: http://stackoverflow.com/q/25644798
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25711137
tagged with: java
tagged with: email
has comment: http://stackoverflow.com/comment/40190869
score: -9
has answer: http://stackoverflow.com/a/25711166
has body: What is the package in which the Email class resides? I need the jar or the package to be imported to my Java application. Appreciated your help in advance.
has comment: http://stackoverflow.com/comment/40190856
upvote count: 0
type: UnansweredQuestion
has title: What is the package in which the Email class resides?
answer count: 1
tagged with: jar
favorite count: 0
type: Question
tagged with: package
downvote count: 9

waveform
tag name: waveform
type: Tag
tags question: http://stackoverflow.com/q/25560701

http://stackoverflow.com/a/25645488
has comment: http://stackoverflow.com/comment/40071219
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25645391
has comment: http://stackoverflow.com/comment/40073823
answers question: http://stackoverflow.com/q/25645391
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: You're trying to connect to the server with a wrong IP address (0.0.0.0). You'll need to know the IP address of the computer running the server program and use that to instantiate the socket in your client program. Note that the server should be reachable from the client computer.

http://stackoverflow.com/a/25593783
has comment: http://stackoverflow.com/comment/58793277
answers question: http://stackoverflow.com/q/25593768
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/58791574
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/61559970
type: Answer
has body: Yes, Calendar could return a locale specific calendar. From the source. /** * Gets a calendar using the default time zone and locale. The * Calendar returned is based on the current time * in the default time zone with the default * {@link Locale.Category#FORMAT FORMAT} locale. * * @return a Calendar. */ public static Calendar getInstance() { return createCalendar(TimeZone.getDefault(), Locale.getDefault(Locale.Category.FORMAT)); } private static Calendar createCalendar(TimeZone zone, Locale aLocale) { CalendarProvider provider = LocaleProviderAdapter.getAdapter(CalendarProvider.class, aLocale) .getCalendarProvider(); if (provider != null) { try { return provider.getInstance(zone, aLocale); } catch (IllegalArgumentException iae) { // fall back to the default instantiation } } Calendar cal = null; if (aLocale.hasExtensions()) { String caltype = aLocale.getUnicodeLocaleType("ca"); if (caltype != null) { switch (caltype) { case "buddhist": cal = new BuddhistCalendar(zone, aLocale); break; case "japanese": cal = new JapaneseImperialCalendar(zone, aLocale); break; case "gregory": cal = new GregorianCalendar(zone, aLocale); break; } } } if (cal == null) { // If no known calendar type is explicitly specified, // perform the traditional way to create a Calendar: // create a BuddhistCalendar for th_TH locale, // a JapaneseImperialCalendar for ja_JP_JP locale, or // a GregorianCalendar for any other locales. // NOTE: The language, country and variant strings are interned. if (aLocale.getLanguage() == "th" && aLocale.getCountry() == "TH") { cal = new BuddhistCalendar(zone, aLocale); } else if (aLocale.getVariant() == "JP" && aLocale.getLanguage() == "ja" && aLocale.getCountry() == "JP") { cal = new JapaneseImperialCalendar(zone, aLocale); } else { cal = new GregorianCalendar(zone, aLocale); } } return cal; }
accepted answer of: http://stackoverflow.com/q/25593768

http://stackoverflow.com/a/25628454
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25627192
has comment: http://stackoverflow.com/comment/40041127
type: Answer
has body: Think And Store In UTC Generally best to store and work with date-time values in UTC. Translate to a local date-time only for presentation when expected by the user. If it is important to know the data-entry user's time zone or offset, record that separately in addition to the UTC value. Ask For Time Zone As for determine the time zone or offset from a user on a client machine, in a web browser you could ask via JavaScript as suggest in the other answer. But ultimately, if the time zone or offset is really important, you should ask the user. Present a list for them to choose. Use proper time zone names, never 3 or 4 letter codes. Those codes are neither standardized nor unique. You cannot trust the clock on users’ computers. When you need to know the current time for any important purpose, use your server’s time since you have control over that machine. And be sure that server computer is hooked up to one or more time servers. Serialize to ISO 8601 When serializing date-time values to a string, using the ISO 8601 format is definitely the way to go. The new java.time package in Java 8 extends ISO 8601 format by appending the name of the time zone. Interesting idea, but not standard afaik. Do Not Track Count From Epoch Tracking date-time by a count since epoch is meaningless to humans which makes debugging and verification tricky and error-prone. Date-time libraries internally track a count from epoch. But we have those libraries for a reason, to make the programming work easier and more correct. Some geeky types of people may suggest this approach. But they are often naïve about how tricky and thorny is date-time work. Furthermore, different environments and libraries use different scales: whole seconds, milliseconds, microseconds, and nanoseconds. And about two dozen epochs have been used in various computer systems. Avoid j.u.Date &amp; .Calendar Never use the java.util.Date and .Calendar classes bundled with Java. They are notoriously troublesome and should be avo…
answers question: http://stackoverflow.com/q/25627192
has comment: http://stackoverflow.com/comment/40046496
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/25608580
upvote count: 6
score: 6
answers question: http://stackoverflow.com/q/25608493
type: Answer
has body: Why are u overriding the service method. There is no need of that. Remove it or else call super.service(request,response); REASON Try to see the source of HttpServlet class. There you will see that depending on the method that is used to called the servlet i.e. GET/POST the necessary method doGet() or doPost() is called. And when the container actually receives a request it starts a new thread and and serves the client by calling service() method. So if you override it and don't call the super class' service method or define your own strategyhow GET will be called, doGet() method will never be called. Your request never calls doGet() method, its the service() method which calls it.
accepted answer of: http://stackoverflow.com/q/25608493
has comment: http://stackoverflow.com/comment/40005113
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/q/25567940
has title: Java 8 Stream API Collector Issue
tagged with: java-8
favorite count: 0
type: AnsweredQuestion
tagged with: java-stream
tagged with: collectors
has answer: http://stackoverflow.com/a/25568085
has body: I'm traversing a graph by its edges and want to have a list of all sources and targets. This is what I have so far: public Set&lt;Vertex&gt; getVertices(){ Set&lt;Vertex&gt; vertices = this.edges.stream().map(edge -&gt; edge.getSource()).collect(Collectors.toSet()); vertices.addAll(this.edges.stream().map(edge -&gt; edge.getTarget()).collect(Collectors.toSet())); return vertices; } Is there any way to get both source and target in the same mapping/collection step? Something like (PSEUDO-CODE): edges.stream().collect(edge.getSource()).collect(edge.getTarget()) Or plain old Java 7 for ( Edge e : edges ){ vertices.add(e.getSource()); vertices.add(e.getTarget()); } Cheers, Daniel
has answer: http://stackoverflow.com/a/25568177
possible better answer: http://stackoverflow.com/a/25568177
tagged with: java
type: Question
upvote count: 2
score: 2
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/25568085

http://stackoverflow.com/comment/39899494
type: QuestionComment
comment on: http://stackoverflow.com/q/25552209
has text: why don't you use map and store them as pair?
score: 0
type: Comment

http://stackoverflow.com/comment/40110639
type: Comment
has text: @Stratmoss: "If there isn't a -vm line, then add one"?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25666991

http://stackoverflow.com/comment/39970660
has text: Updated my answer. Pass your textview object as argument as ble.initializeBlue(textView); I tested it. It should work. If it shows any error kindly share logcat details
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25588705
score: 0

http://stackoverflow.com/comment/39992054
comment on: http://stackoverflow.com/q/25601759
type: Comment
type: QuestionComment
score: 0
has text: @ElliottFrisch How can I check that? In my database i have inserted values like 2014-05-22-11.02.32.315000

http://stackoverflow.com/q/25668020
has title: Gradle Artifactory Plugin Not Generating Pom File
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25668292
has answer: http://stackoverflow.com/a/32857723
has comment: http://stackoverflow.com/comment/40112113
has answer: http://stackoverflow.com/a/48076299
downvote count: 0
tagged with: artifactory
score: 10
tagged with: maven
answer count: 6
has answer: http://stackoverflow.com/a/32064236
has answer: http://stackoverflow.com/a/40276271
has answer: http://stackoverflow.com/a/38455896
tagged with: java
upvote count: 10
tagged with: gradle
favorite count: 0
type: Question
has body: A weird issue is occurring when I try to "artifactoryPublish" to a remote artifactory repository. I have the task run ./gradlew clean jar artifactoryPublish Which worked only a couple days ago. Now I am getting this error: :artifactoryPublish FAILED FAILURE: Build failed with an exception. * What went wrong: A problem was found with the configuration of task ':artifactoryPublish'. &gt; File '/Users/me/Programming/android/LibraryPlugin/build/poms/pom-default.xml' specified for property 'mavenDescriptor' does not exist. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. What am I doing wrong?

http://stackoverflow.com/q/25587404
has comment: http://stackoverflow.com/comment/39965706
type: Question
has answer: http://stackoverflow.com/a/25587505
type: UnansweredQuestion
tagged with: android
has title: How to multiply a class with local variables with random values?
score: -1
has comment: http://stackoverflow.com/comment/39965576
has comment: http://stackoverflow.com/comment/39965625
has comment: http://stackoverflow.com/comment/39965912
upvote count: 0
has comment: http://stackoverflow.com/comment/39965606
has body: I have this class called "Enemy". Inside of it there is a bitmap and some methods that animate the movement of this bitmap. So what I want to do is to multiply this class X times. I do that with a "for" loop and an array, but what I've discovered is that the variables inside the class end up being all the same, despite the fact that their values are random (Math.random()). This works if I declare the variables outside the class, but that's not what I want, because I want the class to be independent. I want the same class, multiplied by X times, moving independently one from the other. Thanks very much. public class Enemy { float q,w,e,r = 0; public void execute(){ draw(); move(); } public void draw(){ Bitmap bitmap = (Bitmap) BitmapFactory.decodeResource(getResources(), R.drawable.base); if(q == 0 &amp;&amp; w == 0 || q &gt; e-5 &amp;&amp; q &lt; e+5 || w &gt; e-5 &amp;&amp; w &lt; e+5){ e = 100 + (float) (Math.random()*200); r = 100 + (float) (Math.random()*200); } canvas.drawBitmap(bitmap, q, w, null); } public void move () { if(q&lt;e &amp;&amp; w&lt;r) { new Thread(); { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } finally { EplusPlus(); }}} if(q&lt;e &amp;&amp; w&gt;r) { new Thread(); { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } finally { EplusMinus(); }}} if(q&gt;e &amp;&amp; w&lt;r) { new Thread(); { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } finally { EminusPlus(); }}} if(q&gt;e &amp;&amp; w&gt;r) { new Thread(); { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } finally { EminusMinus(); }}} } I call the class like this: public void run() { while(isRunning) { if(!ourHolder.getSurface().isValid()) continue; canvas = ourHolder.lockCanvas(); canvas.drawRGB(30, 30, 200); Enemy[] enemy = new Enemy[3]; for(int i = 0; i&lt;enemy.length; i++){ enemy[i].execute(); } ourHolder.unlockCanvasAndPost(canvas); } }
tagged with: java
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/q/25676873
has comment: http://stackoverflow.com/comment/40130673
has answer: http://stackoverflow.com/a/29193537
type: Question
tagged with: jakarta-ee
tagged with: netbeans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40128500
tagged with: maven
tagged with: tomcat
score: 0
has title: Java Maven WebApp Tomcat
tagged with: java
has body: I am working on a Java web app that utilizes maven. I deploy the web app by creating a .war file and move it to Apache Tomcat 8 server on my machine. The problem is that the web app only works on Apache Tomcat 8 servers. It does not work on Tomcat 7 or 6. The web app uses Jave EE 6. I am unable to find a solution for this problem. I included a copy of pom.xml from the web app. <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.mycompany BulkUploaderMaven 1.0-SNAPSHOT war BulkUploaderMaven <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> net.sourceforge jwbf 2.0.0 javax javaee-api 7.0 org.apache.poi poi 3.9 com.liferay org.apache.commons.fileupload 1.2.2.LIFERAY-PATCHED-1 mysql mysql-connector-java 5.1.31 org.apache.maven.plugins maven-compiler-plugin 3.1 1.6 1.6 ${endorsed.dir} org.apache.maven.plugins maven-war-plugin 2.3 false org.apache.maven.plugins maven-dependency-plugin 2.6 validate copy ${endorsed.dir} true javax javaee-endorsed-api 7.0 jar
answer count: 1

http://stackoverflow.com/comment/40033336
type: AnswerComment
has text: Then how can i have a reliable code which can work in all browsers.
type: Comment
comment on: http://stackoverflow.com/a/25624476
score: 0

http://stackoverflow.com/comment/133795777
score: 0
type: AnswerComment
has text: This really clarifies it for me. @JJJ don't read this as a flat list. Read it as if it was a Venn diagram where the indentation indicates subset.
type: Comment
comment on: http://stackoverflow.com/a/55770139

http://stackoverflow.com/q/25680728
has title: Jackson's JsonSerializer and thread safety
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25681099
tagged with: multithreading
has body: I have a simple JsonSerializer in my Spring project: public class JsonDateTimeSerializer extends JsonSerializer<Date> { private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @Override public void serialize(Date value, JsonGenerator gen, SerializerProvider sp) throws IOException { gen.writeString(DATE_FORMAT.format(value)); } } And use it like: @JsonSerialize(using = JsonDateTimeSerializer.class) public Date getDate() { return date; } Do I have to take care of thread-safety and make the DATE_FORMAT synchronized (as SimpleDateFormat is not thread-safe)? I am not sure how exactly @JsonSerialize works - does it create just single serialized instance across all threads? Or does it create separate instance for each transformation?
tagged with: spring
type: AnsweredQuestion
score: 3
upvote count: 3
answer count: 2
downvote count: 0
tagged with: jackson-databind
possible better answer: http://stackoverflow.com/a/25681099
linked to: http://stackoverflow.com/q/817856
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25696261
accepted answer: http://stackoverflow.com/a/25696261

http://stackoverflow.com/comment/39949866
type: Comment
type: QuestionComment
has text: Wow, the new optional class in java seems so cumbersome. Would you like to see my solution witgout the optional class? Or do you need to use optional for some sort of course?
comment on: http://stackoverflow.com/q/25578269
score: 0

http://stackoverflow.com/q/25657341
has answer: http://stackoverflow.com/a/25670204
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25853821
has body: I am able to find the whole sever log under the path ....\Oracle\WLS\user_projects\domains\[domain name goes here]\servers\[Server name goes here]\logs But the problem that I it does not contains all the stack that I usually see in Jdeveloper console at the development time. So, Where to find the stack or logs for the application not the whole sever exactly like Jdeveloper console where every thing is shown even the print statements (System.out.print()) ?
linked to: http://stackoverflow.com/q/8112581
favorite count: 0
type: Question
tagged with: weblogic
score: 5
has answer: http://stackoverflow.com/a/76060766
type: UnansweredQuestion
tagged with: oracle-database
upvote count: 5
has title: Where to find the application log that deployed on weblogic server 10.3.5?
tagged with: logging
tagged with: deployment
answer count: 4
has answer: http://stackoverflow.com/a/44781662

http://stackoverflow.com/q/25711468
accepted answer: http://stackoverflow.com/a/27144761
has body: I try to build my own version of this EndpointsAsyncClass on Github. Here's my implementation: package com.example.pontuse.helloendpointsproject; import android.content.Context; import android.os.AsyncTask; import android.util.Pair; import android.widget.Toast; import com.google.api.client.extensions.android.http.AndroidHttp; import com.google.api.client.extensions.android.json.AndroidJsonFactory; import com.google.api.client.googleapis.services.AbstractGoogleClientRequest; import com.google.api.client.googleapis.services.GoogleClientRequestInitializer; import com.google.devrel.samples.mymodule.api.commentEndpoint.CommentEndpoint; import java.io.IOException; /** * Created by pontuse on 2014-09-07. */ public class EndpointsAsyncTask extends AsyncTask&lt;Pair&lt;Context, String&gt;, Void, String&gt; { private static CommentEndpoint myApiService = null; private Context context; @Override protected String doInBackground(Pair&lt;Context, String&gt;... params) { if(myApiService == null) { // Only do this once MyApi.Builder builder = new MyApi.Builder(AndroidHttp.newCompatibleTransport(), new AndroidJsonFactory(), null) // options for running against local devappserver // - 10.0.2.2 is localhost's IP address in Android emulator // - turn off compression when running against local devappserver .setRootUrl("http://10.0.2.2:8080/_ah/api/") .setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() { @Override public void initialize(AbstractGoogleClientRequest&lt;?&gt; abstractGoogleClientRequest) throws IOException { abstractGoogleClientRequest.setDisableGZipContent(true); } }); // end options for devappserver myApiService = builder.build(); } context = params[0].first; String name = params[0].second; try { return myApiService.sayHi(name).execute().getData(); } catch (IOException e) { return e.getMessage(); } } @Override protected void onPostExecute(String result) { Toast.makeText(context, result, Toast.LENGTH_LONG).show(); } } However, Android Studio keep tellin…
tagged with: java
linked to: http://stackoverflow.com/q/25748095
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/27144761
tagged with: google-app-engine
has title: Cannot import app engine endpoint into my EndpointsAsyncClass in Android Studio
tagged with: android
has answer: http://stackoverflow.com/a/25722977
possible better answer: http://stackoverflow.com/a/25722977
score: 4
upvote count: 4
tagged with: android-studio
tagged with: google-cloud-endpoints
type: AnsweredQuestion
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/39916424
has text: The docs say "A pool that is no longer referenced in a program AND has no remaining threads will be shutdown automatically. If you would like to ensure that unreferenced pools are reclaimed even if users forget to call shutdown(), then you must arrange that unused threads eventually die, by setting appropriate keep-alive times, using a lower bound of zero core threads and/or setting allowCoreThreadTimeOut(boolean)." Which means even if its unreachable and gets finalized the threads still wont get killed by default.
type: AnswerComment
comment on: http://stackoverflow.com/a/25561003
type: Comment
score: 0

http://stackoverflow.com/a/66168688
upvote count: 2
score: 1
downvote count: 1
has body: SimpleClientHttpRequestFactory uses the standard JDK's HTTP library, and hence does not support methods like HttpMethod.PATCH. So it's better to use HttpComponentsClientHttpRequestFactory now than change it later when you have to.
answers question: http://stackoverflow.com/q/25698072
type: Answer

http://stackoverflow.com/comment/39915749
type: Comment
type: QuestionComment
has text: Thanks you very much. But I do not know where I can config permission. It the first time I work with jsp. Sorry about that. And I hope your assitance
score: 0
comment on: http://stackoverflow.com/q/25554021

apache-spark
tags question: http://stackoverflow.com/q/25588391
tags question: http://stackoverflow.com/q/25609300
tags question: http://stackoverflow.com/q/25626477
type: Tag
tag name: apache-spark

http://stackoverflow.com/q/25691084
has title: Jcuda parallelize for loop
answer count: 0
tagged with: jcuda
downvote count: 1
has comment: http://stackoverflow.com/comment/40192517
favorite count: 0
type: Question
has body: I am a newbie in cuda for Java. I have a simple task to do: parallelize a for loop. my for loop is pretty simple, I have an array of objects and I have to perform some "evaluation" to each object in the array: for (int i=0; i &lt; vec.length; i++){ int val = evaluate((vec[i])); } I was wondering I can I parallelize this. I only found examples of complex things in JCuda. Thanks for helping Maria
has comment: http://stackoverflow.com/comment/40154927
type: UnansweredQuestion
score: 1
duplicate of: http://stackoverflow.com/q/22866901
tagged with: java
tagged with: cuda
tagged with: parallel-processing
linked to: http://stackoverflow.com/q/22866901
upvote count: 2

http://stackoverflow.com/comment/39951241
type: Comment
type: AnswerComment
has text: What is constant storage? And can you please explain your code
comment on: http://stackoverflow.com/a/25579411
score: 0

http://stackoverflow.com/comment/39993295
score: 0
comment on: http://stackoverflow.com/q/25602485
type: Comment
type: QuestionComment
has text: @SURESH ATTA I want to check if the selected item already exists then override it

http://stackoverflow.com/q/25644064
type: Question
has body: I have created a package based on http://packaging.ubuntu.com/html/packaging-new-software.html sample. In this sample, sources are c++ files. I want to create my new package from executable jar files source. I found maven, ANT and dhBuild tools but I don't want to use this tools. So I need a way to create my package with command line. please give me some hints or samples to know most about that.
score: 6
tagged with: ubuntu
possible better answer: http://stackoverflow.com/a/25665186
has answer: http://stackoverflow.com/a/25665186
type: AnsweredQuestion
answer count: 2
has title: Create debian package from executable jar source without using any tools and scripts
upvote count: 7
tagged with: java
downvote count: 1
tagged with: executable-jar
tagged with: debian
has answer: http://stackoverflow.com/a/25697765
accepted answer: http://stackoverflow.com/a/25697765
favorite count: 0

http://stackoverflow.com/q/25579293
has answer: http://stackoverflow.com/a/25579307
has comment: http://stackoverflow.com/comment/39951129
linked to: http://stackoverflow.com/q/3321526
has body: public ArrayList makeList(String FileStr, File mainFile) { ArrayList file_reader = new ArrayList(); boolean flag = false; try { if (FileStr.contains(".txt")) { BufferedReader bufferedReader = new BufferedReader(new FileReader(mainFile)); String thisLine = null; while ((thisLine = bufferedReader.readLine()) != null) { if (thisLine != null &amp;&amp; !thisLine.isEmpty()) { flag = true; file_reader.add(thisLine); } } if (bufferedReader != null) { bufferedReader.close(); } } } catch (IOException ex) { // Logger.getLogger(BulkUpload.class.getName()).log(Level.SEVERE, null, ex); ex.printStackTrace(); } if (flag) { return file_reader; } else { return null; } } I have written this code to read lines from the file, but if there is a blank line in between 5000 records, the front end goes blank. How can I manage this blank space? I dont want to stop reading my files even though there is a blank space or line in between records
score: 0
answer count: 2
has title: How to manage blank lines in Files
has answer: http://stackoverflow.com/a/25579433
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39951300
tagged with: java

http://stackoverflow.com/a/30547494
has comment: http://stackoverflow.com/comment/97872555
downvote count: 0
answers question: http://stackoverflow.com/q/25614637
type: Answer
has body: Most errors with starting eclipse happen due to multiple JRE or JDK version which makes the installer go nuts. Solution: Go to Control Panel -> Uninstall Programs If you're running 64-bit java, then uninstall all Java without the 64bit indicator. If 32-bit, then uninstall all that have 64-bit It works like magic!
score: 3
upvote count: 3

http://stackoverflow.com/q/25601119
score: -1
favorite count: 0
has answer: http://stackoverflow.com/a/25603055
type: Question
has body: I have implemented simplecart to my project. On clicking the checkout button it went to PayPal which I didn't wanted it to. So I changed the action URL in simplecart.js file to point to my servlet action = opts.sandbox ? "cart_checkout" :"cart_checkout", method = opts.method === "GET" ? "GET" : "POST"; It calls the servlet but I get a NumberFormatException in my servlet Servlet package com.kunal.servlet; import java.io.IOException; import java.util.ArrayList; 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 CartCheckout */ @WebServlet("/CartCheckout") public class CartCheckout extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public CartCheckout() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String count=request.getParameter("ItemCount"); ArrayList&lt;String&gt; item_detail=new ArrayList&lt;String&gt;(); int cnt=Integer.parseInt(count); for(int i=1;i&lt;cnt+1;i++) { String name=request.getParameter("item_name_"); item_detail.add(name); String price=request.getParameter("item_price_"); item_detail.add(price); String qty=request.getParameter("item_quantity_"); item_detail.add(qty); } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String count=request.getParameter("ItemCount"); ArrayList&lt;String&gt; item_detail=new ArrayList&lt;String&gt;(); int cnt=Integer.parseInt(c…
upvote count: 0
has answer: http://stackoverflow.com/a/25603082
has title: NumberFormatException getting simplecart items,quantity,price and grandtotal in an array in java servlet
tagged with: servlets
type: AnsweredQuestion
tagged with: numberformatexception
tagged with: simplecart
answer count: 3
accepted answer: http://stackoverflow.com/a/25601327
tagged with: java
has answer: http://stackoverflow.com/a/25601327
possible better answer: http://stackoverflow.com/a/25603055
downvote count: 1

http://stackoverflow.com/comment/40224846
score: 0
comment on: http://stackoverflow.com/q/25674922
type: Comment
type: QuestionComment
has text: I'll give that a shot when I get time. Thanks for the response.

http://stackoverflow.com/q/25682140
type: Question
has comment: http://stackoverflow.com/comment/40137746
has comment: http://stackoverflow.com/comment/40138834
has title: Resolve absolute paths with wildcards in Java 6
type: UnansweredQuestion
tagged with: path
tagged with: wildcard
upvote count: 2
score: 2
has body: My problem is that I have a number of directories I have to look into programmatically, in Java. These directories all have the same pattern: d:\a\b\c\??_????\d\ I cannot find a way to do this smartly. Any FileFilter (I use WildcardFileFilter) will need a base directory to look into, as they only works with listFiles(), yet in my case there is not base directory as my paths are absolute. I've unsuccessfully tried a few tricks from the Web and then I'm stuck. Your help will be greatly appreciated.enter link description here
downvote count: 0
tagged with: glob
has answer: http://stackoverflow.com/a/25682347
tagged with: java
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25662711
has title: How to use the return from a static method in an "if statement" for redirection
tagged with: static-methods
upvote count: 0
answer count: 2
downvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25662744
has comment: http://stackoverflow.com/comment/40102477
has answer: http://stackoverflow.com/a/25662763
favorite count: 0
type: Question
has body: This method retrieves a result which is an I or an R. I want to redirect to different pages depending on what the result is. Problem is getApplicaitonContext() cannot be used in static methods. How do I get around this? public static void receiveResults2(String result3) { System.out.println("this had better have the users tickets"+result3); String usersXML2 = result3; if (usersXML2 == "I"){ Intent i = new Intent(getApplicationContext(), ViewIncident.class); startActivity(i); } else if (usersXML2 == "R"){ Intent i = new Intent(getApplicationContext(), ViewRequest.class) startActivity(i); } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40102448
tagged with: android
score: -3
tagged with: android-intent

http://stackoverflow.com/q/25679614
has answer: http://stackoverflow.com/a/25682417
tagged with: eclipse
has title: Cannot run ready project
score: 0
has comment: http://stackoverflow.com/comment/40135770
tagged with: java
has comment: http://stackoverflow.com/comment/40137749
has comment: http://stackoverflow.com/comment/40133827
answer count: 1
tagged with: apache-storm
type: Question
has comment: http://stackoverflow.com/comment/40137001
has comment: http://stackoverflow.com/comment/40133232
has body: I'm new in Java, I imported a ready project and when run it I got this Resource Path Location Type The project was not built since its build path is incomplete. Cannot find the class file for storm.trident.state.State. Fix the build path then try building this project first-stories-twitter-master Unknown Java Problem The type storm.trident.state.State cannot be resolved. It is indirectly referenced from required .class files RecentTweetsDB.java /first-stories-twitter-master/src/main/java/trident/state can i find help on this ?
has comment: http://stackoverflow.com/comment/40133357
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40133322
has comment: http://stackoverflow.com/comment/40133259
has comment: http://stackoverflow.com/comment/40133119

http://stackoverflow.com/q/25709598
upvote count: 1
has answer: http://stackoverflow.com/a/25709605
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25709610
linked to: http://stackoverflow.com/q/4461996
tagged with: java
score: -3
has title: What does ?: mean in Java
has comment: http://stackoverflow.com/comment/40188128
has body: In the code below: public static void main(String[] args) { String echo = (args.length == 1) ? "Your name is "+args[0]: "Wrong number of arguments!"; System.out.println(echo); } It will print your name if you give only one argument, otherwise it will warn you with wrong number of arguments, which is pretty clear, but how does ?: operator work here?
linked to: http://stackoverflow.com/q/798545
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/4461996
downvote count: 4
answer count: 3
possible better answer: http://stackoverflow.com/a/25709609
duplicate of: http://stackoverflow.com/q/798545
accepted answer: http://stackoverflow.com/a/25709605
has comment: http://stackoverflow.com/comment/40188131
has answer: http://stackoverflow.com/a/25709609
has comment: http://stackoverflow.com/comment/40188106

http://stackoverflow.com/comment/40046577
score: 0
has text: View listview = getActivity().findViewById(R.id.trigger_button); Are you sure this is a correct line? You call a ListView as a view with id trigger_button?
type: QuestionComment
comment on: http://stackoverflow.com/q/25631095
type: Comment

http://stackoverflow.com/a/25553354
score: 0
has comment: http://stackoverflow.com/comment/39903525
has body: There are no direct equivalent. Use volatile field or more high level things.
type: Answer
has comment: http://stackoverflow.com/comment/39902640
has comment: http://stackoverflow.com/comment/39901981
answers question: http://stackoverflow.com/q/25553233
has comment: http://stackoverflow.com/comment/39907651

http://stackoverflow.com/a/25569274
answers question: http://stackoverflow.com/q/25563882
has body: Solution for this problem is easy. I mentioned in comment that spring use log4j-over-slf4j which doesn't implement LogManager.exists method which my Class is using. I've just excluded from my project(gradle) log4j-over-slf4j and added dependency to log4j as below. configurations { compile.exclude module: 'log4j-over-slf4j' } compile group: 'log4j', name: 'log4j', version: '1.2.17'
accepted answer of: http://stackoverflow.com/q/25563882
type: Answer
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25587702
has comment: http://stackoverflow.com/comment/39966241
downvote count: 1
answers question: http://stackoverflow.com/q/25587675
has comment: http://stackoverflow.com/comment/39966107
has body: You just need to move your System.out.println after the loop and declare average out of the loop to prevent scope issues. However, it is more elegant to do it this way : public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Please type some words, then press enter: "); double average = 0; for (String word : sc.nextLine().split("\\s+")) average += word.length(); average /= words.length; System.out.println("Average word length = " + average); sc.close(); } } sc.nextLine() returns the entire line typed by the user (without the last "\n" character) and split("\\s+") splits this line using the regex \s+, returning an array containing the words. This regex means to split around any non-empty sequence of blank characters.
upvote count: 2
has comment: http://stackoverflow.com/comment/39966115
has comment: http://stackoverflow.com/comment/39966188
type: Answer
has comment: http://stackoverflow.com/comment/39966144
score: 1
has comment: http://stackoverflow.com/comment/39966098

http://stackoverflow.com/q/25597470
has comment: http://stackoverflow.com/comment/39984196
score: -1
has title: Better solution to two try statements?
has comment: http://stackoverflow.com/comment/39984132
has answer: http://stackoverflow.com/a/25597488
answer count: 3
has comment: http://stackoverflow.com/comment/39984189
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/25597601
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39984215
type: Question
has comment: http://stackoverflow.com/comment/39984150
has comment: http://stackoverflow.com/comment/39984115
has comment: http://stackoverflow.com/comment/39984230
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25597623
has body: I am trying to make a GUI with one button to connect and accept incoming connections. I like to code the button's action listener like this: button1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { socket = serversocket.accept(); //accepts incoming connections socket = new Socket(ip, port); //tries to connect if } //servsock.accept() times out catch (Exception e) { } } } If serversocket.accept() times out it causes an Exception so the next line is skipped. Must I put them in two different try blocks or is there a better way to do it? I cant throw Exceptions here, but if Exceptions were thrown would it allow the code to continue to the next line when an Exception shows up? I don't want to code my own exception handler, should i just use two try statements?

http://stackoverflow.com/comment/40032032
score: 2
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25623008
has text: (I'm not referring to the "flipping" problem. I'm referring to the case where different keys/values have the same hashcodes. And then there is the case where the key/value hashcodes are different, but the hash of the hashcodes is the same anyway. And the latter is really difficult to avoid. You have to analyse all of the possible combinations of keys/values to determine if a collision is possible.)

http://stackoverflow.com/a/46559746
upvote count: 7
answers question: http://stackoverflow.com/q/25657603
type: Answer
has body: JSch library is the powerful library that can be used to read file from SFTP server. Below is the tested code to read file from SFTP location line by line JSch jsch = new JSch(); Session session = null; try { session = jsch.getSession("user", "127.0.0.1", 22); session.setConfig("StrictHostKeyChecking", "no"); session.setPassword("password"); session.connect(); Channel channel = session.openChannel("sftp"); channel.connect(); ChannelSftp sftpChannel = (ChannelSftp) channel; InputStream stream = sftpChannel.get("/usr/home/testfile.txt"); try { BufferedReader br = new BufferedReader(new InputStreamReader(stream)); String line; while ((line = br.readLine()) != null) { System.out.println(line); } } catch (IOException io) { System.out.println("Exception occurred during reading file from SFTP server due to " + io.getMessage()); io.getMessage(); } catch (Exception e) { System.out.println("Exception occurred during reading file from SFTP server due to " + e.getMessage()); e.getMessage(); } sftpChannel.exit(); session.disconnect(); } catch (JSchException e) { e.printStackTrace(); } catch (SftpException e) { e.printStackTrace(); } Please refer the blog for whole program.
score: 7
downvote count: 0

http://stackoverflow.com/comment/40145094
comment on: http://stackoverflow.com/q/25686404
type: Comment
type: QuestionComment
has text: What are you sorting exactly? You have a `List` (a collection) of `Map` (another collection). How do you determine whether one `Map` is greater than another? Also, you are adding `SimpleBindings` not `Map` - if this class `extends Map` consider _not_ doing so as extending items in the Java collections framework is best avoided.
score: 1

http://stackoverflow.com/a/25604947
type: Answer
has body: Supposing you are using the Java Fx Web View to add those elements , so i would recommend to build the whole page or just add the components you need via javascript calls , cause the web view gives you the js engine to perform js methods. I am not sure if the scene builder supports customizing on the web view.
answers question: http://stackoverflow.com/q/25604756
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39998341
score: 1

http://stackoverflow.com/comment/40156168
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25691741
has text: @user2327884 Why MUST you implement the sorting algorithm?

http://stackoverflow.com/q/25652140
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/31043842
possible better answer: http://stackoverflow.com/a/29224882
tagged with: android
tagged with: java
has body: I run Intellij, and when I try to run an android app, I always have an internal error: Content is not allowed in prolog. I think that I have tried everything to fix it, but nothings works. Before, I did nothing special in AndroidManifest, so I don't know why it isn't working. Error:Internal error: (org.jdom.input.JDOMParseException) Error on line 1: Content is not allowed in prolog. org.jdom.input.JDOMParseException: Error on line 1: Content is not allowed in prolog. at org.jdom.input.SAXBuilder.build(SAXBuilder.java:533) at org.jdom.input.SAXBuilder.build(SAXBuilder.java:946) at com.intellij.openapi.util.JDOMUtil.loadDocument(JDOMUtil.java:364) at com.intellij.openapi.util.JDOMUtil.loadDocument(JDOMUtil.java:342) at org.jetbrains.jps.model.serialization.JpsLoaderBase.loadRootElement(JpsLoaderBase.java:69) at org.jetbrains.jps.model.serialization.JpsLoaderBase.loadRootElement(JpsLoaderBase.java:40) at org.jetbrains.jps.model.serialization.JpsLoaderBase.loadComponents(JpsLoaderBase.java:52) at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadFromDirectory(JpsProjectLoader.java:119) at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadProject(JpsProjectLoader.java:98) at org.jetbrains.jps.model.serialization.impl.JpsSerializationManagerImpl.loadModel(JpsSerializationManagerImpl.java:41) at org.jetbrains.jps.cmdline.JpsModelLoaderImpl.loadModel(JpsModelLoaderImpl.java:45) at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:71) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:198) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:113) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:133) at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor…
answer count: 7
has answer: http://stackoverflow.com/a/25728118
has answer: http://stackoverflow.com/a/27718780
upvote count: 18
favorite count: 0
has comment: http://stackoverflow.com/comment/40083744
type: Question
has title: Intellij Content is not allowed in prolog
has answer: http://stackoverflow.com/a/25652235
accepted answer: http://stackoverflow.com/a/25728118
has answer: http://stackoverflow.com/a/58727682
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/29224882
downvote count: 0
score: 18
has comment: http://stackoverflow.com/comment/40097430
has answer: http://stackoverflow.com/a/66772528
linked to: http://stackoverflow.com/q/18566641

http://stackoverflow.com/comment/40135775
has text: That's not valid JSON.
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/25681071
type: Comment

http://stackoverflow.com/q/25708033
linked to: http://stackoverflow.com/q/15558626
type: AnsweredQuestion
tagged with: phantomjs
has title: How to use phantomjs.binary.path when PhantomJS is embedded inside a jar file?
score: 3
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/16794711
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25708149
answer count: 2
has answer: http://stackoverflow.com/a/25708149
accepted answer: http://stackoverflow.com/a/25708983
has answer: http://stackoverflow.com/a/25708983
downvote count: 0
tagged with: jar
has body: I am using phantomjs for headless browser testing. I call phantomjs from within my java file (MainTest.java). The code runs fine in my local machine. I bundle both the phantomjs.exe and the calling java file inside a jar file (tetsPhantom.jar). testPhantom.jar phantomjs.exe MainTest.java On the server, it is failing when it tries to find the phantomjs executable path: String webDir = LiExportEmails.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm(); // Returns http://myservername.com:8080/testPhatom.jar System.setProperty("phantomjs.binary.path", webDir); I have tried setting it to http://myservername.com:8080/testPhatom.jar!phantomjs.exe as well, but it still fails. What should be the correct path of phantomjs located inside the same jar file as the caller?

http://stackoverflow.com/comment/40109783
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25666851
type: QuestionComment
has text: A lot of information is needed what java version, eclipse version and bit for both. Even the error why eclipse won't open.

http://stackoverflow.com/a/29966926
answers question: http://stackoverflow.com/q/25657299
has comment: http://stackoverflow.com/comment/48054447
score: 0
has comment: http://stackoverflow.com/comment/48104353
type: Answer
has body: First of all Determine what type of card you have i.e. Is07816 etc then try to get that data and then decode the data.

http://stackoverflow.com/q/25632881
type: Question
tagged with: interstitial
has title: What am I doing wrong, how do I add an interstitial ad
tagged with: libgdx
score: 1
has comment: http://stackoverflow.com/comment/40049418
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25633431
has body: I've been trying to figure out how to add ads to my project for days. I'm hoping that you guys can show me what to do. I am trying to ad the ad after the first round (First time the player dies) After they close the ad; it will allow them to play again. No ads are appearing and I am getting errors such as: 09-02 17:14:53.825: W/dalvikvm(635): threadid=11: thread exiting with uncaught exception (group=0x40a13300) 09-02 17:14:53.835: E/AndroidRuntime(635): FATAL EXCEPTION: GLThread 75 09-02 17:14:53.835: E/AndroidRuntime(635): java.lang.NullPointerException 09-02 17:14:53.835: E/AndroidRuntime(635): at com.JrodManU.LaserJumper.android.Ad.loadAd(Ad.java:45) 09-02 17:14:53.835: E/AndroidRuntime(635): at com.JrodManU.LaserJumper.android.AndroidLauncher.loadAd(AndroidLauncher.java:26) 09-02 17:14:53.835: E/AndroidRuntime(635): at com.JrodManU.LaserJumper.LaserJumper.loadAd(LaserJumper.java:36) 09-02 17:14:53.835: E/AndroidRuntime(635): at com.JrodManU.LaserJumper.screens.InGameScreen. &lt;init&gt;(InGameScreen.java:51) 09-02 17:14:53.835: E/AndroidRuntime(635): at com.JrodManU.LaserJumper.LaserJumper.create(LaserJumper.java:15) 09-02 17:14:53.835: E/AndroidRuntime(635): at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:236) 09-02 17:14:53.835: E/AndroidRuntime(635): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1505) 09-02 17:14:53.835: E/AndroidRuntime(635): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240) My classes: AndroidLauncher package com.JrodManU.LaserJumper.android; import android.os.Bundle; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.JrodManU.LaserJumper.GameEventListener; import com.JrodManU.LaserJumper.LaserJumper; public class AndroidLauncher extends AndroidApplication implements GameEventListener { Ad ad = new Ad(); @Override protected void onCreate (Bundle savedInstanceS…
has comment: http://stackoverflow.com/comment/40049417
tagged with: admob
has answer: http://stackoverflow.com/a/25633431
type: AnsweredQuestion
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/40058436
type: Comment
has text: Have you looked at the LinkedHashSet class? It's a Set that keeps the order in which you inserted the entries, like a List, but automatically removes duplicates, like a Set.
comment on: http://stackoverflow.com/q/25638189
score: 3
type: QuestionComment

http://stackoverflow.com/q/25554723
has title: How to set the value of context in the object tag of a jsp with struts 1
tagged with: java
answer count: 1
tagged with: struts-1
type: Question
tagged with: jsp
has body: I need to know how to establish, in full context object tag of a jsp, because I'm getting fixed data, the jsp code is as follows: But instead of appearing "http: //localhost:8080/" i need appears according to where the application is run, the link is within the same system that is running. i am using Struts 1 thanks
has answer: http://stackoverflow.com/a/25555118
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25555118

http://stackoverflow.com/comment/40164795
score: 1
type: Comment
type: QuestionComment
has text: Do you mean you want to invert each digit individually? So 237 for example would become 873? Or do you mean something different? Please clarify.
comment on: http://stackoverflow.com/q/25696483

http://stackoverflow.com/comment/40044540
type: QuestionComment
has text: Take a look at the Collections in [`java.util.concurrent`](http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/package-summary.html)
score: 0
comment on: http://stackoverflow.com/q/25630223
type: Comment

http://stackoverflow.com/comment/40115063
type: Comment
has text: It's hard to picture what you're doing and why it's going wrong. Do understand that a SurfaceView is different from other Views -- it has a View part and a Surface part. The View part is a transparent placeholder for layout purposes, and should be ignored. The Surface is a completely separate layer that is drawn behind all UI elements (unless you change the Z-order with the SurfaceHolder API). Check your layout and make sure you're not clearing the View portion to an opaque color.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25658457

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/25702653
tags question: http://stackoverflow.com/q/25662237
tags question: http://stackoverflow.com/q/25681071
tags question: http://stackoverflow.com/q/25603306
tags question: http://stackoverflow.com/q/25567085
tags question: http://stackoverflow.com/q/25705336
tags question: http://stackoverflow.com/q/25672414
tags question: http://stackoverflow.com/q/25562575
tags question: http://stackoverflow.com/q/25682302
tags question: http://stackoverflow.com/q/25610966
tags question: http://stackoverflow.com/q/25632412
tags question: http://stackoverflow.com/q/25605727
tags question: http://stackoverflow.com/q/25635949
tags question: http://stackoverflow.com/q/25681050
tags question: http://stackoverflow.com/q/25575166
tags question: http://stackoverflow.com/q/25598729
tags question: http://stackoverflow.com/q/25667381
type: Tag
tags question: http://stackoverflow.com/q/25581726
tag name: html
tags question: http://stackoverflow.com/q/25646122
tags question: http://stackoverflow.com/q/25604470
tags question: http://stackoverflow.com/q/25711035
tags question: http://stackoverflow.com/q/25621627
tags question: http://stackoverflow.com/q/25698147
tags question: http://stackoverflow.com/q/25702779
tags question: http://stackoverflow.com/q/25648446
tags question: http://stackoverflow.com/q/25698843
tags question: http://stackoverflow.com/q/25702424
tags question: http://stackoverflow.com/q/25689731

http://stackoverflow.com/comment/39972263
has text: Your example fails to show any advantage of this `JSONObject` over a plain `HashMap<String,Object>`. Further, you are performing unnecessary manual wrapping of values. There is no need to say `new Integer`, `new Double`, nor `new Boolean`. If you insist of doing it manually, you should learn about the `static` `valueOf` methods…
comment on: http://stackoverflow.com/a/25580538
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40016786
has text: Works fine for me. Make sure the eclipse knows it should be running this class and not some other class with a `main` method
comment on: http://stackoverflow.com/q/25615366
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25627275
accepted answer: http://stackoverflow.com/a/26357694
has title: Why does CF UAA check_token endpoint need a clientId/clientSecret?
upvote count: 3
has answer: http://stackoverflow.com/a/26357694
tagged with: oauth-2.0
answer count: 1
downvote count: 0
tagged with: spring
tagged with: cloudfoundry-uaa
favorite count: 0
type: Question
score: 3
has body: CloudFoundry's UAA has a RemoteTokenServices class (part of Spring oauth2 too) that does the authorization token validation by going to the UAA server's check_token endpoint. UAA has sample api and app applications that serve as a resource server and a client application respectively. From the sample api's spring-servlet.xml: &lt;bean id="tokenServices" class="org.cloudfoundry.identity.uaa.oauth.RemoteTokenServices"&gt; &lt;property name="checkTokenEndpointUrl" value="${checkTokenEndpointUrl}" /&gt; &lt;property name="clientId" value="app" /&gt; &lt;property name="clientSecret" value="appclientsecret" /&gt; &lt;/bean&gt; Do you know why this class (and the check_token endpoint that needs these values encoded in an Authorization header) needs a clientId and a clientSecret? It seems to me that it puts dependency on the client application from the resource server. How can I use multiple client applications if one of the client secrets is "hardcoded" here?
tagged with: java
type: AnsweredQuestion

http://stackoverflow.com/comment/40174578
comment on: http://stackoverflow.com/q/25702166
type: QuestionComment
has text: @MarkoTopolnik : Really sorry for confusion. I was calling hashcode Method in sysout hence confused. Apologies for confusion
score: 0
type: Comment

http://stackoverflow.com/comment/40190201
comment on: http://stackoverflow.com/a/25709790
type: Comment
score: 0
type: AnswerComment
has text: @TJCrowder 'Which' definition of modulo? Are there multiple definitions of the modulo operator out there?

http://stackoverflow.com/a/25611997
score: 2
has body: Using a key as a parent that doesn't have a corresponding saved entity is perfectly fine. You don't even need to create a python class, just use the name as a string: parent=ndb.Key('ReportRoot', some_id) Your example, though, seems confused. What do you think you're gaining over just using the Customer's key as the Reports' parents?
answers question: http://stackoverflow.com/q/25611832
has comment: http://stackoverflow.com/comment/40010703
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25611832
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/q/25572179
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25572364
has body: I have many jar files in WEB-INF/lib folder of my web application, Now my requirement is, I I I have to package few of these jar files as new.war file. Now I have to refer these isolated jar files of new.war in my first web application. Note : We are using weblogic server to deploy these .war files Please let me know the steps to follow to refer the jar files of a .war from other web application.
type: Question
has title: How to refer a jar file of a particular .war in other .war file
tagged with: weblogic
type: UnansweredQuestion

http://stackoverflow.com/a/25682848
has body: It is likely the render happens before the action finishes. Use the @oncomplete to call another jsFunction that does the rendering. I.e. &lt;a4j:jsFunction name="fetch" oncomplete="reload()" /&gt; &lt;a4j:jsFunction name="reload" render="…" /&gt; On the other hand: The fetchmenu function is defined twice and I don't see it being called anywhere. You shouldn't have any business logic inside the getter, why not call the build() inside the fetchMenu() method? I'm not sure what you're trying to do with "@region @form .HOOFDMENU", the menu is inside the form that is inside the region. The dot in front of "HOOFDMENU" probably shouldn't be there either.
score: 1
has comment: http://stackoverflow.com/comment/40139806
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25680733
accepted answer of: http://stackoverflow.com/q/25680733
type: Answer
has comment: http://stackoverflow.com/comment/40139235

http://stackoverflow.com/comment/39949369
comment on: http://stackoverflow.com/q/25578210
has text: It might be useful to state what this program should achieve. It is not clear at all, as the assignment of the new list in the 'cmd' thread is odd.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/25642691
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3166501
score: 1
accepted answer: http://stackoverflow.com/a/25643365
tagged with: android
tagged with: java
possible better answer: http://stackoverflow.com/a/25642954
has answer: http://stackoverflow.com/a/25643365
has answer: http://stackoverflow.com/a/25642954
type: Question
has title: Using different fonts for different screen densities
answer count: 2
linked to: http://stackoverflow.com/q/16706076
has body: I'm developing an Android app on my Nexus 5 device (~445 ppi) and I'm using Roboto Light as the font for a few sections in the application. When displayed in my device, the Roboto Light text looks clean and crisp, however when testing the app on device with screens that have a lower pixel density, Roboto Light looks pretty bad (bolder fonts look OK). What is the best and quickest way to tell my app to use Roboto Light on high-density screens and another font on low-density ones? My first idea was to create different values directories (values-mdpi, values-hdpi, values-xhdpi...), place a strings.xml in each one with the same key and assign it the font's filename I wish to use for each density, and then load the font using that string... however that looks a bit complicated and I was wondering if there is an easier way.
downvote count: 0
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/40175748
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25657877
score: 0
has text: I'm not quite sure where to find it, what section did you get the code under?

http://stackoverflow.com/a/36908727
score: 0
answers question: http://stackoverflow.com/q/25697492
type: Answer
has body: You can solve with @InitBinder in your controller like : @InitBinder protected void initBinder(WebDataBinder binder) throws Exception{ binder.registerCustomEditor(Set.class,"categoryList", new CustomCollectionEditor(Set.class){ protected Object convertElement(Object element){ if (element instanceof String) { Category category = categoryCache.get(Integer.parseInt(element.toString())); return role; } return null; } }); }

http://stackoverflow.com/comment/40190036
type: QuestionComment
comment on: http://stackoverflow.com/q/25710365
has text: It's one of the appropriate locations, but you won't be able to read a resource from inside the war's WEB-INF directory using `new FileInputStream("db.properties");`. This looks for the file in the current directory of the JVM, i.e. the directory from which the `java` command starting tomcat was executed. If you want to read it from WEB-INF, use http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContext.html#getResourceAsStream%28java.lang.String%29.
score: 1
type: Comment

http://stackoverflow.com/a/25564423
has body: Try with regEx : String yuStr = "-7.000, 10.000, 0.000, -212.000"; System.out.println(yuStr.replaceAll("-|(\\d+)\\.\\d+", "$1")); Output : 7, 10, 0, 212
score: 0
answers question: http://stackoverflow.com/q/25564252
type: Answer

http://stackoverflow.com/q/25599423
favorite count: 0
has answer: http://stackoverflow.com/a/25599495
type: Question
score: 9
upvote count: 9
has title: Unable to construct javafx.application.Application instance
has comment: http://stackoverflow.com/comment/39987564
has body: I'm trying a JavaFX tutorial from the Oracle site [fxml tutorial] (http://docs.oracle.com/javase/8/javafx/get-started-tutorial/fxml_tutorial.htm). package fxml; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; class Main extends Application { public Main() {} @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("welcome.fxml")); Scene scene = new Scene(root); stage.setTitle("FXML UI"); stage.setScene(scene); stage.show(); } public static void main(String args[]) { launch(args); } } And this is the exception that I'm continuously getting. The application doesn't show up on the screen. I did the non-args Main() constructor from another stack overflow answer but it didn't fix it. Exception in Application constructor Exception in thread "main" java.lang.RuntimeException: Unable to construct Application instance: class fxml.Main at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:884) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56) at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalAccessException: Class com.sun.javafx.application.LauncherImpl$7 can not access a member of class fxml.Main with modifiers "public" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:101) at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:295) at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:287) at java.lang.reflect.Constructor.newInstance(Constructor.java:398) at com.sun.javafx.application.LauncherImpl$7.run(LauncherImpl.java:791) at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335) at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301) at com.sun.javafx.application.PlatformImpl$6$1.run(P…
type: AnsweredQuestion
tagged with: java
tagged with: javafx
downvote count: 0
accepted answer: http://stackoverflow.com/a/25599495
answer count: 1

http://stackoverflow.com/a/25608968
answers question: http://stackoverflow.com/q/25608614
type: Answer
upvote count: 2
has body: You need to flush() and close() the FileWriter (closing it will also flush it). Try this : do { System.out.println("Enter 'q' for quit!!"); str=br.readLine(); FileWriter fw=new FileWriter(file,true); bw=new BufferedWriter(fw); bw.write(str); bw.flush(); //do this , you missed it System.out.println(str); } while(!(str.equalsIgnoreCase("q"))); bw.close(); //do this , you missed it
accepted answer of: http://stackoverflow.com/q/25608614
score: 1
type: AcceptedAnswer
downvote count: 1

http://stackoverflow.com/q/25675276
has title: Sum of Non Unique elements to N
has comment: http://stackoverflow.com/comment/40126732
type: Question
linked to: http://stackoverflow.com/q/11929938
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/11929938
has comment: http://stackoverflow.com/comment/40153724
score: 0
has comment: http://stackoverflow.com/comment/40125500
answer count: 0
has body: I was asked a question in an interview.Let's say we have an array on integers {1,2,3}, find the numbers that sum to 10? Numbers could be repeated: For example sample response would give {2,2,2,2,2} or {7,3} or {3,3,2,2}; Any algorithm would help.No code required. Thanks,
tagged with: java

http://stackoverflow.com/q/25584744
has answer: http://stackoverflow.com/a/25584934
downvote count: 0
has answer: http://stackoverflow.com/a/25584981
score: 1
upvote count: 1
has title: Possible to perform a NOT IN for one-to-many relationship with Hibernate criteria?
tagged with: collections
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25584981
tagged with: criteria
tagged with: list
has body: I have a question about Hibernate and if it's possible to achieve the query using the Criteria API with the current data model structure I'm using. I have a data model with the following structure: ParentClass contains a List: @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, targetEntity = org.test.ChildClass.class) @JoinColumn(name = "child_uuid") private List&lt;ChildClass&gt; childList = new ArrayList&lt;ChildClass&gt;(); The child class has one field: private String testField The query I'm attempting to write can be expressed as follows: Return a list of all ParentClass objects that have the ABSENCE OF an object ChildClass that has a "testField" value of "1". In other words, there must not be an object in that list that has the testField value of 1. Currently I have this query: Criteria criteria = getSession().createCriteria(org.test.ParentClass); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); criteria.createAlias("childList", "c"); SimpleExpression expression = Restrictions.ne("c.testField", "1"); criteria.add(expression); return (List&lt;T&gt;) criteria.list(); What happens is that I will get any ParentClass objects that contain at least one ChildClass that has a value of c.testField other than "1". This includes ParentClass objects that DO have a "testField" value of "1", which I'm trying to exclude entirely. The table structure has ChildClass having a reference to ParentClass, but not vice versa. So it seems that each ChildClass object is joined with the ParentClass, and if they fulfill the above restriction, that ParentClass gets returned. This is the incorrect result as it means a ParentClass that has two ChildClass objects, one with value "1" and the other with value "2" will get returned. Thanks for any help
answer count: 2
possible better answer: http://stackoverflow.com/a/25584934
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

weblogic
tags question: http://stackoverflow.com/q/25693819
tags question: http://stackoverflow.com/q/25573927
tags question: http://stackoverflow.com/q/25553202
tags question: http://stackoverflow.com/q/25668685
tags question: http://stackoverflow.com/q/25563253
tags question: http://stackoverflow.com/q/25649842
tags question: http://stackoverflow.com/q/25607518
tags question: http://stackoverflow.com/q/25572179
tag name: weblogic
tags question: http://stackoverflow.com/q/25581363
tags question: http://stackoverflow.com/q/25575591
tags question: http://stackoverflow.com/q/25637241
tags question: http://stackoverflow.com/q/25657341
type: Tag
tags question: http://stackoverflow.com/q/25612463
tags question: http://stackoverflow.com/q/25551713
tags question: http://stackoverflow.com/q/25604532
tags question: http://stackoverflow.com/q/25688604

http://stackoverflow.com/comment/39997837
has text: @JoopEggen I am using jDeveloper 10g IDE for developing the app, where we could intercept the data. The error is just shown as "IllegalStateException - IOException: Premature end of POST data" There is not even stack trace.
comment on: http://stackoverflow.com/q/25604906
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39977214
type: AnswerComment
score: 0
type: Comment
has text: You're probably right. Calling deductFees() often won't hurt, since it doesn't change the balance if there haven't been more transactions. However, I now see that addInterest always adds the same amount of interest, regardless of the "time" that has passed since it was last called. I'll get rid of that part.
comment on: http://stackoverflow.com/a/25592985

http://stackoverflow.com/q/25696403
has answer: http://stackoverflow.com/a/25696577
tagged with: database-locking
score: 0
tagged with: java
has body: (The other questions on the side bar with similar titles do not address this issue.) I have a collection that I use like a historical sequence generator: {seq_id:1,dt:ISODate(...),type:'service_a',stage:1} {seq_id:2,dt:ISODate(...),type:'service_a',stage:2} {seq_id:3,dt:ISODate(...),type:'service_a',stage:3} {seq_id:1,dt:ISODate(...),type:'service_b',stage:1} {seq_id:2,dt:ISODate(...),type:'service_b',stage:2} {seq_id:3,dt:ISODate(...),type:'service_b',stage:3} I want to be able to: Lock the Collection from all other clients (write OR read) Read the most recent seq_id into memory Generate 3 more sequence ids in memory (Java, in my case) Insert 3 documents into the collection Unlock the collection I want to be able to lock all other clients from even reading the collection while my client has it locked, as another client that reaches step 2 and 3 before my client reaches step 4 would result in conflicting seq_ids.
answer count: 1
duplicate of: http://stackoverflow.com/q/8384029
type: Question
has title: How to Lock a MongoDB Collection from all other Clients (write OR read)?
tagged with: mongodb
linked to: http://stackoverflow.com/q/8384029
type: UnansweredQuestion

http://stackoverflow.com/comment/39934111
has text: Want exact answers? Use [`BigDecimal`](http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html). Want better answers, but not at the cost of performance? Use `double`.
comment on: http://stackoverflow.com/q/25570425
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39972113
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25590869
has text: @VasanthNagKV: No idea what the problem is, then; I copied and pasted your HTML into a file, loaded that file with JSoup, ran the above, and got `true` for `isEmpty`. You'll have to step through with a debugger and figure out what it is. I'm 99.9% certain it has nothing to do with the `&nbsp;` thing. It's not difficult to find out, just inspect the string you get back from `tr.text()`.

http://stackoverflow.com/q/25632410
tagged with: asp.net-web-api
tagged with: soa
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25632861
accepted answer: http://stackoverflow.com/a/25632861
tagged with: java
has body: In a project I have different processors for each request message that each of these processors can be enabled or disabled based on the configuration. I have two options, one is to use the jar library of each of these processors in my applications and use its classes and the other option is to make each of the processors like a standalone web api that get and return json objects and in this way the communication between these processors would be based on web api instead of using jar libraries. Which of these options do you think is better and what I need to consider when making such a decision. Thank you
has title: When to use web api instead of dependency injection in a Service Oriented Architecture
answer count: 1
type: Question
tagged with: dependency-injection
tagged with: api

http://stackoverflow.com/comment/39905722
comment on: http://stackoverflow.com/a/25554735
has text: Writing my controller method like you have it results in `415 (Unsupported Media Type)` errors. Another SO answer (http://stackoverflow.com/questions/11492325/post-json-fails-with-415-unsupported-media-type-spring-3-mvc) suggests altering the request headers, but this did not help either.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40191036
type: QuestionComment
has text: The error is related to the date displayed in the application messages. On the right of the first image tells me that the message has arrived at 10:04 (wrong), but if I click on that message within me that is arrived at 8:02 (corrected).
score: 0
comment on: http://stackoverflow.com/q/25711119
type: Comment

http://stackoverflow.com/q/25712650
answer count: 3
has answer: http://stackoverflow.com/a/25712691
tagged with: java
has comment: http://stackoverflow.com/comment/100253895
has body: Is there any difference between the two following statements in Java? public static final String STOP= "STOP"; public final static String STOP= "STOP";
linked to: http://stackoverflow.com/q/11219556
has title: The difference between final static and static final
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25712662
downvote count: 8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40193987
score: -2
has comment: http://stackoverflow.com/comment/40563568
upvote count: 6
has answer: http://stackoverflow.com/a/25712700

http://stackoverflow.com/comment/39994293
type: Comment
score: 0
type: AnswerComment
has text: int R is the size of the row int C is the size of the column, R and C is to be input by the user that will be the size of his desired matrix
comment on: http://stackoverflow.com/a/25602784

http://stackoverflow.com/q/25639759
type: AnsweredQuestion
score: 0
has body: My EditTextPreference is this: &lt;EditTextPreference android:title="Name" android:summary="namepreferences" android:inputType="text" android:dialogTitle="name" /&gt; in my PreferencesActivity: namePref = (EditTextPreference)getPreferenceManager().findPreference("namepreferences"); well so far no problem.. now, i have a service with a notification. My goal is pass the namePref value in the Title of the notification.. I wrote this in the service: SharedPreferences sp = PreferenceManager.getDefaultPreferences(this); String name; @Override public void onCreate() { name = sp.getText("namepreferences", "NA"); } and i insert name in the title of notification but the app crashes sayng that name is null.. I can't solve..
accepted answer: http://stackoverflow.com/a/25639776
tagged with: android
tagged with: java
tagged with: sharedpreferences
has answer: http://stackoverflow.com/a/25639776
type: Question
tagged with: edittextpreference
has title: text from EdittextPreference
answer count: 1
tagged with: android-preferences

http://stackoverflow.com/q/25625250
has body: In the last few days I made some test with external iteration, streams and parallelStreams in Java 8 and measured the duration of the execution time. I also read about the warm up time which I have to consider. But one question still remains. The first time when I call the method stream() or parallelStream() on a collection the execution time is higher than it is for an external iteration. I already know, that when I call the stream() or parallelStream() more often on the same collection and avarage the execution time, then the parallelStream() is indeed faster than the external iteration. But since in practice a collection is also often only iterate once, I only see an disadvantage in using streams or parallelstreams. So my question is: If I only iterate an collection once, is it a good idea to use stream or parallelStream() or will the execution time always be higher than for external iteration?
tagged with: java-stream
has comment: http://stackoverflow.com/comment/40080039
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25636196
answer count: 1
has title: Java 8: First use of stream() or parallelStream() very slow - Usage in practice meaningful?
favorite count: 0
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40038325
tagged with: java-8
linked to: http://stackoverflow.com/q/25439277
score: 6
upvote count: 6

http://stackoverflow.com/comment/40149973
has text: Thanks, I've tried your approach. But unfortunatly I get the following error: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25688575

http://stackoverflow.com/comment/40100139
has text: Can you assume that it's even possible? What happens with 'AAAAA' ?
type: QuestionComment
comment on: http://stackoverflow.com/q/25660816
type: Comment
score: 1

http://stackoverflow.com/q/25585911
has title: How to Declare this string in java ( IF else statement )
has body: // rad30Deck: if (rad30Deck.isSelected()){ String decksize = "30mm Wide"; } // rad32Deck: if (rad32Deck.isSelected()){ String decksize = "32mm Wide"; } else{ String decksize = "33.3mm Wide"; } // rad30Trucks: if (rad30Trucks.isSelected()){ String decksize = "30mm Wide"; } else{ String trucksize = "32mm Wide"; } It tells me that decksize is alright, but then when I want to add it to my output it says that this variable isn't in existence.. Can anybody please help?
has comment: http://stackoverflow.com/comment/39962807
has comment: http://stackoverflow.com/comment/39962840
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25585983
upvote count: 0
answer count: 2
downvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25585928
tagged with: java
has answer: http://stackoverflow.com/a/25585983
has answer: http://stackoverflow.com/a/25585928
score: -1

http://stackoverflow.com/q/25596357
type: Question
has title: Exception in thread "main" dropbox application with java
tagged with: dropbox
upvote count: 0
type: UnansweredQuestion
has body: I'm trying to make a simple application with Java, using Eclipse that could upload a file from my computer to Dropbox but whenever I compile, I get this error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpGet at com.dropbox.client2.RESTUtility.streamRequest(RESTUtility.java:164) at com.dropbox.client2.session.WebAuthSession.setUpToken(WebAuthSession.java:218) at com.dropbox.client2.session.WebAuthSession.getAuthInfo(WebAuthSession.java:158) at com.dropbox.client2.session.WebAuthSession.getAuthInfo(WebAuthSession.java:128) at DropboxAuthTest.main(DropboxAuthTest.java:47) Can you help me figure this out? Thank you in advance.
tagged with: jar
score: -1
has answer: http://stackoverflow.com/a/25596365
tagged with: java
answer count: 1
tagged with: eclipse
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/40017749
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25615795
has text: Yep, fixed it. I hope 'we' helped.

http://stackoverflow.com/q/25619803
tagged with: jdbc
has body: I'm learning on how to use SQLData and having an issue with casting back to my object. My Oracle Types looks something like this: CREATE OR REPLACE TYPE activities_t AS OBJECT ( list activity_list_t; ); CREATE OR REPLACE TYPE activity_list_t AS TABLE OF activity_t; CREATE OR REPLACE TYPE activity_t AS OBJECT ( startDate DATE; endDate DATE; ); And my Java looks like this: public class Activities implements SQLData { private String sqlType = "ACTIVITIES_T"; List&lt;Activity&gt; list; // must have default ctor! public Activities() { } public String getSQLTypeName() throws SQLException { return sqlType; } public List getList() { return list; } public void setList(List list) { this.list = list; } public void readSQL(SQLInput stream, String typeName) throws SQLException { Array a = stream.readArray(); // :( } public void writeSQL(SQLOutput stream) throws SQLException { // stream.writeArray(this.list); } } I've tried a few things in readSQL but I am not having much success - what am I missing? I am calling a PLSQL stored procedure which has an OUT parameter of "activities_t" using JDBC: Map map = connection.getTypeMap(); map.put("ACTIVITIES_T", Class.forName("Activities")); connection.setTypeMap(map); callableStatement = connection.prepareCall("{call GET_ACTIVITIES(?)}"); callableStatement.execute(); Thanks! Steve (most of the above is from memory as the code is at work...)
possible better answer: http://stackoverflow.com/a/45867910
favorite count: 0
type: Question
answer count: 2
tagged with: mapping
accepted answer: http://stackoverflow.com/a/25653455
tagged with: types
has answer: http://stackoverflow.com/a/25653455
downvote count: 0
has title: Java SQLData - Cast to user object with a list/array?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/45867910
linked to: http://stackoverflow.com/q/11439543
score: 3
tagged with: oracle-database
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/52357950
type: Comment
comment on: http://stackoverflow.com/a/25668292
score: 0
type: AnswerComment
has text: @JBaruch, I am also getting a similar error but I do have maven and maven-publish plugin applied.

http://stackoverflow.com/comment/40143966
type: Comment
has text: It seems to not have blank lines... But its still not the full webpage.
comment on: http://stackoverflow.com/a/25675108
type: AnswerComment
score: 1

http://stackoverflow.com/q/25647294
type: Question
has title: How do you add the build of one Maven project to another?
type: UnansweredQuestion
tagged with: maven
upvote count: 1
has answer: http://stackoverflow.com/a/25647511
score: 1
tagged with: java
downvote count: 0
answer count: 1
tagged with: maven-assembly-plugin
has comment: http://stackoverflow.com/comment/40074811
has body: I have two Maven projects we'll call Inside and Outside. They are built with maven-assembly-plugin. I want to include Inside in Outside, so we'll have one big project and all the jars and wars of Inside will be in Outside when it is built. I have added Inside as a dependency of Outside in Outside's pom.xml. In both cases, maven-assembly-plugin refers to a file called assembly.xml. I have added the contents of Inside's assembly.xml to Outside's assembly.xml. This has not worked. I suppose the problem is that the actual files of Inside are not in Outside, so making references to them has no effect. I do not know how to refer to files that are inside a maven dependency. So how can I add Inside to Outside?
favorite count: 0

http://stackoverflow.com/comment/40170030
score: 0
has text: Great answer, thanks, I'm gonna dig myself into this. Although would you just maintain one writer thread, or make a new one at every iteration with a quick purpose? Because if the writer thread wouldn't finish before the next iteration's data flow comes then its data writing tasks may queue up and further complications will occur. On the other hand if you create a new thread at each iteration they themselves can work in parallel.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25699310

http://stackoverflow.com/q/25675624
possible better answer: http://stackoverflow.com/a/25675687
has comment: http://stackoverflow.com/comment/40126108
type: AnsweredQuestion
answer count: 2
score: 1
upvote count: 1
tagged with: java
downvote count: 0
has body: I was looking Java Class String Builder and was wondering why is it adding extra 16 empty elements trailing the string for following constructors StringBuilder(CharSequence cs): Constructs a string builder containing the same characters as the specified CharSequence, plus an extra 16 empty elements trailing theCharSequence. String Builder(String s): Creates a string builder whose value is initialized by the specified string, plus an extra 16 empty elements trailing the string. Why is the extra 16 empty elements are needed when StringBuilder can change its capacity whenever is needed? Thanks in advance! :)
favorite count: 0
type: Question
tagged with: stringbuilder
has answer: http://stackoverflow.com/a/25675664
accepted answer: http://stackoverflow.com/a/25675664
has title: Java StringBuilder Class, Why Extra 16 Empty Elements?
has answer: http://stackoverflow.com/a/25675687

http://stackoverflow.com/comment/40189564
has text: line 57 is `try(Connection con = dd.getConnection()){`
type: QuestionComment
comment on: http://stackoverflow.com/q/25710365
type: Comment
score: 0

http://stackoverflow.com/q/25569565
tagged with: oracle-database
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25569874
has body: I have a pretty simple Hibernate project which connects to an Oracle database. If for some reason it is unable to connect to Oracle (like if the network is down), it will take over a minute to fail. This occurs while building the data source and seems to occur when trying to interact with the database as well. I would like to change the settings for it to fail in a few seconds. After changing what I believe are the relevant settings, nothing seems to change. It's like my configuration is being ignored. Relevant portions of the Spring file doing my dependency injection, appContext.xml: classpath:oracle.hibernate.cfg.xml And my hibernate configuration file: oracle.hibernate.cfg.xml: <?xml version="1.0"?> <hibernate-configuration> org.hibernate.dialect.Oracle10gDialect 1 5000 0 true <mapping class="****"/> </hibernate-configuration> I have heard this can be caused by not having hibernate-c3p0-version.jar in the classpath, so here are the classpath settings for my test... ...and here is where hibernate-c3p0-4.2.11.Final.jar is specified in my Maven pom.xml: org.hibernate hibernate-c3p0 4.2.11.Final
tagged with: spring
type: AnsweredQuestion
upvote count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/25569874
answer count: 1
tagged with: maven
favorite count: 0
type: Question
score: 3
has title: How do I decrease the timeouts to create a c3p0 ComboPooledDataSource and get an Oracle db connection?

http://stackoverflow.com/a/25574337
downvote count: 0
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/25574303
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39946519
has body: Provide it an instance of your main class mGUIManager = new GUIManager(MainAR.this); public GUIManager(MainAR mainClass){ this.mainClass = mainClass; }
answers question: http://stackoverflow.com/q/25574303
has comment: http://stackoverflow.com/comment/40041350
type: Answer

http://stackoverflow.com/a/25710998
downvote count: 0
type: AcceptedAnswer
score: 6
accepted answer of: http://stackoverflow.com/q/25710945
answers question: http://stackoverflow.com/q/25710945
upvote count: 6
type: Answer
has body: Since this problem is formulated as a learning exercise, I would not provide a complete solution, but rather a couple of hints: Could you print the sequence if you knew the last number from the prior line? - the answer is trivial: you would need to print priorLine + j Given i, how would you find the value of the last number printed on i-1 lines? - to find the answer, look up the formula for computing the sum of arithmetic sequence. In your case d=1 and a1=1.

http://stackoverflow.com/a/25646840
downvote count: 0
has body: Your year variable is initialized in a try block. It's obvious to us that it won't get out the loop until something OK is input. But the compiler's rules are simpler than that : as the initialisation can be disrupted by an exception, it considers that year may be uninitialized.
upvote count: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25646698
answers question: http://stackoverflow.com/q/25646698
score: 7
type: Answer
has comment: http://stackoverflow.com/comment/40085440
has comment: http://stackoverflow.com/comment/40097249

http://stackoverflow.com/comment/39981128
type: AnswerComment
has text: @MichaelAaronSafyan Sounds like an *opportunity* for user training, documentation and/or UI work to me! OP's post included two options - yes/no (seems like a good place for an `else` to me).
comment on: http://stackoverflow.com/a/25595866
score: 1
type: Comment

http://stackoverflow.com/a/27108351
answers question: http://stackoverflow.com/q/25648386
has comment: http://stackoverflow.com/comment/42763192
downvote count: 0
has body: Do you put in below GL commands at the beginning of render method? Gdx.gl.glClearColor(0.3f, 0.3f, 0.3f, 1.f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
upvote count: 1
score: 1
type: Answer

http://stackoverflow.com/a/25648549
type: Answer
has comment: http://stackoverflow.com/comment/40081392
score: 2
answers question: http://stackoverflow.com/q/25646284
has comment: http://stackoverflow.com/comment/40082034
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40087219
downvote count: 0
has body: The main problem here is that you're asking for text nodes that are children of &lt;search&gt;, but in fact the &lt;p ..&gt; that you want is not a text node: it's an element. (In fact, the &lt;search&gt; element has no text node children, as you can tell when you view the response from that URL using "View Source".) So what you want to do is change your XPath expression to //query/search/p which will give you the p element node. Then ask for the value of this node's two attributes title and snippet in your Java code: Element e = (Element)(nodes.item(i)); String title = e.getAttribute("title"); String snippet = e.getAttribute("snippet"); Or, you could do two XPath queries, one for each attribute: //query/search/p/@title and //query/search/p/@snippet assuming there will only be one &lt;p&gt; element. If you were doing this over multiple &lt;p&gt; elements, you'd probably want to keep each pair of attributes together instead of having two separate lists of results.
accepted answer of: http://stackoverflow.com/q/25646284
has comment: http://stackoverflow.com/comment/40106086
has comment: http://stackoverflow.com/comment/40080503

http://stackoverflow.com/q/25695331
tagged with: blackjack
has answer: http://stackoverflow.com/a/25695677
has comment: http://stackoverflow.com/comment/40163000
score: -1
has comment: http://stackoverflow.com/comment/40162945
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40162982
answer count: 2
accepted answer: http://stackoverflow.com/a/25695667
has title: I am new to programming and I am having trouble making Cards with Suits assigned to them for a BlackJack Game
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40162865
has answer: http://stackoverflow.com/a/25695667
downvote count: 1
favorite count: 0
type: Question
has body: I am making a BlackJack game but i got a little stuck on how to make a deck with proper suits... My first thought was to have something like int[] cards ={1, 2, etc etc etc}; but then I couldn't figure out how to implement suits with those cards Now I know my code is far from finished, I still need to have hands and many other things but I would like to first learn how to make Cards and Suits before I move on Basically my question is: How can I make a Deck of Cards with suits and use them for my Black Jack game Also if you explain to me how and why it works that would be great since I am trying to learn java programming. MY CODE package blackjack2; import java.util.Scanner; import java.util.Random; public class blackjackattemp2 { final static String NL = System.getProperty("line.separator"); static Scanner reader = new Scanner(System.in); static int playersValue = 0, dealersValue = 0, bet = 0, money = 0; static boolean win; static char hit; public static void main(String[] args) { System.out.println("How much money would you like to start with?: "); money = reader.nextInt(); if(money &lt; 0){ System.out.print("You are out of money!" + NL + "You lose!"); } } public static void hit(char hit){ while(hit == 'y'){ } } static void testWin(boolean testWin){ if(playersValue &gt; 21 || dealersValue &gt;= playersValue &amp;&amp; dealersValue &lt;= 21){ win = false; } if(dealersValue &gt; 21 || playersValue &lt;= 21 &amp;&amp; playersValue &gt;= dealersValue){ win = true; } } static void moneyCalc(){ if(win == true){ money = money + bet; } if(win == false){ money = money - bet; } } static void deck(){ } } I was thinking of how i would add cards to a users hand and I came up with this, It worked in my first version of my Black Jack game but I don't think it will now... System.out.println("You get a " + cards[0] + " and a " + cards[1]); cardValue = cards[0] + cards[1]; System.out.println("Your total is " + cardValue); I would appreciate it greatly if someone were to tell me how …
possible better answer: http://stackoverflow.com/a/25695677
has comment: http://stackoverflow.com/comment/40163049

http://stackoverflow.com/comment/40192399
type: Comment
comment on: http://stackoverflow.com/q/25711858
score: 1
type: QuestionComment
has text: It looks like it is tricky to implement: http://stackoverflow.com/questions/21887358/reflection-type-inference-on-java-8-lambdas

http://stackoverflow.com/comment/40150755
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25689277
type: Comment
has text: Please show which line is generating the exception (i.e which is line 27).

http://stackoverflow.com/q/25602198
answer count: 2
has body: Right now I am working on an Android application that requires allowing the user to cut copy and paste onto an editText fields. But when I copy a formatted string from other places (i.e. a string that is underlined) and paste it on to the editText field, it shows it as a formatted version. How do I remove this? I have tried to add a textwatcher by adding addTextChangedListener, and in the after text change I just do edittext.setText(s.toString()+"") but this creates an infinite loop. :( Please help! Thanks in advance. Edit---- I have made some progress by setting setCustomSelectionActionModeCallback editDestination_.setCustomSelectionActionModeCallback(new Callback() { @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) {return true;} @Override public void onDestroyActionMode(ActionMode mode) {} @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { menu.removeItem(android.R.id.paste); menu.removeItem(android.R.id.selectAll); menu.add(0, CUSTOM_PASTE, 0, "Paste").setIcon(R.drawable.paste_ic); return true; } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()) { case CUSTOM_PASTE: edittext.setText(readFromClipboard(aContext_)); // Finish and close the ActionMode mode.finish(); return true; default: break; } return false; } }); This is working pretty well until I realize there are two types of cut/copy/and paste on my phone. One is when the edit text is empty and I long click on the field. This bring up a popup menu. The other one is when there is text in the field, and when I long click, this bring up a cut/copy/and paste bar below my action bar. My code from above is only affecting the bar-below-action bar one. :(
type: AnsweredQuestion
downvote count: 0
upvote count: 1
score: 1
possible better answer: http://stackoverflow.com/a/25602397
favorite count: 0
tagged with: copy-paste
has answer: http://stackoverflow.com/a/25602397
has title: How to remove text formatting when pasting from clipboard on Android
type: Question
accepted answer: http://stackoverflow.com/a/25628916
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25628916
tagged with: android-edittext

http://stackoverflow.com/comment/40160558
has text: I've already tried it. But it didn't work for me =/. But thanks anyway.
score: 0
comment on: http://stackoverflow.com/a/25694219
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25773088
has comment: http://stackoverflow.com/comment/40323925
has comment: http://stackoverflow.com/comment/40324122
answers question: http://stackoverflow.com/q/25705847
has comment: http://stackoverflow.com/comment/40327519
type: Answer
has comment: http://stackoverflow.com/comment/40336254
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/85198184
downvote count: 0
has body: Note that what you are doing here is implemented in EasyBind. See how to map and bind a list. Essentially, this is how you implement your bindLists method: public static &lt;SRC, DEST&gt; void bindLists( ObservableList&lt;DEST&gt; dest, ObservableList&lt;SRC&gt; src, Function&lt;? super SRC, ? extends DEST&gt; transformer) { EasyBind.listBind(dest, EasyBind.map(src, transformer)); }

http://stackoverflow.com/comment/39908384
type: AnswerComment
comment on: http://stackoverflow.com/a/25552906
has text: But there is nothing to inherit. Inheritance is by definition the acquisition of functionality and variables from a superclass, by a subclass. This is a contract, where the concrete implementation provides functionality for the interface.
score: 0
type: Comment

http://stackoverflow.com/comment/39974091
has text: Are those two hashed strings equal? Is `request.uri` on server the same as `requestUrl` on client? What about the JSON format (`asJson`)? You know that you must construct the same structure in order to get the same signature result, right?
comment on: http://stackoverflow.com/q/25591963
type: Comment
type: QuestionComment
score: 0

wsdl
tags question: http://stackoverflow.com/q/25647381
tags question: http://stackoverflow.com/q/25568407
tags question: http://stackoverflow.com/q/25680586
tags question: http://stackoverflow.com/q/25607495
tags question: http://stackoverflow.com/q/25647239
type: Tag
tags question: http://stackoverflow.com/q/25556550
tags question: http://stackoverflow.com/q/25620622
tag name: wsdl
tags question: http://stackoverflow.com/q/25649842
tags question: http://stackoverflow.com/q/25619786
tags question: http://stackoverflow.com/q/25571047

http://stackoverflow.com/comment/57870046
type: AnswerComment
has text: The is counter to what I am reading in the current spring documents:https://docs.spring.io/spring-security/site/docs/current/reference/html/csrf.html which says:If you are using Spring MVC <form:form> tag or Thymeleaf 2.1+ and are using @EnableWebSecurity, the CsrfToken is automatically included for you (using the CsrfRequestDataValueProcessor).
comment on: http://stackoverflow.com/a/32618733
score: 0
type: Comment

http://stackoverflow.com/q/25683321
answer count: 4
linked to: http://stackoverflow.com/q/12421814
has answer: http://stackoverflow.com/a/25683579
score: 0
tagged with: random
has body: I just began developing android apps and i suddenly found it difficult reading a word from a text file, randomly,when a button is clicked.i tried putting all the words from the text file into an array and told it to display the word until the next line( randomly), but it doesn't seem to work. I want to know how to read and display words from a text file one by one and Randomly, every time a button is clicked !!!
has comment: http://stackoverflow.com/comment/40139807
type: Question
has title: Reading from a text file Randomly
has answer: http://stackoverflow.com/a/25684016
has answer: http://stackoverflow.com/a/25683389
has comment: http://stackoverflow.com/comment/40139828
has comment: http://stackoverflow.com/comment/40140236
type: UnansweredQuestion
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25684064

http://stackoverflow.com/q/25687215
type: AnsweredQuestion
answer count: 3
has answer: http://stackoverflow.com/a/28428281
tagged with: java
tagged with: junit
favorite count: 0
score: 4
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/25688575
has comment: http://stackoverflow.com/comment/40146754
possible better answer: http://stackoverflow.com/a/28428281
downvote count: 0
tagged with: spring
accepted answer: http://stackoverflow.com/a/25688575
has answer: http://stackoverflow.com/a/50985767
has body: I have the following controller: class Controller { @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/verifyCert", method = RequestMethod.GET) public void verifyCertificate() throws CertificateExpiredException, CertificateNotYetValidException { certificate.checkValidity(); } @ResponseStatus(HttpStatus.FORBIDDEN) @ExceptionHandler({CertificateExpiredException.class, CertificateNotYetValidException.class}) public void handleCertificateValidityException(Exception e) {} } My goal is to that controller redirects to exception handler if certificate is not valid.
has comment: http://stackoverflow.com/comment/40149143
has title: Write JUnit test for local @ExceptionHandler
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/25604215

http://stackoverflow.com/a/25698915
accepted answer of: http://stackoverflow.com/q/25697291
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40171078
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40172183
type: Answer
has comment: http://stackoverflow.com/comment/40172107
answers question: http://stackoverflow.com/q/25697291
has body: Try the following: <mkdir dir="${build.test.dir}"/> <classpath refid="lib.junit"/> <classpath refid="lib.dataquery"/> <include name="**/*.class"/> <mkdir dir="${build.test.report.dir}"/> <classpath refid="lib.junit"/> <classpath refid="lib.dataquery"/> <classpath refid="lib.dataquery.tdd"/> <formatter type="xml"/> <echo message="Test failed - cat the test report"/> <arg value="${build.test.report.dir}/TEST-Summary.xml"/> Run using: ant testwithcat Output: Test failed - cat the test report [content of ${build.test.report.dir}/TEST-Summary.xml] You will need to customise <arg value="${build.test.report.dir}/TEST-Summary.xml"/> with your own command to "cat your report in colour". To get plain text output take a look at Ant JUnit Nice Output Formatter. You can use <report format="frames" todir="${build.test.report.dir}"/> or <report format="noframes" todir="${build.test.report.dir}"/> in the junitreport task to generate html output. You can replace <arg value="${build.test.report.dir}/TEST-Summary.xml"/> with a call to display the html in a browser. See Exec for example code to do this.

http://stackoverflow.com/q/25706370
accepted answer: http://stackoverflow.com/a/25706495
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25706495
has body: I have a dynamic web project (JSP and Servlet): Client uploads a file to server Save client's file Show "Your result will have in about 1h, we will send result to your email." Process client's file Send result to client's email. How can I do (4)?
downvote count: 0
tagged with: jsp
tagged with: servlets
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25706390
has title: How to run a process after send response to client in jsp and servlet?
tagged with: java
has answer: http://stackoverflow.com/a/25706390
score: 1
upvote count: 1

http://stackoverflow.com/q/25631048
accepted answer: http://stackoverflow.com/a/25632656
possible better answer: http://stackoverflow.com/a/38661864
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/38661864
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40046834
type: Question
has body: is it possible to return a JSONObject in Jersey? Here is what I am trying to achieve: @Path("/path") @get @Produces(MediaType.APPLICATION_JSON) public JSONObject foo() { ... JSONObject json = getJsonObject(); return json; } I tried to code the above but got some errors regarding the getters and setters of the JSONObject class. Any advice? Here is the stacktrace I am getting: org.codehaus.jackson.map.JsonMappingException: No serializer found for class org.json.JSONObject and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) org.codehaus.jackson.map.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:52) org.codehaus.jackson.map.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:25) org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:610) org.codehaus.jackson.map.ser.StdSerializerProvider.serializeValue(StdSerializerProvider.java:256) org.codehaus.jackson.map.ObjectMapper.writeValue(ObjectMapper.java:1604) org.codehaus.jackson.jaxrs.JacksonJsonProvider.writeTo(JacksonJsonProvider.java:558) com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy.writeTo(JacksonProviderProxy.java:160) com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:302) com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1510) com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419) com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409) com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.do…
answer count: 2
tagged with: jersey
has comment: http://stackoverflow.com/comment/40047998
has title: Jersey return a JSONObject
downvote count: 0
has answer: http://stackoverflow.com/a/25632656
upvote count: 1
has comment: http://stackoverflow.com/comment/40045714
type: AnsweredQuestion

http://stackoverflow.com/comment/40270585
type: Comment
has text: Sorry, I'm not really interested in any solution that requires refactoring production code. We're way too busy to have to deal with that kind of stuff at the moment. I just want these constant values more visible for our support department.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25736350

http://stackoverflow.com/a/25647022
has comment: http://stackoverflow.com/comment/40075074
has comment: http://stackoverflow.com/comment/40074859
answers question: http://stackoverflow.com/q/25646698
score: 0
has comment: http://stackoverflow.com/comment/40074148
has body: year will not be assigned to when Integer.parseInt(userInput); throws a NumberFormatException. That gotYear then remains Boolean.FALSE keeping in the loop, is too complex for the compiler. It thinks you might exit the loop somehow. The following should behave better. for (;;) { try { year = Integer.parseInt(userInput); break; } catch (Exception e) { System.out.print("Please insert a valid date. "); userInput = input.readLine(); } } Maybe the compiler just might accept: for (boolean keepAsking = true; keepAsking; ) { try { year = Integer.parseInt(userInput); keepAsking = false; BTW better use boolean instead of the Object wrapper class Boolean.
type: Answer
has comment: http://stackoverflow.com/comment/40074434

http://stackoverflow.com/comment/39932874
score: 0
has text: So, Datastore strings are as a REGEX identical to the other strings. I'd sugggest two work-arounds, that require you to add code before calling this method: (1) Add a prefix to the other strings to use as the token to identify from Datastore strings; (2) to use the information of which was originally a Datastore key and was not and include it along the String. This is OOP not Assembler language after all.
type: QuestionComment
comment on: http://stackoverflow.com/q/25565193
type: Comment

http://stackoverflow.com/comment/39946860
has text: I'm going to guess that you asked this because you frequently see C++ function protypes take a reference to a const object as a parameter. That is an intentional optimization, to allow functions parameter values to be rvalues without having to copy them for the function call (and C++11 adds rvalue references, as an alternative). But, a const function parameter is not going to be passed by reference by default.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25576966

http://stackoverflow.com/q/25605628
tagged with: java
answer count: 0
tagged with: image-processing
upvote count: 1
tagged with: photoshop
downvote count: 1
favorite count: 0
tagged with: processing
type: Question
has comment: http://stackoverflow.com/comment/50853014
has title: Emulate PhotoShop's “Color Range” with Processing
tagged with: reverse-engineering
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40057884
linked to: http://stackoverflow.com/q/19986198
has body: I'm trying to emulate Photoshop's "Color Range" using Processing. I've found some useful information about the algorithm here: Emulate PhotoShop's "Color Range" algorithm But my problem is to implement it into a processing sketch, as I'm new to Java. I've managed to do all the calculations but I don't know how to apply them, eg. I would like to change the saturation to the pixels in that range. How do I do that? By the way here's my code (there's probably something wrong). // Declaring variables PImage img; void setup() { size(800,800); colorMode(HSB, 360, 100, 100); //making the window resizable // if (frame != null) { // frame.setResizable(true); // } img = loadImage("scanned_texture.jpg"); } void draw() { loadPixels(); img.loadPixels(); img.resize(800,800); //loop through every pixel for (int x = 0; x < img.width; x++) { for (int y = 0; y < img.height; y++ ) { // Calculate the 1D pixel location int loc = x + y*img.width; // Get the H,S,B values from image float h = hue (img.pixels[loc]); float s = saturation (img.pixels[loc]); float b = brightness (img.pixels[loc]);; float Point1hue = hue(27); float Point1sat = saturation(50); float Point1bright = brightness(80); float Point2hue = hue(57); float Point2sat = saturation(80); float Point2bright = brightness(100); //distance between colors float distance = sqrt(pow((Point2hue - Point1hue),2) + pow((Point2sat - Point1sat),2) + pow((Point2bright - Point1bright),2)); float percentage = distance/sqrt((255)^2+(255)^2+(255)^2); color c = color(h,s,b); //change saturation based on color range if (c == percentage) { s = +50; } pixels[loc] = c; } } updatePixels(); }
has comment: http://stackoverflow.com/comment/40039458
score: 0

http://stackoverflow.com/a/25585937
answers question: http://stackoverflow.com/q/25583339
upvote count: 3
type: Answer
has body: I've added some code that vastly improves the running time - skip to the bottom to see the examples. A key insight I found is that you can skip sub-sequences if the input doesn't lie anywhere in it. For example, if you are looking for the 1,000,000,000th number, you know it isn't in the 5th subsequence {1,2,3,4,5}. So why iterate over it? This version seems to be much faster (try running it with an input of 1000000000 and see the time difference), and as far as I can tell it returns the same result in all cases. Thus, my algorithm keeps track of the length of the subsequence (Add the number of digits on each iteration), and the subsequence we're on. If the input is larger than the subsequence's length, just subtract that length and iterate again. If it is smaller (or equal, since the problem is 1-indexed), start breaking down that sub-sequence. A minor note: I also updated the getNumberOfDigits so that it can handle any number by doing it recursively, but both the new and old versions rely on this new method so it doesn't get credit for the time improvement. public class Foo { private static Scanner sc = new Scanner(System.in); private static long input; private static long inputCounter = 0; private static int numberOfInputs; /** Updated main method that calls both the new and old step() methods * to compare their outputs and their respective calculation times. * @param args */ public static void main(String[] args) { numberOfInputs = Integer.parseInt(sc.nextLine().trim()); while (inputCounter != numberOfInputs) { long i = Long.parseLong(sc.nextLine().trim()); input = i; System.out.println("Processing " + input); long t = System.currentTimeMillis(); System.out.println("New Step result - " + newStep() + " in " + (System.currentTimeMillis() - t)+"ms"); input = i; t = System.currentTimeMillis(); System.out.println("Old Step result - " + step() + " in " + (System.currentTimeMillis() - t)+"ms"); inputCounter++; } } /** Old version of step() method given in question. Used…
has comment: http://stackoverflow.com/comment/39964971
has comment: http://stackoverflow.com/comment/39965087
has comment: http://stackoverflow.com/comment/39964694
has comment: http://stackoverflow.com/comment/39964826
has comment: http://stackoverflow.com/comment/39966008
has comment: http://stackoverflow.com/comment/39964800
has comment: http://stackoverflow.com/comment/39964758
has comment: http://stackoverflow.com/comment/39964916
downvote count: 0
has comment: http://stackoverflow.com/comment/39967118
has comment: http://stackoverflow.com/comment/39965009
score: 3
has comment: http://stackoverflow.com/comment/39964852

http://stackoverflow.com/comment/40032428
has text: How about adding new keywords and defining their Actions?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25623697
score: 0

http://stackoverflow.com/q/25588800
linked to: http://stackoverflow.com/q/20933211
type: AnsweredQuestion
has body: I have two Strings One is String s1 = "I have 1000 dollars"; Second is String s2 = "I want my pet"; I need to ONLY get "have" , "1000", "dollars" in s1. Similarly, I need to ONLY get "want", "my" and "pet" in s2. I know how to get the "I" using the code String newS1 = s.substring(0, s.indexOf(" ")); Is there a way I can achieve this using substring?
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/39968192
upvote count: 1
duplicate of: http://stackoverflow.com/q/20933211
score: 1
tagged with: java
tagged with: regex
tagged with: string
has answer: http://stackoverflow.com/a/25588873
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/4570037
has comment: http://stackoverflow.com/comment/39968245
has answer: http://stackoverflow.com/a/25588845
has answer: http://stackoverflow.com/a/25588847
accepted answer: http://stackoverflow.com/a/25588847
has comment: http://stackoverflow.com/comment/39968232
has comment: http://stackoverflow.com/comment/39968211
has title: Trim a string to get second word, third word and fourth word in java?
possible better answer: http://stackoverflow.com/a/25588873
has comment: http://stackoverflow.com/comment/39968226
has comment: http://stackoverflow.com/comment/39968208

http://stackoverflow.com/comment/40082938
comment on: http://stackoverflow.com/q/25651823
score: 1
type: Comment
type: QuestionComment
has text: http://docs.oracle.com/javase/1.5.0/docs/guide/language/foreach.html

http://stackoverflow.com/q/25690217
tagged with: spring
has comment: http://stackoverflow.com/comment/40377649
favorite count: 0
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40372937
has title: Envers: wrong audit table on a Spring MVC project
tagged with: java
tagged with: hibernate
type: Question
upvote count: 2
has body: I'm using Spring Data JPA 1.6.4 with Hibernate 4.3.6.Final + envers into a Spring MVC 4.0.7 web application secured with Spring Security 3.2.5. The web application is deployed on a Tomcat 7.0.52 web container, configured with a JNDI datasource: <Resource name="jdbc/appDB" auth="Container" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" type="javax.sql.DataSource" initialSize="4" maxActive="8" maxWait="10000" maxIdle="8" minIdle="4" username="user" password="password" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://ip/schema?zeroDateTimeBehavior=convertToNull" testOnBorrow="true" testWhileIdle="true" validationQuery="select 1" validationInterval="300000" /> Database runs on a MySql Server version 5.5 and have an InnoDB schema. I have a strange behaviour with audit table Customers_H: noticed that sometimes audit tables are populated in a wrong way by envers. The most of the time things works ok. I have no idea of why and when It happens, but I have as a result of an insert a revision table like the following: ID ACTION TYPE REV END USER 23 0 256 U1 23 2 NULL NULL 23 0 NULL U2 The strange thing is that U1 is the owner of an entity with id = 6 (not of the entity with id = 23!), while U2 has really worked on entity ID 23. The problem is that the revision table is inconsinstent and then I have an Hibernate ASSERTION FAILURE. Seems that it should be ok only if envers creates the third row. But why it creates also the first (with action CREATE) and the second one (with action DELETE)? ERROR org.hibernate.AssertionFailure - HHH000099: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session): java.lang.RuntimeException: Cannot update previous revision for entity Customer_H and id 23. This prohibit user to update the entity. My problem is to investigate how this can happen! Here is Customer domain: @SuppressWarnings("serial") @Entity @Audited public class Customer extends AbstractDomain{ @ManyToO…
has answer: http://stackoverflow.com/a/26240165
accepted answer: http://stackoverflow.com/a/26240165
downvote count: 0
tagged with: spring-data
answer count: 1
has comment: http://stackoverflow.com/comment/40456131
linked to: http://stackoverflow.com/q/26239083

http://stackoverflow.com/a/25675344
has comment: http://stackoverflow.com/comment/40135681
answers question: http://stackoverflow.com/q/25646335
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25646335
type: AcceptedAnswer
has body: You can use context.request().path() to get a string with the path used. This will not include any query parameters, so if you want them you can use getQueryParameter or uri (full url) methods of the same object. If you need more information than this you can use context.args. This will give you a map with the following keys (in Play 2.2 atleast): ROUTE_VERB -&gt; The HTTP verb used (ex: GET) ROUTE_ACTION_METHOD -&gt; The method called (ex: getUserFavorites) ROUTE_CONTROLLER -&gt; Controller class (ex: controllers.api.UsersController) ROUTE_COMMENTS -&gt; ??? ROUTE_PATTERN -&gt; THE URL used (ex: users/favorites)

http://stackoverflow.com/q/25692735
tagged with: spring-security
favorite count: 0
upvote count: 17
tagged with: spring-mvc
possible better answer: http://stackoverflow.com/a/32618733
tagged with: security
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26527946
has title: Simple example of Spring Security with Thymeleaf
answer count: 5
has answer: http://stackoverflow.com/a/51621770
tagged with: java
has answer: http://stackoverflow.com/a/29821574
score: 17
type: Question
tagged with: thymeleaf
has answer: http://stackoverflow.com/a/32618733
has body: hi I'm trying to follow a simple example about doing a simple login form page that i found in this page http://docs.spring.io/autorepo/docs/spring-security/4.0.x/guides/form.html the problem is that i´m getting this error everytime that i try to login i get this error: Expected CSRF token not found. Has your session expired? When i get this error i press the back button in my explorer and try a second time to log in and when i do that i get this error: HTTP 403 - Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-CSRF-TOKEN' in the tutorial page is this message: We use Thymeleaf to automatically add the CSRF token to our form. If we were not using Thymleaf or Spring MVCs taglib we could also manually add the CSRF token using "so because i am using thymeleaf too i didnt add that tag to my page" i found another solution and it works and this solution is adding this to my security config class .csrf().disable() this solution works but i suppose that what this do is to disable csrf protection in my page and i dont want to disable this type of protection. this is my security-config class : @Configuration @EnableWebSecurity public class ConfigSecurity extends WebSecurityConfigurerAdapter { @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth .inMemoryAuthentication() .withUser("user").password("password").roles("USER"); } @Override protected void configure( HttpSecurity http ) throws Exception { http //.csrf().disable() is commented because i dont want disable this kind of protection .authorizeRequests() .anyRequest().authenticated() .and() .formLogin() .loginPage("/login") .permitAll() .and() .logout() .permitAll(); } } my security initialzer : public class InitSecurity extends AbstractSecurityWebApplicationInitializer { public InicializarSecurity() { super(ConfigSecurity .class); } } my app-config class where i have my thymeleaf configuration @EnableWebMvc @ComponentScan(basePackages = {"com.myA…
accepted answer: http://stackoverflow.com/a/25707276
downvote count: 0
has answer: http://stackoverflow.com/a/25707276

http://stackoverflow.com/a/25690958
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25690900
has comment: http://stackoverflow.com/comment/40156043
answers question: http://stackoverflow.com/q/25690900
type: Answer
has body: Possible reasons: a) Its included in the dependencies but the Log4j jar is not present in the class path, or has moved. Please check if it is present in the class path. b) It's often caused by importing in the webapp librairies (WEB-INF/lib), JARs that are already available in the application server. Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found. The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found. See Also: During Deployment in Weblogic. nested exception is java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence
score: 1
has comment: http://stackoverflow.com/comment/40156110

http://stackoverflow.com/comment/40025874
has text: @AleksandrM m attaching view above, where m getting all map values in one row.
comment on: http://stackoverflow.com/q/25617519
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39904824
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25551629
has text: @MikkelK. I edited the answer, hope I could convey what is am trying to do.
score: 1

http://stackoverflow.com/q/25570848
answer count: 2
possible better answer: http://stackoverflow.com/a/25633980
has answer: http://stackoverflow.com/a/25633980
downvote count: 0
has comment: http://stackoverflow.com/comment/39935336
has comment: http://stackoverflow.com/comment/39935272
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25571123
upvote count: 1
linked to: http://stackoverflow.com/q/7984508
has comment: http://stackoverflow.com/comment/39935203
has answer: http://stackoverflow.com/a/25571123
has body: I have some XML that roughly looks like this: Build the enterprise Learn Esperanto <problem>Solve world hunger Do Vulcans exist I want to use XPath to find out the names of the second level elements (there can be elements I won't know upfront) using Java. This is the code I tried: public NodeList xpath2NodeList(Document doc, String xPathString) throws XPathExpressionException { XPath xpath = XPathFactory.newInstance().newXPath(); MagicNamespaceContext nsc = new MagicNamespaceContext(); xpath.setNamespaceContext(nsc); Object exprResult = xpath.evaluate(xPathString, doc, XPathConstants.NODESET); return (NodeList) exprResult; } My XPath is /project/*/name(). I get the error: javax.xml.transform.TransformerException: Unknown nodetype: name A query like /project/suggestion works as expected. What am I missing? I'd like to get a list with the tag names.
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/39935056
tagged with: xpath
has title: How to use name() and/or node() in Java XPath query?

http://stackoverflow.com/a/28272804
downvote count: 1
has comment: http://stackoverflow.com/comment/58834711
accepted answer of: http://stackoverflow.com/q/25571580
type: Answer
upvote count: 13
answers question: http://stackoverflow.com/q/25571580
score: 12
has body: I too have the same issue. I just commented out @Repository annotation on my Spring Data JPA repositories and everything is working fine and IntelliJ IDEA is also happy!
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/54624076

http://stackoverflow.com/q/25570582
upvote count: 2
type: UnansweredQuestion
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/47875511
favorite count: 0
type: Question
tagged with: jooq
has comment: http://stackoverflow.com/comment/39941938
has title: How can I manually write mapping for jooq without generator?
has body: I want to write custom mapping for my database without code generation. How can I do it? I need mapping only for two tables and several columns. Do I really need a mapping generator?
score: 2
tagged with: mapping
answer count: 0

http://stackoverflow.com/a/25671130
answers question: http://stackoverflow.com/q/25671049
has body: try this regex \bdomain\.com$ http://rubular.com/r/QG0FtVWtm6
type: Answer
score: 0

http://stackoverflow.com/comment/39939634
comment on: http://stackoverflow.com/a/25572765
type: Comment
type: AnswerComment
has text: One possible solution (in Java 8) would be to modify modena.css, and then call `setUserAgentStylesheet(...)` in your `start(..)` method. It's not an ideal solution, obviously, as you would not benefit from bug fixes in later releases of modena.css without manually updating your modified css file.
score: 0

http://stackoverflow.com/a/25619744
answers question: http://stackoverflow.com/q/25619071
type: AcceptedAnswer
has body: In Java, JavaScript and (especially interesting) JSON there exists the notation \u00F8 for ø. I think this was sent to the database, maybe from a specific browser on a specific computer locale. \u disappeared and voilà. Maybe it is still as invisible control character in the string. That would be nice for repairs. My guess is JSON data; however normally JSON libraries should parse u-escaped characters. That is weird. Check what happens when storing "x\\u00FDx". Is the char length 6 or maybe 7 (lucky). Some sanity checks: assuming you work in UTF-8, especially if the data arrive by HTML or JS: Content-Type header text/html; charset=UTF-8 (Optional) meta tag with charset=UTF-8 &lt;form action="..." accept-charset="UTF-8"&gt; JSON: contentType: "application/json; charset=UTF-8"
score: 2
type: Answer
has comment: http://stackoverflow.com/comment/40028605
has comment: http://stackoverflow.com/comment/40029135
accepted answer of: http://stackoverflow.com/q/25619071
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/39946401
has text: I wondered if i should have provided some more details, but it was a little difficult on my tablet. Next time I will provide actual bid of code. Thanks for the feedback.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25560774

http://stackoverflow.com/comment/40149222
has text: a simple solution..use [Volley](http://www.androidhive.info/2014/05/android-working-with-volley-library-1/) library it will reduce you entire burden..
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25688532

http://stackoverflow.com/comment/40171470
score: 0
type: AnswerComment
has text: `item(0)` returns first found node or null if not found. Most likely the description is missing that's why you are getting NPE. You should check `getLength()` first and if it's not zero then call `item(0).getTextContent()`
comment on: http://stackoverflow.com/a/25690972
type: Comment

http://stackoverflow.com/comment/40173881
comment on: http://stackoverflow.com/q/25701161
type: Comment
type: QuestionComment
has text: @HowardRoark If you have no control over your clients and if one video (`frame count x average size of your png images`) is bigger than the heap, you cannot keep the whole video in memory. You have to stream the video into a file while constructing it.
score: 1

http://stackoverflow.com/comment/40062516
type: QuestionComment
score: 0
has text: @desseim you're right.. I'm such an idiot lol. Posting the SHA224 code
type: Comment
comment on: http://stackoverflow.com/q/25639449

http://stackoverflow.com/a/25565080
type: Answer
has comment: http://stackoverflow.com/comment/39924766
has body: The problem is that try-with-resources block will automatically close the Clip created in it when the block finishes causing the playback to stop. In your other example since you don't close it manually, the playback can continue. If you want to close the Clip when it finished playing, you can add a LineListener to it with the addLineListener() and close it when you receive a STOP event like this: final Clip clip = AudioSystem.getClip(); // Configure clip: clip.open(); clip.start(); clip.addLineListener(new LineListener() { @Override public void update(LineEvent event) { if (event.getType() == LineEvent.Type.STOP) clip.close(); } });
has comment: http://stackoverflow.com/comment/39923905
score: 5
answers question: http://stackoverflow.com/q/25564980
has comment: http://stackoverflow.com/comment/39924656
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25564980
has comment: http://stackoverflow.com/comment/39924310
upvote count: 5

http://stackoverflow.com/q/25656651
has answer: http://stackoverflow.com/a/25656673
accepted answer: http://stackoverflow.com/a/25656673
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/252055
linked to: http://stackoverflow.com/q/2723397
tagged with: java
answer count: 1
downvote count: 1
tagged with: generics
has title: Typesafe heterogeneous container puzzle
favorite count: 0
type: Question
has body: Can you fix what I've done to Josh Blocks Effective Java heterogeneous container? I'm toying with the idea storing String.class in stringClass but it doesn't work. Can you explain why and fix it? package heterogeneous; import java.util.HashMap; import java.util.Map; //Typesafe heterogeneous container pattern - implementation public class TypedValue { private Map&lt;Class&lt;?&gt;, Object&gt; typedValues = new HashMap&lt;Class&lt;?&gt;, Object&gt;(); public &lt;T&gt; TypedValue(Class&lt;T&gt; type, T instance) { put(type, instance); } public &lt;T&gt; T put(Class&lt;T&gt; type, T instance) { if (type == null) throw new NullPointerException("Type is null"); @SuppressWarnings("unchecked") T oldValue = (T) typedValues.put(type, instance); return oldValue; } public &lt;T&gt; T get(Class&lt;T&gt; type) { return type.cast(typedValues.get(type)); } // Typesafe heterogeneous container pattern - client public static void main(String[] args) { TypedValue j = new TypedValue(String.class, "Java"); TypedValue i = new TypedValue(Integer.class, 0xcafebabe); TypedValue t = new TypedValue(Class.class, TypedValue.class); String favoriteString = j.get(String.class); int favoriteInteger = i.get(Integer.class); Class&lt;?&gt; favoriteClass = t.get(Class.class); // .-=== Fix and explain what was wrong ==-. // Class&lt;?&gt; stringClass = String.class; //Type mismatch: cannot convert from capture#1-of ? to String favoriteString = j.get(stringClass); // ^-=== Fix and explain what was wrong ==-^ // System.out.printf( "%s %x %s%n", favoriteString, favoriteInteger, favoriteClass.getName() ); } }
score: -1

http://stackoverflow.com/comment/40095768
type: QuestionComment
score: 0
has text: A [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem would also be helpful
type: Comment
comment on: http://stackoverflow.com/q/25658672

http://stackoverflow.com/q/25629691
upvote count: 2
tagged with: android-xml
downvote count: 0
tagged with: android-intent
has title: Open Activity with Linkify Android
possible better answer: http://stackoverflow.com/a/25629797
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25629797
has answer: http://stackoverflow.com/a/39531175
tagged with: android
tagged with: java
tagged with: android-activity
accepted answer: http://stackoverflow.com/a/39531175
has body: i want to open Activity when users click on textView with linkify... Heres my code: Pattern tagMatcher = Pattern.Compile("#([A-Za-z0-9_-]+)"); //Scheme for Linkify, when a word matched tagMatcher pattern, //that word is appended to this URL and used as content URI String newActivityURL = "content://Solution.Project.WelcomeActivity"; //Attach Linkify to TextView wrapper.Text.Text = post.PostText; Linkify.AddLinks(wrapper.Text, tagMatcher, newActivityURL); and my Android manifest.xml &lt;application android:icon="@drawable/Icon" android:label="Welcome"&gt; &lt;activity android:name=".WelcomeActivity" android:label="@string/WelcomeText"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; And when users click on textView, it throws following exception : android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://Solution.Project.welcomeactivity (has extras) }
favorite count: 0
type: Question
answer count: 2

http://stackoverflow.com/comment/40115148
comment on: http://stackoverflow.com/a/25669595
type: AnswerComment
has text: The base of `log` is irrelevant in the big-O notation, as long as it's a constant > 1.
type: Comment
score: 0

http://stackoverflow.com/comment/40062097
score: 0
comment on: http://stackoverflow.com/a/25640093
has text: That's actually yes and no. It depends on your needs. Listener is enough to compose containers as I said, Filter just adds Context/Session/Request instances to the containers if you need them. So if you want to have http request injected to you request scope components and http session injected to your session scope components, you will need the filter.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40112938
score: 0
has text: I think the problem with master_id is solved, and now there is problem in .setTimestamp("passwordExpiration", DateUtil.getTomorrow()) - see the link above.
comment on: http://stackoverflow.com/q/25667914
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25592717
tagged with: java
answer count: 1
tagged with: url
has title: Hide parameter passed by URL Tag in Struts 2
has body: In my Struts 2 Application, I am getting a table of values from the database using the iterator tag and using respective getter and setters for the same. For Example I am getting list of Account number, Name and Account Balance. Now, What I wasn't do is if some one click on the Account number, then the request will be sent to another action class which has required getter and setter and will redirect him to a page where the account details will be shown based on that account number. Problem is that, as the user clicks the URL, value is passed like get parameters so it is very insecure. I want to hide the values. Currently I am using the following: <s:url action="custACDetails" var="urlTag" > <s:param name="yourAc"><s:property value="acno"/></s:param> </s:url> <a href="<s:property value="#urlTag" />" ><s:property value="acno"/>
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39975888
has answer: http://stackoverflow.com/a/25593596
duplicate of: http://stackoverflow.com/q/16376190
has comment: http://stackoverflow.com/comment/39985181
tagged with: struts2
tagged with: parameters
score: 0
linked to: http://stackoverflow.com/q/16376190

http://stackoverflow.com/comment/40115234
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25669574
has text: The client is a browser. You instanticate the Application once for a browser??

http://stackoverflow.com/a/25680976
type: Answer
has comment: http://stackoverflow.com/comment/40240537
answers question: http://stackoverflow.com/q/25676605
has body: I'd go for Spring Boot. Version 1.1.6 was just released. I'm currently also migrating an "old" SI application to be based upon Spring Boot. I suggest you give http://start.spring.io a try. Migration should not be too difficult.
score: 0
has comment: http://stackoverflow.com/comment/40198795

http://stackoverflow.com/q/25696565
has body: I have a basic android application that has several pages accessible from the home page, anyways I change the layout by doing public void main(View view) { setContentView(R.layout.main); } and changing the layout to the main game page. Now I want to add characters to it and so I added protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint green = new Paint(); green.setColor(Color.GREEN); Rect theRect = new Rect(); theRect.set(0,0,canvas.getWidth()/2,canvas.getHeight()/2); canvas.drawRect(theRect, green); } but I only want to call it for the "main" or the scene/layout that the game is played in. It appears to not be called at all and that may be due to the fact that I do not completely understand the relationship between the xml and multiple java files and functions. I'm new to android so this may be a stupid question, I just couldn't find anything with multiple web searches, with no luck.
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25696761
has title: The java backend code to the xml code
tagged with: http://stackoverflow.com/tag/xml
type: Question
tagged with: android-layout
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/25598847
tagged with: java
has answer: http://stackoverflow.com/a/25599026
has comment: http://stackoverflow.com/comment/39988450
tagged with: formatting
tagged with: date
answer count: 4
has body: Is there anyway to specify the Date format in Java? I'm not asking about string formatting. When I inspect a date value (in debug mode) in my REST services, it looks like follows: Mon Sep 01 00:00:00 IST 2014 When I pass this date to a hibernate query, it doesn't return me any results, event though there's valid results that satisfies the criteria. Following is my hibernate query: select this_.ID as ID1_59_0_, this_.SEVERITY as SEVERITY5_59_0_, this_.EVENT as EVENT2_59_0_, this_.PROCESS_NAME as PROCESS3_59_0_, this_.HOST_NAME as HOST6_59_0_, this_.TIME as TIME4_59_0_ from SYSTEM_LOG this_ where this_.TIME&gt;? and this_.TIME&lt;? order by this_.TIME asc I run this query in mySQL and pass pass the date as follows, it doesn't return any data, which I believe is what's happening in the application: select this_.ID as ID1_59_0_, this_.SEVERITY as SEVERITY5_59_0_, this_.EVENT as EVENT2_59_0_, this_.PROCESS_NAME as PROCESS3_59_0_, this_.HOST_NAME as HOST6_59_0_, this_.TIME as TIME4_59_0_ from SYSTEM_LOG this_ where this_.TIME&gt; 'Mon Sep 01 00:00:00 IST 2014' and this_.TIME&lt;'Mon Sep 11 00:00:00 IST 2014' order by this_.TIME asc; But if I change the date as follows, the query returns data: select this_.ID as ID1_59_0_, this_.SEVERITY as SEVERITY5_59_0_, this_.EVENT as EVENT2_59_0_, this_.PROCESS_NAME as PROCESS3_59_0_, this_.HOST_NAME as HOST6_59_0_, this_.TIME as TIME4_59_0_ from SYSTEM_LOG this_ where this_.TIME&gt; '2014/9/1' and this_.TIME&lt;'2014/9/11' order by this_.TIME asc; How do I use the correct date format? I tried doing the following, but still the date is shown in same format: DateFormat formatter = new SimpleDateFormat("MM-dd-yyyy", Locale.ENGLISH); Date sDate = formatter.parse(startDate); Date eDate = formatter.parse(endDate); Update: FOllowing is the hibernate method I use to retrieve the data: public PagedDataResult getSystemLogsByDate(Date startDate, Date endDate, String sortColumn, int searchBySeverity, String searchByProcessName, String searchByHo…
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25600153
has comment: http://stackoverflow.com/comment/39986470
upvote count: 1
possible better answer: http://stackoverflow.com/a/25599026
has comment: http://stackoverflow.com/comment/39988849
has answer: http://stackoverflow.com/a/25599077
has answer: http://stackoverflow.com/a/25600153
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25598857
downvote count: 0
has title: passing date object to hibernate query
score: 1

http://stackoverflow.com/q/25663050
tagged with: aop
tagged with: thread-local-storage
tagged with: thread-local
type: AnsweredQuestion
tagged with: aspectj
accepted answer: http://stackoverflow.com/a/25682473
linked to: http://stackoverflow.com/q/17968803
score: 1
tagged with: java
has body: /* We are using Aspect to do AOP on some existing application and we also used threadlocal to store GUId. we are using @Around annotation. At the start of the transaction we are setting the GUID in transaction with initialValue() method. Issue is as we know when we are using threadlocal we should also take care about removing the data from threadlocal otherwise it may result i outofmemory execption. if i am removing it at the last of the aspect it is corrupting the code and changing the UUID value. Please suggest how we can achieve it without outofmemory. Code :- */ @Aspect public class DemoAspect { @Pointcut("execution(* *.*(..)) ") public void logging() {} private static ThreadLocal&lt;String&gt; id = new ThreadLocal&lt;String&gt;() { @Override protected String initialValue(){ return UUID.randomUUID().toString(); } }; @Around("logging()") public Object tracing(ProceedingJoinPoint thisJoinPoint) throws Throwable { String methodSignature=thisJoinPoint.getSignature().toString(); if(id.get().toString()==null || id.get().toString().length()==0) id.set(UUID.randomUUID().toString()); System.out.println("Entering into "+methodSignature); Object ret = thisJoinPoint.proceed(); System.out.println(id.get().toString()); System.out.println("Exiting into "+methodSignature); //id.remove(); return ret; } }
answer count: 1
has answer: http://stackoverflow.com/a/25682473
downvote count: 0
upvote count: 1
has title: where to code ThreadLocal.remove() in aspectj class
favorite count: 0
type: Question

http://stackoverflow.com/comment/59329306
score: 1
comment on: http://stackoverflow.com/a/25562005
type: Comment
has text: With what prefix would you have replaced the prefix "Local" to avoid confusion?
type: AnswerComment

http://stackoverflow.com/comment/39961241
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25584277
has text: @Dave I have included the results for addition,you can add a parameter in the method ,say boolean wthere it is add or subtract and refractor your code accordingly
type: Comment

http://stackoverflow.com/a/25668270
has comment: http://stackoverflow.com/comment/40112546
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25668117
has comment: http://stackoverflow.com/comment/40112582
has comment: http://stackoverflow.com/comment/40112627
downvote count: 0
has comment: http://stackoverflow.com/comment/40113549
has comment: http://stackoverflow.com/comment/40112616
has comment: http://stackoverflow.com/comment/40113265
has body: The following fragment is a Java compile error: Integer integers[] = {}; Integer max; for (Integer i : integers) { if (max == null || i &gt; max) max = i; } The error in Eclipse is "The local variable max may not have been initialized". So you have to initialize max to null. I wonder what Intellij says...
has comment: http://stackoverflow.com/comment/40112959
type: Answer

http://stackoverflow.com/comment/39967337
comment on: http://stackoverflow.com/a/25588261
type: Comment
has text: "Can't happen." I was refering to this line from the api about reads: If there are more bytes in the datagram than remain in the given buffer then the remainder of the datagram is silently discarded. Is there a way to tell the size of the packet before reading to avoid this?
type: AnswerComment
score: 1

http://stackoverflow.com/a/25997150
type: AcceptedAnswer
has body: Serverset in LDAPConnectionPool connectionPool = new LDAPConnectionPool(serverSet, bindRequest, 10); can set socketFactory so whatever your server set is "failoverSet" or "roundRobinSet" it can set socketfactory in its constructor like roundRobinSet = new RoundRobinServerSet(addresses, ports, socketFactory);
answers question: http://stackoverflow.com/q/25646966
type: Answer
accepted answer of: http://stackoverflow.com/q/25646966
score: 0

http://stackoverflow.com/q/25655046
has answer: http://stackoverflow.com/a/25658152
tagged with: parsing
type: Question
has body: I am trying to extract some key-value pairs plus their preceding text from a large file, but the regular expression used runs very slowly, so it needs optimization. The input consists of fairly short strings with 1 or 2 key-value pairs, like one two three/1234==five/5678 some other text or one two three/1234==five/5678 some other text four/910==five/1112 more text The (apparently suboptimal) regular expression used is (.*?)\s*([^ /]+)\s*/\s*([\d]+)\s*==\s*([^ /]+)\s*/\s*([\d]+)\s* (Spaces may appear in numerous areas within the string, hence the repeated \s* elements.) Sample code to test the above: public static void main(String[] args) { String text = "one two three/1234==five/5678 some other text"; text = "one two three/1234==five/5678 some other text four/910==five/1112 more text"; String regex = "(.*?)\\s*([^ /]+)\\s*/\\s*([\\d]+)\\s*==\\s*([^ /]+)\\s*/\\s*([\\d]+)\\s*"; Matcher matcher = Pattern.compile(regex).matcher(text); int end = 0; System.out.println("--------------------------------------------------"); while (matcher.find()) { System.out.println("\"" + matcher.group(1) + "\""); System.out.println(matcher.group(2) + " == " + matcher.group(3)); System.out.println(matcher.group(4) + " == " + matcher.group(5)); end = matcher.end(); System.out.println("--------------------------------------------------"); } System.out.println(text.substring(end).trim()); } The output is the key-value pairs, plus the preceding text (all extracted fields are required). For example, for the longer string, the output is: -------------------------------------------------- "one two" three == 1234 five == 5678 -------------------------------------------------- "some other text" four == 910 five == 1112 -------------------------------------------------- more text In other words, the matcher.find() method runs for 1 or 2 rounds, depending on whether the string has the short or long form (1 or 2 key-value pairs, respectively). The problem is that the extraction speed is low and at ti…
answer count: 2
possible better answer: http://stackoverflow.com/a/25660121
upvote count: 1
has answer: http://stackoverflow.com/a/25660121
has title: Optimization of regular expression for custom key-value pairs
accepted answer: http://stackoverflow.com/a/25658152
favorite count: 0
type: AnsweredQuestion
tagged with: key-value
downvote count: 0
score: 1
tagged with: java
tagged with: regex

http://stackoverflow.com/comment/39961684
comment on: http://stackoverflow.com/a/25584971
has text: `COLUMN_ID` must be null for `UNIQUE` and `AutoIncrement`
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39937968
has text: No, it's aways in a different line, after '>' and is the first char
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25572301

http://stackoverflow.com/comment/40099503
type: AnswerComment
has text: As a matter of interest, were the two environments using different processors?
comment on: http://stackoverflow.com/a/25639398
score: 0
type: Comment

http://stackoverflow.com/comment/40150256
type: Comment
type: AnswerComment
has text: Thanks for your answer, seems very indepth, what about if i come at this from a different angle, i personally dont want to run the surfaceview on a seperate thread, leaving it on the UI thread works great for me, so can i run the dialog on a seperate thread, the whole point of me doing this is to hide the 3-4 seconds of black screen while the setrender method runs. So, as soon as i enter oncreate if i create a background thread that runs the dialog will this work? will the dialog display immediately?
comment on: http://stackoverflow.com/a/25688022
score: 0

http://stackoverflow.com/comment/40022171
score: 1
comment on: http://stackoverflow.com/a/25604135
type: Comment
has text: There's no optimal settings for the heap. All depends on your application. Don't try to allocate as much heap as you can as this can lead to long GC triggered pauses. Google for Java heap guidelines. The same goes for MaxPermSize - you can read more about it here - http://stackoverflow.com/questions/12114174/what-does-xxmaxpermsize-do.
type: AnswerComment

http://stackoverflow.com/q/25708452
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25708605
favorite count: 0
type: Question
upvote count: 2
score: 2
has body: I want to use Spring to manage my JPA DAOs in web application and trying to follow the Spring website examples to figure out how to do it. I am considering to use AnnotationConfigWebApplicationContext instead of AnnotationConfigApplicationContext to bootstrap Spring. In the examples, it is used together with org.springframework.web.servlet.DispatcherServlet but I would like to use it without Spring MVC. My web.xml looks following: ... contextClass org.springframework.web.context.support.AnnotationConfigWebApplicationContext contextConfigLocation com.foo.Application org.springframework.web.context.ContextLoaderListener ... My configuration class looks following: ... @Configuration @ComponentScan(basePackages={"com.foo.service"}) public class Application { @Bean MessageService mockMessageService() { return new MessageService() { @Override public String getMessages() { return "Hello Spring World!"; } }; } } Is it possible to inject mockMessageService in this example into my servlets or do I have to create a separate central hub for my web application where the services are called from by the servlets? The problem is that if I have my servlets in package com.foo.service and try to use @Autowired to get dependancy or try some similar approach the service doesn't get injected and I don't know where's the problem. Is it possible to do it like that? Or should I add something for AnnotationConfigWebApplicationContext to work like that?
has title: Spring web context without Spring MVC
answer count: 2
has answer: http://stackoverflow.com/a/25709292
possible better answer: http://stackoverflow.com/a/25709292
accepted answer: http://stackoverflow.com/a/25708605
downvote count: 0
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/a/25615443
answers question: http://stackoverflow.com/q/25613743
type: Answer
has body: You are doing this in your program, try{Thread.sleep(1000);} catch(Exception e){}. As this statement is applied on the main thread itself, so the application itself hangs or you can say freezes. What you can do is apply a separate thread for the timer. new Thread(new Runnable(){ public void run(){ //Do Stuff } }).start();
score: 0

java-stream
tags question: http://stackoverflow.com/q/25712591
tags question: http://stackoverflow.com/q/25706234
tags question: http://stackoverflow.com/q/25626348
tags question: http://stackoverflow.com/q/25551959
tags question: http://stackoverflow.com/q/25652982
tags question: http://stackoverflow.com/q/25615202
tags question: http://stackoverflow.com/q/25625250
tags question: http://stackoverflow.com/q/25567940
tag name: java-stream
type: Tag
tags question: http://stackoverflow.com/q/25624638
tags question: http://stackoverflow.com/q/25569836

http://stackoverflow.com/q/25688663
has comment: http://stackoverflow.com/comment/40210842
type: UnansweredQuestion
answer count: 1
tagged with: web-services
has comment: http://stackoverflow.com/comment/40151112
has title: Error in WrapperBeanGenerator : Not creating ASM Type for type
has comment: http://stackoverflow.com/comment/40151508
tagged with: copy
has body: I'm trying to use a Copy Web Service client to retrieve a soap object on a Linux server. However I keep getting this error trace below: java.lang.IllegalArgumentException: Not creating ASM Type for type = byte[] at com.sun.xml.internal.ws.model.WrapperBeanGenerator.getASMType(WrapperBeanGenerator.java:434) at com.sun.xml.internal.ws.model.WrapperBeanGenerator.collectRequestWrapperMembers(WrapperBeanGenerator.java:297) at com.sun.xml.internal.ws.model.WrapperBeanGenerator.createRequestWrapperBean(WrapperBeanGenerator.java:239) at com.sun.xml.internal.ws.model.RuntimeModeler.getRequestWrapperClass(RuntimeModeler.java:279) at com.sun.xml.internal.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:673) at com.sun.xml.internal.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:611) at com.sun.xml.internal.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:400) at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:239) at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:710) at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:698) at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:330) at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:313) at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:295) at javax.xml.ws.Service.getPort(Service.java:112) at actuals.com.microsoft.sharepoint.webservices.Copy.getCopySoap(Copy.java:56) And below is the code being run: public CopySoap getCopySoap() throws Exception { System.out.println("Creating a CopySoap instance..."); Copy service = new Copy(new URL("https://ts.kompany.com/sites/Global/_vti_bin/Copy.asmx?wsdl"), new QName("http://schemas.microsoft.com/sharepoint/soap/", "Copy")); CopySoap copySoap = service.getCopySoap(); BindingProvider bp = (BindingProvider) copySoap; bp.getRequestContext().put(BindingProvi…
has answer: http://stackoverflow.com/a/26549431
score: 0
tagged with: linux
tagged with: java
tagged with: soap
has comment: http://stackoverflow.com/comment/40150809
type: Question
has comment: http://stackoverflow.com/comment/40155114

http://stackoverflow.com/q/25678165
upvote count: 3
tagged with: java
answer count: 1
has body: I got a problem when using Java nio to do networking. I start a server in a thread and register read operationsin the selector. and another thread connect to the server. client write a byte to the server server reads the datas and back a byte to the client client get the response and write a byte to the server again. server loop step 2. but server cannot do the step 4 successfully because I can't get any read Key from selector any more. why ?? I have registered it before, and client has written data. there is my code below : package test; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; import java.net.UnknownHostException; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.util.Iterator; public class JavaNIO { public static void main(String[] args) throws Exception { final Selector selector = Selector.open(); ServerSocketChannel serverChannel = ServerSocketChannel.open(); serverChannel.configureBlocking(false); serverChannel.socket().bind(new InetSocketAddress(5555)); serverChannel.register(selector, SelectionKey.OP_ACCEPT); new Thread() { public void run() { while(true) { try { long count = selector.select(); if(count == 0) continue; Iterator&lt;SelectionKey&gt; itKey = selector.selectedKeys().iterator(); while(itKey.hasNext()) { SelectionKey key = itKey.next(); itKey.remove(); if(key.isAcceptable()) { ServerSocketChannel channel = (ServerSocketChannel)key.channel(); SocketChannel socket = channel.accept(); socket.configureBlocking(false); socket.register(selector, SelectionKey.OP_READ); } if(key.isReadable()) { ByteBuffer buffer= ByteBuffer.allocate(1); SocketChannel channel = (SocketChannel)key.channel(); while(true) { buffer.flip(); int len = channel.read(buffer); if(len == 0) break; buffer.clear(); } channel.read(buffer); channel.register(selector, SelectionKey.OP_WRITE, null)…
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25679661
type: UnansweredQuestion
tagged with: sockets
downvote count: 0
tagged with: nio
score: 3
has title: java nio cannot read after register a write operation

http://stackoverflow.com/comment/40018760
comment on: http://stackoverflow.com/q/25616528
score: 0
type: Comment
type: QuestionComment
has text: What version of Jackson? What are you trying to serialize?

http://stackoverflow.com/q/25642911
accepted answer: http://stackoverflow.com/a/25656469
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25656469
has comment: http://stackoverflow.com/comment/40066547
has title: How to clear content of java.security.Key?
favorite count: 0
type: Question
has body: when you use sensitive data in Java application, it is often advised to your primitive types - e.g. use char[] instead of String ... But with cryptography keys we generally need to use java.security.Key objects because that's what JCE providers use. Key is very often very sensitive piece of information and we'd like to be able to minimize the window of possible attack - i.e. create Key object as late as possible , do the encryption/decryption/signing and then as soon as possible clear the object. But Key doesn't provide any method which would facilite this clearing. Currently we're doing it in a way that we keep the key in byte array and initialize the Key object right before using it, Key immediately falls out of scope to be eligible for garbage collection and we also immediately clear the byte array. But this doesn't seem very elegant ... It also fills creates a dichotomy in our interfaces - some accept byte array, some accept Key objects and it's kind of a mess. I am aware of the fact that Java doesn't provide any general mechanism to clear objects from memory, but I'm asking if there is something specifically for Keys. Alternatively, is there some other approach to minimize attack window for Keys? Thanks.
has comment: http://stackoverflow.com/comment/40067642
upvote count: 5
tagged with: cryptography
tagged with: security
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40067100
score: 5
linked to: http://stackoverflow.com/q/15800755
tagged with: java

http://stackoverflow.com/q/25682398
has comment: http://stackoverflow.com/comment/40140592
has comment: http://stackoverflow.com/comment/40138284
has comment: http://stackoverflow.com/comment/40183682
has title: How to reduce the number of threads used by the jvm
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25706865
tagged with: java
answer count: 1
score: 6
upvote count: 7
has comment: http://stackoverflow.com/comment/40184180
has comment: http://stackoverflow.com/comment/40139029
has comment: http://stackoverflow.com/comment/40138249
downvote count: 1
tagged with: jvm
has body: I'm running a single threaded Java app on the following java version: java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode) with the -XX:+UseSerialGC option enabled. Still when I start the application I see multiple threads starting when monitoring the system with htop. I'd like to reduce the number of processes started as much as possible since I have a use case which involves running multiple instances of this application and this will hit the roof of the maximum allowed number of process on the system that I'm running on. Are there any other jvm options other than -XX:+UseSerialGC that I could use to reduce the number of threads starting?
accepted answer: http://stackoverflow.com/a/25706865
favorite count: 0
type: Question

http://stackoverflow.com/a/25673066
accepted answer of: http://stackoverflow.com/q/25610378
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25610378
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40139496
score: 4
has comment: http://stackoverflow.com/comment/40139443
has body: The closest thing I can think of is to define a custom command that expands to an inline dot graph, i.e. class MainClass { public class A { String COLUMN_ID = "id_a"; } /** * @dotlinkbetween{A,B} * @cond **/ @OrAnotationToDrawLink(A.class) /** @endcond */ public class B { String COLUMN_ID = "id_b"; String COLUMN_FOREIGN_KEY_TO_A = "id_a_key"; } } with the following ALIAS definition in doxygen's configuration file: ALIASES = dotlinkbetween{2}="@dot digraph { node [shape=record ]; \1 [ URL=\"\ref \1\" ]; \2 [ URL=\"\ref \2\" ]; \2 -&gt; \1; } @enddot" note that I had to use @cond ... @endcond to let doxygen skip the @OrAnotationToDrawLink line.

http://stackoverflow.com/a/25566149
accepted answer of: http://stackoverflow.com/q/25565940
type: Answer
answers question: http://stackoverflow.com/q/25565940
has body: I think that the problem is that your properties are contradictory. You are setting the SMTP port to 587, which (according to this page) is the server port for SMTP over TLS. But then you are setting mail.smtp.starttls.enable to false. Naturally the Google SMTP server is confused ... and it tells you that it was expecting the client to send a STARTTLS command. Solutions: Change the mail.smtp.starttls.enable property to true. Alternatively, change the mail.smtp.port property to 465 (the SSL port) You don't have the option of using "vanilla" SMTP ... which is a good thing if you care about securing your email traffic. According to this resource, you also need to enable authentication. (The page has extensive Java example code ...)
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/40172487
has text: You know if i can combine executor service with assync task?
comment on: http://stackoverflow.com/a/25700980
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40129356
comment on: http://stackoverflow.com/q/25677479
type: Comment
type: QuestionComment
score: 5
has text: Learn about how the Swing layout managers work and you'll see why your button fills the screen. To get the link, hover over the swing tag I've added to your question and click on "info" and then the layout manager tutorial. Note that JFrame contentPanes use BorderLayout. You may want to read on GridLayout, and you may wish to get rid of those useless calls to `setLocation(...)`. They're not going to help you, and right now are only fooling you into thinking that they're doing something when they're not, and are not even needed.

http://stackoverflow.com/comment/39933400
comment on: http://stackoverflow.com/q/25569882
score: 0
has text: the class name you try to load should be the fully qualified class name i.e.`com.sun.activation.viewers.ImageViewer` instead of your `className`-value. Furthermore, it can be necessary to provide the application-classloader in the `newInstance(URL[], ClassLoader)`-method else certain classes not loaded by this classloader might throw exceptions as their byte-definitons are unknown to this classloader
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40094338
comment on: http://stackoverflow.com/q/25624669
type: Comment
type: QuestionComment
score: 0
has text: No, They didnt specify any @robert

http://stackoverflow.com/q/25589694
has comment: http://stackoverflow.com/comment/39971602
has body: I am using spring framework 3.2 with hibernate 4 , I get the above exception when sending a request after a long idle time on the local server ( apache-tomcat v7.0 ) and the database is located on remote server. After hours of search I came to that the problem comes from the connection pool. I tried number of connection pools but didn't find the satisfying solution. bellow is the current datasource on my spring-data file MinLimit:70 MaxLimit:200 InitialLimit:20 ConnectionWaitTimeout:120 InactivityTimeout:180 ValidateConnection:true please advise.
has title: java.sql.SQLException: Invalid or Stale Connection found in the Connection Cache
answer count: 3
tagged with: java
tagged with: hibernate
favorite count: 0
accepted answer: http://stackoverflow.com/a/25898312
type: Question
has answer: http://stackoverflow.com/a/25898312
possible better answer: http://stackoverflow.com/a/25590840
downvote count: 0
has comment: http://stackoverflow.com/comment/39971412
score: 4
has answer: http://stackoverflow.com/a/25590840
upvote count: 4
type: AnsweredQuestion
tagged with: connection-pooling
has answer: http://stackoverflow.com/a/32000848

http://stackoverflow.com/a/25628743
has comment: http://stackoverflow.com/comment/40041725
answers question: http://stackoverflow.com/q/25628317
has comment: http://stackoverflow.com/comment/40042298
has comment: http://stackoverflow.com/comment/40041974
has comment: http://stackoverflow.com/comment/40042619
has comment: http://stackoverflow.com/comment/52042818
has comment: http://stackoverflow.com/comment/40041588
downvote count: 0
upvote count: 1
has body: Yes, you need to pass a SynonymMap to the SynonymFilter. Sounds like you want to populate it from a file, so you'll likely want to use SolrSynonymParser to generate it. Along the lines of: SolrSynonymParser parser = new SolrSynonymParser(true, false, analyzer); Reader synonymFileReader = new FileRader(new File(path)); parser.add(synonymFileReader); SynonymMap map = parser.build(); // SolrSynonymParser extends SynonymMap.Builder
score: 1
has comment: http://stackoverflow.com/comment/40042438
type: Answer
has comment: http://stackoverflow.com/comment/40042035

http://stackoverflow.com/comment/40036448
has text: @Joey: Sorry,I am not getting it.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25625694
type: Comment

http://stackoverflow.com/comment/40057662
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25636562
has text: I suggest using a project management tool like maven to care about the cp, compiling and uberjar.
type: Comment

http://stackoverflow.com/comment/40172768
has text: and does do (block of code) while yesno = yes just say to keep looping that section as long as they answer?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25696906

http://stackoverflow.com/a/25597864
accepted answer of: http://stackoverflow.com/q/25597589
type: AcceptedAnswer
downvote count: 0
has body: program files - has space in it you need to put the entire path in double quotes
upvote count: 2
has comment: http://stackoverflow.com/comment/39985097
type: Answer
answers question: http://stackoverflow.com/q/25597589
score: 2

http://stackoverflow.com/comment/40028625
score: 0
has text: If I create the JTree after creating all nodes for the tree then it takes too much time. like 5 munites. I want to create it dynamically. When some one will click on C:\ then only it will add all directories and files under C:\ dynamically.
type: Comment
comment on: http://stackoverflow.com/q/25621835
type: QuestionComment

http://stackoverflow.com/q/25667914
has comment: http://stackoverflow.com/comment/40112801
linked to: http://stackoverflow.com/q/14077721
downvote count: 0
has answer: http://stackoverflow.com/a/25668361
has comment: http://stackoverflow.com/comment/40112275
upvote count: 21
favorite count: 0
has title: How to set Integer parameter as null in Hibernate query?
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40112938
has comment: http://stackoverflow.com/comment/40112733
score: 21
has body: I've got an entity: @Entity @Table(name = "smsc.security_users") public class User { @Id @Column(name = "id") private int id; @Column(name = "username") private String username; @Column(name = "password") private String password; @Column(name = "enabled") private int enabled; @Column(name = "master_id", nullable = true) private Integer master_id; @Temporal(TemporalType.TIMESTAMP) @Column(name = "passwordExpiration") private Date passwordExpiration; public String getUsername() { return username; } ... I'm talking about master_id. And this is my DAO method: public void add(String userName, String password, Integer master_id) { Session session = null; session = this.sessionFactory.getCurrentSession(); Query query = session .createSQLQuery( "INSERT INTO smsc.security_users(id,username,password,enabled,passwordExpiration,master_id) VALUES(smsc.SeqDictID.nextval+1,:userName,:password,1,:passwordExpiration,:master_id)") .setString("userName", userName) .setString("password", Sha1.getHash(password)) .setTimestamp("passwordExpiration", DateUtil.getTomorrow()) .setInteger("master_id", master_id); int updated = query.executeUpdate(); } Log says: Request processing failed; nested exception is java.lang.NullPointerException and puts pointer at this line: .setInteger("master_id", master_id); master_id must be null sometimes. So how can I set null?
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40113053
has comment: http://stackoverflow.com/comment/40112584
linked to: http://stackoverflow.com/q/2123438
possible better answer: http://stackoverflow.com/a/32457742
has comment: http://stackoverflow.com/comment/40112140
has answer: http://stackoverflow.com/a/32457742
has comment: http://stackoverflow.com/comment/40112678
answer count: 2
accepted answer: http://stackoverflow.com/a/25668361

http://stackoverflow.com/a/74394504
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25589152
has body: add this in your gradle file implementation 'org.springframework.boot:spring-boot-starter-web'
score: 1
type: Answer

http://stackoverflow.com/comment/41805646
comment on: http://stackoverflow.com/q/25709538
score: 0
has text: @MartijnRiemers, done. Let me know if you need me to expand it more in order to be accepted
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25578304
tagged with: liquidfun
has title: Jbox2d LiquidFun particle speed
has body: Using JBox2D with LiquidFun my water particles are functioning fine with the exception that they travel at very slow velocities. I can't seem to find a way to get the particles to fall faster. Any ideas?
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
tagged with: jbox2d
type: Question
has answer: http://stackoverflow.com/a/25629214
accepted answer: http://stackoverflow.com/a/25629214

http://stackoverflow.com/comment/40171392
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25700505
has text: Where should i type this?

http://stackoverflow.com/comment/39996670
comment on: http://stackoverflow.com/q/25604094
type: Comment
has text: [Increase Tomcat memory settings][1] [1]: http://stackoverflow.com/questions/12688778/increase-tomcat-memory-settings
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39901308
has text: Bypass JPA entirely and add an interceptor on the actual database connection pool? I only know how to do this in Tomcat jdbc.pool, but one would hope Glassfish has a way.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25553048

http://stackoverflow.com/a/25569045
has comment: http://stackoverflow.com/comment/39967133
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25557263
answers question: http://stackoverflow.com/q/25557263
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: I fixed this by starting the whole project from scratch. I think the issue was with my MainActivity.java. In my new project I used Login.java as my main activity and it worked perfect. All that's changed is the name of my Main Activity which is now LoginActivity.java and inside this is the exact same code as my old Login.java class. I would love to know what the actual issue was, but it's working now. Thanks for the help guys. My new code for my main activity: LoginActivity.java import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class LoginActivity extends Activity implements OnClickListener { private EditText user, pass; private Button mSubmit, mRegister; private ProgressDialog pDialog; JSONParser jsonParser = new JSONParser(); private static final String LOGIN_URL = "http://***.***.*.**.****/tappedin/login.php"; private static final String TAG_SUCCESS = "success"; private static final String TAG_MESSAGE = "message"; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); user = (EditText)findViewById(R.id.username); pass = (EditText)findViewById(R.id.password); mSubmit = (Button)findViewById(R.id.butLogin); mRegister = (Button)findViewById(R.id.butRegister); mSubmit.setOnClickListener(this); mRegister.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.butLogin: new AttemptLogin().execut…

http://stackoverflow.com/comment/40067346
comment on: http://stackoverflow.com/a/25634818
has text: OK figured out what I did wrong. Now it deadlocks on read. However I can't understand why it does not throw Exception instead of deadlocking. See updated question
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25643500
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: No composite element cannot contain collection. But component can. Let me try to explain it this way: the first cite is about element, while the second is about Both of them allow us to map Value Type objects (as opposite to Reference Type) - as discussed in a detail here: Understading the restrictions for collection of dependent objects in hibernate So, where is the difference? Why the first ( ) can contain collections, while the second ( ) cannot? Simplified answer would be: Because the is mapping of the collection item already. The on the other hand, is a mapping on the root - level. The full and better answer would be: both types do not have their ID, their KEY in relational DB structure. That's why they are treated as Value Types - they cannot be referenced. The is in relation one-to-one with its root - it has access to the root/class ID. Therefore it could path to collection <key column=""> the root id. The does not have access to its ID/Key (does not exist at all) and is not on the same level as . There is no place to cheat as we did with component So, while we could see mapping like this <id ... ... <parent name="namedPerson"/> //reference back to the Person <property name="initial"/> <property name="first"/> <property name="last"/> // here we go // collection mapped inside of the <key column="person"/> <element column="name" type="date"/> With a we would end up with a collection item mapping: .... <key column="order_id"> <property name="purchaseDate"/> <property name="price"/> <property name="quantity"/> <many-to-one name="item" class="eg.Item"/> // this is already component // but without ID to be used // as a reference on the other side of bidirectional relation Summary, both mappings try to provide similar functionality. They do have different names, because they are used in different scenarios. We can imagine that even collection for could be working, if we ... and stop here. If we need that, do not use components. Use full mapping.
has comment: http://stackoverflow.com/comment/40067728
answers question: http://stackoverflow.com/q/25636708
accepted answer of: http://stackoverflow.com/q/25636708

http://stackoverflow.com/q/25645812
answer count: 2
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40076131
has title: Why wont hibernate config file parse
has comment: http://stackoverflow.com/comment/40072022
has comment: http://stackoverflow.com/comment/40075287
has comment: http://stackoverflow.com/comment/40072581
has answer: http://stackoverflow.com/a/25646314
type: Question
has comment: http://stackoverflow.com/comment/40072141
has comment: http://stackoverflow.com/comment/40071902
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25646299
has comment: http://stackoverflow.com/comment/40072948
has body: I am building my first hibernate application on eclipse and reads in a set of SFTP credentials from an Oracle table because I want to make them configurable and not hard code them. But when I attempt to run the application it will not parse the hibernate.cfg.xml file. I have tried typing in all the config file and not cut and paste and I have tried changing www.hibernate.org/dtd/hibernate-configuration-3.0.dtd in the config file to http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd. Why won't this work? Here is the console output; log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1491) at org.hibernate.cfg.Configuration.configure(Configuration.java:1425) at name.of.package.used.retrieve.main(retrieve.java:14) Caused by: org.dom4j.DocumentException: Connection refused: connect Nested exception: Connection refused: connect at org.dom4j.io.SAXReader.read(SAXReader.java:484) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1481) ... 2 more Here is the mapping file; <?xml version="1.0"?> <generator class="assigned" /> This is the hibernate.cfg.xml file; <?xml version='1.0' encoding='UTF-8'?> <hibernate-configuration> org.hibernate.dialect.Oracle9Dialect jdbc:oracle:thin:@hostname:1523:TRNG username password oracle.jdbc.driver.OracleDriver <mapping resource="sftpcreds.hbm.xml"/> </hibernate-configuration> My main Java file that I am running the application is; package name.of.package.used; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.hibernate.mapping.List; import org.apache.log4j.Logger; public class retrieve { public static void main(String args[]…
score: 0

http://stackoverflow.com/comment/40124986
type: Comment
comment on: http://stackoverflow.com/q/25674947
score: 0
type: QuestionComment
has text: I can't belive that JViewport can have such limitation. I've developed a table with a million rows and it could be scrolled very fine. Please provide a working example for better help.

http://stackoverflow.com/comment/39910706
has text: Wow, Wow, Wow, did you bother searching this beforehand?
comment on: http://stackoverflow.com/q/25557746
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25660240
has title: How can I easily customize the XML input files of the Curriculum Course example of OptaPlanner?
type: Question
downvote count: 0
tagged with: input
upvote count: 1
type: UnansweredQuestion
score: 1
answer count: 1
has body: I'm quite a beginner for not only OptaPlanner but also Java, which I started to learn two weeks ago. I am considering to start with modifying an example accompanied with the source program to make a scheduler for my present project. Target The XML input file of the “Curriculum Course” example of RedHat OptaPlanner Question Is there any easy way to modify the XML input files or add customized ones? Example data Original XML: optaplanner-examples/data/curriculumcourse/unsolved/comp01.xml ... q000 ... ... ... The problem is that I have to renumber all the ID numbers every time I change the length of any lists. In the “Curriculum Course” example, I can find the corresponding .ctt files that are easy to change using a common text editor. The following is input data that I want to create expressed in the .ctt format: .ctt modified from: optaplanner-examples/data/curriculumcourse/import/comp01.ctt Name: Test01 Courses: 3 Rooms: 3 Days: 5 Periods_per_day: 13 Curricula: 3 Constraints: 0 COURSES: c0001 t000 5 99 1 c0002 t001 5 99 1 c0003 t002 5 99 1 ROOMS: P01 999 P02 999 P03 999 CURRICULA: q001 1 c0001 q002 1 c0002 q003 1 c0003 UNAVAILABILITY_CONSTRAINTS: END. I wonder some tools could convert this text data into the XML files specific to the “Curriculum Course” example.
has comment: http://stackoverflow.com/comment/40098575
has comment: http://stackoverflow.com/comment/40128264
has answer: http://stackoverflow.com/a/26543741
tagged with: java
tagged with: optaplanner
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0

http://stackoverflow.com/comment/40372937
comment on: http://stackoverflow.com/q/25690217
type: Comment
score: 1
has text: Your camparison and storage of the user seems fishy. You might endup adding the company to another user while the old user is still part of the old Company. This is due to the fact you are working with detached instances and maybe attached instances. That might introduce problems.
type: QuestionComment

http://stackoverflow.com/comment/40100436
type: AnswerComment
score: 1
type: Comment
has text: I agree, you should always use AsyncTask for long running tasks, since it was made for things like this.
comment on: http://stackoverflow.com/a/25661434

google-oauth
type: Tag
tag name: google-oauth
tags question: http://stackoverflow.com/q/25648760
tags question: http://stackoverflow.com/q/25667245

http://stackoverflow.com/comment/40188512
type: AnswerComment
has text: It might be wise to suggest using a library which offers immutable date objects over the default dates in Java - I'm sure I don't have to convince _you_ why it might be beneficial but your erm.. 'conflict of interest' in suggesting a library that gives you immutable date objects as a solution for dates shouldn't prevent you from mentioning it here in my opinion - after the bigger answer for the bigger question of course.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25704382

http://stackoverflow.com/q/25705252
answer count: 3
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/25708059
has answer: http://stackoverflow.com/a/25707068
upvote count: 1
has answer: http://stackoverflow.com/a/25705329
favorite count: 0
type: Question
has title: How to resolve R.string error “cannot be resolved or is not a field”
tagged with: android
tagged with: java
score: -1
tagged with: google-play-services
has body: Errors in lines: 236 239 and 250 I'm not managing to solve this problem is with the string R R.string the function I did not find it. I would like to know some tips and how to solve estre problem. I already tried putting the string function that takes the enforce play services and not get too package com.xxx.xxxx; import Configuration.Configuration; import android.content.Intent; import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.view.Window; import android.view.WindowManager; import android.widget.FrameLayout; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.gikdew.swingcopters.ActionResolver; import com.gikdew.swingcopters.SwingCopters; import com.google.android.gms.ads.AdListener; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdSize; import com.google.android.gms.ads.AdView; import com.google.android.gms.ads.InterstitialAd; import com.google.android.gms.games.Games; import com.google.example.games.basegameutils.GameHelper; import com.google.example.games.basegameutils.GameHelper.GameHelperListener; public class AndroidLauncher extends AndroidApplication implements ActionResolver, GameHelperListener { private static final String AD_UNIT_ID_BANNER = Configuration.AD_UNIT_ID_BANNER; private static final String AD_UNIT_ID_INTERSTITIAL = Configuration.AD_UNIT_ID_INTERSTITIAL; private static String GOOGLE_PLAY_URL = "https://play.google.com/store/apps/developer?id="; protected AdView adView; protected View gameView; private InterstitialAd interstitialAd; private GameHelper _gameHelper; private final static int REQUEST_CODE_UNUSED = 9002; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration cfg = ne…

http://stackoverflow.com/q/25589906
has answer: http://stackoverflow.com/a/25589926
has answer: http://stackoverflow.com/a/25589946
accepted answer: http://stackoverflow.com/a/25589946
answer count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/25590014
favorite count: 0
has answer: http://stackoverflow.com/a/25590014
downvote count: 4
type: Question
upvote count: 2
has title: Translating a ternary operation to an if/else statement?
score: -2
has comment: http://stackoverflow.com/comment/39970212
has body: I have the following boolean method in Java, but I can't understand its return statement because it uses a ternary operation. Can anyone rewrite it to an if/else statement so that I can better understand what the ternary operation is doing? public boolean collidesWith(Rectangle object){ return (isDestroyed)? false:hitbox.intersects(object); }
has comment: http://stackoverflow.com/comment/39970423
type: AnsweredQuestion

http://stackoverflow.com/q/25589180
tagged with: java
tagged with: hibernate
downvote count: 0
answer count: 1
has title: hibernate : org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: no session or session was closed
has comment: http://stackoverflow.com/comment/39969004
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: session
has body: I'm learn to hibernate. But I'm stuck in a very basic point. When the source of the following Controller : data collection and ready to display Service : Transaction processing Dao : access Database And processing data in such a form. Test.java @Entity @Table ( name = "table_test" ) public class Test { @Id @GeneratedValue ( strategy = GenerationType.AUTO ) public long id; @OneToMany(fetch=FetchType.LAZY) @JoinColumn(name="test_id") @IndexColumn(name="orderBy") public List&lt;TestItem&gt; items; } TestItem.java @Entity @Table ( name = "table_item" ) public class TestItem { @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="test_id", insertable=false, updatable=false) public Test parent; @Id @GeneratedValue ( strategy = GenerationType.AUTO ) public long id; } TestDao.java @Repository public class TestDao { @Autowired SessionFactory sessionFactory; protected Session getSession(){ return sessionFactory.getCurrentSession(); } public Test get(long id){ return (Test) getSession().createCriteria( Test.class ) .add( Restrictions.eq( "id", id ) ).uniqueResult(); } } TestService.java @Service @Transactional public class TestService { @Autowired TestDao testd; public Test get(long id){ return testd.get( id ); } public List&lt;TestItem&gt; getItems(Test test){ List&lt;TestItem&gt; items = test.items; items.iterator(); return items; } } TestController.java @Controller @RequestMapping ( "/test" ) public class TestController extends BaseController { @Autowired TestService testService; @RequestMapping ( "/{id}" ) public String seriesList ( @PathVariable long id, Model model ) { Test test = testService.get( id ); //something... List&lt;TestItem&gt; lists = testService.getItems( test ); for(TestItem item : lists) { Model.addAttribute(item.id); } return "index"; } } EXCEPTION org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.test.domain.Test.items, no session or session was closed org.hibernate.collection.AbstractPersistentCollection.throw…
tagged with: spring
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/25589338

http://stackoverflow.com/q/25569372
type: AnsweredQuestion
has body: // I m using template.setFetchSize(100); again n again every daoImpl. how to use this in property file and use JdbcTemplate template = new JdbcTemplate(dataSource); String sql = ""; // process 100 rows at a time to minimize memory consumption template.setFetchSize(100); template.query(sql, new RowCallbackHandler() { public void processRow(ResultSet rs) throws SQLException { });
tagged with: sql
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25569592
has answer: http://stackoverflow.com/a/25569592
has title: how to use property file using jdbc template
downvote count: 1
tagged with: jdbctemplate
favorite count: 0
type: Question
upvote count: 0
score: -1
tagged with: dao
tagged with: spring-mvc

http://stackoverflow.com/q/25666506
tagged with: intellij-idea
tagged with: maven
has title: IntelliJ imports project from POM using wrong JDK version
favorite count: 0
type: Question
upvote count: 9
has answer: http://stackoverflow.com/a/58712382
tagged with: android
linked to: http://stackoverflow.com/q/12900373
tagged with: java
has answer: http://stackoverflow.com/a/32245427
score: 9
has body: We have a Maven based Android build, and we just made the switch from JDK 6 to 7. This came with its share of IntelliJ problems though. What happens is that every time it detects a change in the POM, and reimports/refreshes the project, it returns to selecting the old "Module SDK", the one that's configured to use Java 6: Even if I manually delete these SDKs from the "Platform Settings" dialog, they keep reappearing as "Maven Android API 19 Platform (N)" where N is the number used to disambiguate it from all the other (identical) SDKs. I should mention that we do specify in the POM that Java 7 is targeted. I tried to set both the compiler plugin language level, and the maven.compiler.* properties (not sure if that accomplishes the same thing or not), without luck: org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 shouldn't IntelliJ pick that up and always configure the project to use a Java 7 SDK? Am I missing something? I noticed that the problem disappears when I remove any references to 1.6 SDKs entirely in IntelliJ. Not surprising I guess, but also not viable since I have other projects that still rely on the presence of a Java 6 SDK.
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/25666547
linked to: http://stackoverflow.com/q/27037657
type: UnansweredQuestion

http://stackoverflow.com/a/25686737
type: Answer
answers question: http://stackoverflow.com/q/25611412
accepted answer of: http://stackoverflow.com/q/25611412
type: AcceptedAnswer
downvote count: 0
upvote count: 1
score: 1
has body: Mouse.getEventDWheel() gets the delta for the mouse wheel movement. Even if you don't touch the wheel it will report small changes. An easy way to solve this is to use a 'deadband', a region where the changes are not accepted. mouseWheelState = Mouse.getEventDWheel(); if(Math.abs(mouseWheelState)&lt;deadbandWidth) { mouseWheelState = 0; } mouseWheelState /= 120;

http://stackoverflow.com/a/25654592
score: 0
type: Answer
has body: I would have Guice implement some kind of internal factory interface, then expose something else. Like this: interface InternalFactory { Data load(@Nullable Path path); } public interface Factory { Data load(); Data load(@Nullable Path path); } class FactoryImpl implements Factory { @Inject InternalFactory internalFactory; @Override public Data load() { return load(null); // Pass your defaults here } @Override public Data load(@Nullable Path path) { // Sadly you'll have to explicitly forward arguments here, but it's not // too bad IMO return internalFactory.load(path); } } public class MyModule extends AbstractModule { @Override protected void configure() { install(new FactoryModuleBuilder() .implement(Data.class, SimpleData.class) .build(InternalFactory.class)); bind(Factory).to(FactoryImpl.class); } }
has comment: http://stackoverflow.com/comment/40243054
answers question: http://stackoverflow.com/q/25642021

http://stackoverflow.com/a/25586339
has body: I got it working by removing the following lines from web.xml (see above): default /static/* I reported this as a "bug" to the author of JavaMelody. Not sure if it actually is one. https://groups.google.com/forum/#!topic/javamelody/fRPJ7q1KzbA
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25568767
accepted answer of: http://stackoverflow.com/q/25568767
type: Answer

http://stackoverflow.com/a/25665128
answers question: http://stackoverflow.com/q/25664891
type: Answer
upvote count: 3
downvote count: 0
has body: You can count number of active sessions using the code below public class SessionCounter implements HttpSessionListener { private static int activeSessions = 0; public void sessionCreated(HttpSessionEvent se) { activeSessions++; } public void sessionDestroyed(HttpSessionEvent se) { if(activeSessions &gt; 0) activeSessions--; } public static int getActiveSessions() { return activeSessions; } } This way you can limit the sessions. Ex: if active session are 20, don't create any more
score: 3

http://stackoverflow.com/comment/40187730
score: 3
type: Comment
type: QuestionComment
has text: What exactly is your question?
comment on: http://stackoverflow.com/q/25709385

http://stackoverflow.com/a/25555297
type: Answer
has comment: http://stackoverflow.com/comment/39906823
score: 0
has comment: http://stackoverflow.com/comment/39905979
has body: Edited Code Try this Code!! ArrayList&lt;Boolean&gt; alDone= new ArrayList&lt;Boolean&gt;(); public View getView(final int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final ViewHolder holder; if (convertView == null) { convertView = inflater.inflate(R.layout.drawer_list_item, null); holder = new ViewHolder(); holder.title = (TextView) convertView.findViewById(R.id.title); holder.store_image = (ImageView) convertView.findViewById(R.id.store_image); convertView.setTag(holder); } else{ holder = (ViewHolder) convertView.getTag(); } holder.title.setText(stores[position]); if(position==0){ if(!alDone.get(position)){ Picasso.with(context).load(R.drawable.first).into(holder.store_image); alDone.add(true,position) } } return convertView; }
answers question: http://stackoverflow.com/q/25555189
has comment: http://stackoverflow.com/comment/39905437

http://stackoverflow.com/comment/40177083
type: Comment
comment on: http://stackoverflow.com/q/25703534
type: QuestionComment
score: 0
has text: Did you change the reference to the scripts in the jsp pages? Was it working before your changes?

http://stackoverflow.com/comment/40152157
type: AnswerComment
score: 0
has text: @geonad, What do you mean when you say "that method needs to be called from outside the class" ? Both the methods are part of the same class.
type: Comment
comment on: http://stackoverflow.com/a/25688088

http://stackoverflow.com/comment/39988777
type: Comment
has text: @askManiac In linux you generally find hdparm in /sbin/hdparm so you can try to change it in your query variable. Also refer to [this article](http://www.javaworld.com/article/2071275/core-java/when-runtime-exec---won-t.html) to troubleshoot Runtime.exec() problems.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25599648

http://stackoverflow.com/comment/40182083
score: 0
has text: @BirgitMartinelle yes. I get till this point "Im running workerID " + workerID, but its not executing the following GetReponse function also the run() method is a continuos loop (I keep getting Im running workerID...)
comment on: http://stackoverflow.com/q/25706044
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25589358
has comment: http://stackoverflow.com/comment/39970540
has comment: http://stackoverflow.com/comment/39970353
has comment: http://stackoverflow.com/comment/39973247
has comment: http://stackoverflow.com/comment/39970501
has body: With Jackson you could define a custom deserializer (see this and this) that fetches the Organization entity based on the value of organization_id. Edit: Check this example for how to configure JAX-RS using Jackson with a custom deserializer programmatically (as opposed to via annotations): @Provider @Produces(MediaType.APPLICATION_JSON) public class JacksonContextResolver implements ContextResolver&lt;ObjectMapper&gt; { private ObjectMapper objectMapper; public JacksonContextResolver() throws Exception { this.objectMapper = new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); SimpleModule myModule = new SimpleModule("MyModule", new Version(1, 0, 0, null)); myModule.addDeserializer(MyType.class, new MyTypeDeserializer()); objectMapper.registerModule(myModule); } public ObjectMapper getContext(Class&lt;?&gt; objectType) { return objectMapper; } }
type: Answer
answers question: http://stackoverflow.com/q/25586687
score: 0

http://stackoverflow.com/comment/40170330
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25699790
type: Comment
has text: http://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-j2ee-concepts-connection-pooling.html

http://stackoverflow.com/comment/40182964
score: 0
type: Comment
type: QuestionComment
has text: Or this [example](http://stackoverflow.com/a/18691662/230513) using `Color.getHSBColor()`.
comment on: http://stackoverflow.com/q/25703945

http://stackoverflow.com/a/25682865
type: Answer
has body: You are not overriding Object.hashCode, you're implementing your own hashcode() method (mind the capitalized C). A good practice is to always use @Override annotations when overriding. See: When do you use Java's @Override annotation and why?
has comment: http://stackoverflow.com/comment/40138914
score: 11
has comment: http://stackoverflow.com/comment/40138954
upvote count: 11
has comment: http://stackoverflow.com/comment/40138951
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25682833
has comment: http://stackoverflow.com/comment/40138927
accepted answer of: http://stackoverflow.com/q/25682833

http://stackoverflow.com/a/25706851
has body: Two inputs from my side here. 1)You are probably using the wrong collection interface for your purpose here. If you need to prevent duplicates you might be better off using a Set eg. HashSet or TreeSet. 2)As you have been told, you will need to override equals method in PessoaFisica and implement your own identity check, while you are at it do not forget to override hashCode() method. There is a contract between equals and hashCode. Two equal objects must have equal hashCodes.Most IDEs will generate this code for you, in idea go to Code->Generate->HashCode And Equals. It will ask you the fields to include and auto generate the two methods.
answers question: http://stackoverflow.com/q/25706655
score: 1
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/25597589
has answer: http://stackoverflow.com/a/25597864
score: -1
tagged with: command-line
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25597864
upvote count: 0
tagged with: java
answer count: 1
tagged with: jar
tagged with: shell
has body: I have C:\Program Files\Java\jdk1.8.0_20\bin\jar.exe D:\ounce\advanced\bank.zip Currently, my command shell is at D:\ounce\advanced&gt; When I use this command: C:\Program Files\Java\jdk1.8.0_20\bin\jar xf D:\ounce\advanced\bank.zip to extract bank.zip, I get "illegal option: F" The same thing happens when I replace D:\ounce\advanced\bank.zip with just bank.zip I'm trying to do it the hard way without using environment variables. How can I do this right? Thank you for your help.
downvote count: 1
favorite count: 0
type: Question
has title: How to specify the directory of archive to be extracted using jar command?

http://stackoverflow.com/comment/40067612
type: Comment
has text: I had tried to change the dependencies to 3.1.3.RELEASE but that generated an error in my pom.xml. can i change this <spring.version>3.1.3.RELEASE</spring.version> to <spring.version>4.0.2.RELEASE</spring.version>
comment on: http://stackoverflow.com/a/25642904
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39924266
comment on: http://stackoverflow.com/q/25565171
type: Comment
type: QuestionComment
score: 1
has text: Seems like a [XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem).

http://stackoverflow.com/comment/40156276
has text: It means that if I have: eggs 1 7.00, milk 1 1.99, eggs 2 2.50 then the program should print back that eggs had the largest average cost item: ie (7+5)/ 3 = 4
comment on: http://stackoverflow.com/q/25691374
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25593717
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: cas
has answer: http://stackoverflow.com/a/59079632
tagged with: servlets
answer count: 2
has body: I am trying to implement CAS Single Sign Out using Java Servlet and filter mapping in web.xml. The Filter in web.xml is something like this. CAS Single Sign Out Filter org.jasig.cas.client.session.SingleSignOutFilter org.jasig.cas.client.session.SingleSignOutHttpSessionListener CAS Single Sign Out Filter /out And on '/out' url pattern, calling the java servlet which consists of session.invalidate() method and after that redirecting the cas/logout/. But still i am not able to logout properly. This is my Log: DEBUG [http-bio-8080-exec-10] (HashMapBackedSessionMappingStorage.java:46) - Attempting to remove Session=[] DEBUG [http-bio-8080-exec-10] (HashMapBackedSessionMappingStorage.java:55) - No mapping for session found. Ignoring. Please help. Thanks in advance.
downvote count: 0
has answer: http://stackoverflow.com/a/25593917
upvote count: 1
favorite count: 0
tagged with: jasig
type: Question
tagged with: web.xml
has title: CAS Server Single Sign Out using Java Servlet

http://stackoverflow.com/comment/40006619
type: QuestionComment
has text: show your code and the query used
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25609856

http://stackoverflow.com/comment/40160389
has text: What you said, nothing more nothing less, both are almost the same (except the byte on the stack because of the variable), one could be more readable (depends, if (this.hasBeenAnswered()) is quite readable without a variable name) the other is for sure shorter.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25694235
type: Comment

http://stackoverflow.com/q/25708749
accepted answer: http://stackoverflow.com/a/25708859
tagged with: java
has answer: http://stackoverflow.com/a/25708859
tagged with: annotations
answer count: 1
downvote count: 0
score: 1
upvote count: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/13070260
has title: @SuppressWarnings annotation on Application Level
has body: I was reading this question, where @SuppressWarnings annotation is used on class level. Suppose I have multiple classes in my application, so is there a way that I can use @SuppressWarnings on application level? As applying @SuppressWarnings on every class is redundant for me.
type: AnsweredQuestion

http://stackoverflow.com/comment/40175685
type: QuestionComment
has text: Yes i would like to display them using Print
score: 0
comment on: http://stackoverflow.com/q/25702593
type: Comment

http://stackoverflow.com/a/25572820
score: 4
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25572615
has body: you can return void, then you have to mark the method with @ResponseStatus(value = HttpStatus.OK) you don't need @ResponseBody @RequestMapping(value = "/updateSomeData" method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) public void defaultMethod(...) { ... } Only get methods return a 200 status code implicity, all others you have do one of three things: Return void and mark the method with @ResponseStatus(value = HttpStatus.OK) Return An object and mark it with @ResponseBody Return an HttpEntity instance Also refer this for interesting information.
answers question: http://stackoverflow.com/q/25572615
has comment: http://stackoverflow.com/comment/39940122
type: Answer
upvote count: 4

http://stackoverflow.com/q/25614152
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40014911
has body: I have recently switched over to AsyncTask after reading how efficent it is. It took some time porting my code, but I did it in the end. I have 1 AsyncTask that gets run first, setting up the background image/color that it gets off a json object. After that, it sets up TableRows for all the other fields in the JSON file. The background changes, but the UI does not show up. I placed System.out.println's inside my AsyncTask and I see that the code has been executed (the onPostExecute method), but none of the UI shows up. I have no idea what the problem is, hence me posting this question. Here is my AsyncTask: class GetImageAsync extends AsyncTask&lt;String, Void, Drawable&gt; { private final WeakReference&lt;View&gt; ViewReference; private String data; private Context context; private boolean isImageView; private boolean scale; private int id = -1; private int color = -1; private int height = -1; public GetImageAsync(TableLayout tr, String data, Context context) { isImageView = false; this.context = context; this.data = data; ViewReference = new WeakReference&lt;View&gt;(tr); System.out.println("inside async"); } public GetImageAsync(ImageView iv, int id, Context context) { isImageView = true; this.context = context; this.id = id; ViewReference = new WeakReference&lt;View&gt;(iv); } public GetImageAsync(ImageView imageView,String data, Context context, int height) { System.out.println("profile async"); this.height = height; isImageView = true; this.context = context; this.data = data; ViewReference = new WeakReference&lt;View&gt;(imageView); } // Decode image in background. @Override protected Drawable doInBackground(String... params) { System.out.println(id + " : " + isImageView); if(isImageView &amp;&amp; id != -1) { return getImageFromResource(); } else { if(data.startsWith("#")) { color = Color.parseColor(data); return null; } try { return getImageFromWeb(data, scale); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackT…
has comment: http://stackoverflow.com/comment/40036361
score: 0
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/40017471
type: Question
tagged with: android-asynctask
has title: UI not showing up after switching to AsyncTask

http://stackoverflow.com/a/25708192
has body: I also think that this code is not a inifinite loop. Try to set following timeout parameter: url_reader_2.setConnectTimeout(2000); Moreover if there are a lot of hits on website then it can stuck with handling so many tcp connections
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25707906

http://stackoverflow.com/comment/40040130
type: AnswerComment
has text: I declared int imageNum = 0; and used imageNum++ in the code like this, File sdImageMainDirectory = new File(root , imageNum + ".png"); But still image gets replaced, any ideas? Thanks
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25627938

http://stackoverflow.com/a/25713594
has body: You have at least one layer in the tiled map, so: TiledMap map = ......//whatever method that you are using to load a map //skip to the part that the map is loaded TiledMapLayer layer = (TiledMapLayer)map.getLayers().get(0); int layerWidth = layer.getWidth()*layer.getTileWidth(); And now, you know the layer's width in pixels, and yo can make sure that camera.position.x+Gdx.graphics.getDeltaTime()*200; never exceeds this length.
answers question: http://stackoverflow.com/q/25712384
score: 0
type: Answer

http://stackoverflow.com/comment/39994581
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25602837
type: QuestionComment
has text: But there's no problem to solve here; you've only asked for a solution. If you want help faster, you need to ask specific questions about what's wrong with the solution you had and what error messages there are (if any).

http://stackoverflow.com/a/25631585
type: Answer
downvote count: 0
upvote count: 1
has body: Form the docs(http://docs.spring.io/spring-security/site/docs/3.0.x/reference/appendix-namespace.html): default-target-url: Maps to the defaultTargetUrl property of UsernamePasswordAuthenticationFilter. If not set, the default value is "/" (the application root). A user will be taken to this URL after logging in, provided they were not asked to login while attempting to access a secured resource, when they will be taken to the originally requested URL. You have to submit the form to j_spring_security_check &lt;form name='loginForm' action="&lt;c:url value='j_spring_security_check' /&gt;" method='POST'&gt; This will be handled by Spring Security and will check the user and pass depending on your config. See this example http://www.mkyong.com/spring-security/spring-security-form-login-example/ Edit: j_security_check should also be supported.
score: 1
answers question: http://stackoverflow.com/q/25631477

http://stackoverflow.com/q/25611832
answer count: 1
accepted answer: http://stackoverflow.com/a/25611997
has title: GAE Ancestor Query Hack: is this a good practice?
type: Question
has answer: http://stackoverflow.com/a/25611997
tagged with: eventual-consistency
tagged with: google-app-engine
tagged with: python
has body: I stumbled on this feature of App Engine's Datastore that you don't actually have to have a persisted root entity to have strongly consistent behavior work with GAE. You can use a computed key to store and load child entities. My question is: Is this a good practice or does this rely too much on an implementation quirk of the Datastore? Here's an example using Python. This idiom will work with Java, too, I'm sure. Let's say you have a child entity: CustomerReport(ndb.Model): foo=ndb.StringProperty bar=ndb.FloatProperty #... CustomerReports are generated based on a real entity type, Customer. But you can save with strong consistency this report entity by computing an ancestor key for a non-existent parent entity like this: ReportRoot(ndb.Model): pass Like so: CustomerReport(parent=ndb.Key(ReportRoot, customer.key.id()), ... ).put() Which can be retrieved again by simply computing the key: CustomerReport.query(ancestor=ndb.Key(ReportRoot, customer.key.id())).fetch() Thank you.
type: AnsweredQuestion
score: 0
tagged with: entity-framework
tagged with: java

http://stackoverflow.com/q/25650726
has comment: http://stackoverflow.com/comment/40090270
score: 0
type: UnansweredQuestion
answer count: 1
has title: Generic Javafx table view
type: Question
tagged with: javafx-8
has body: I am trying to create a method in my JAVAFX controller which will show the preview of the data in table view. That table view has to be generic enough so that it can just take a list of objects and display it into the table. Here is my code. In my controller i have TableView like this @FXML private TableView dataPreviewTableView; Down below in the same controller i have a method like this public void loadScreen(Class&lt;?&gt; T){ TableColumn col; TableViewHeader headerInfo =getHeaderInfoFromTemplate(fileTemplate); List&lt;String&gt; headerNames = headerInfo.getHeaderNames(); dataPreviewTableView.getItems().clear(); for(String headerName : headerNames){ col = new TableColumn (headerName.toUpperCase()); col.prefWidthProperty().bind(dataPreviewTableView.widthProperty().divide(headerNames.size())); col.setCellValueFactory(new PropertyValueFactory&lt;**T,Integer**&gt;(headerName)); dataPreviewTableView.getColumns().add(col); } this.lblFileName.setText(fileToImport.getPath()); dataPreviewTableView.setItems(data); } The following line gives an error T cannot be resolved to a type col.setCellValueFactory(new PropertyValueFactory&lt;T,Integer&gt;(headerName));
tagged with: java
has answer: http://stackoverflow.com/a/25656697
has comment: http://stackoverflow.com/comment/40089728
linked to: http://stackoverflow.com/q/3403909
tagged with: generics

http://stackoverflow.com/a/25562470
has comment: http://stackoverflow.com/comment/39920179
has comment: http://stackoverflow.com/comment/39919116
has comment: http://stackoverflow.com/comment/39919953
has comment: http://stackoverflow.com/comment/39920221
accepted answer of: http://stackoverflow.com/q/25561873
has comment: http://stackoverflow.com/comment/39920460
downvote count: 0
has comment: http://stackoverflow.com/comment/39919328
has comment: http://stackoverflow.com/comment/39920274
has body: Will calling getClass() within the constructor ever give us problems? If so, what are some examples whereby calling getClass() within the constructor would give us errors? Using getClass() in constructor in this manner will always result in a compilation error, since this cannot be referenced before super() has been called. Main.java:17: error: cannot reference this before supertype constructor has been called super(getClass().getClassLoader()); // should not call getClass() because object ^ 1 error You can test it yourself on http://ideone.com/B0nYZ1. The Class is ready, but the instance can't be used to reference the Class yet. Still, you can use the Class reference in constructor, but you have to do it in a slightly different way: super(MyClassLoader.class.getClassLoader()) Also, you are free to use getClass() in your constructor after the supertype constructor has been called - as you already pointed out, the object is basically ready after that and the Class reference can be inferred from the instance.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25561873
upvote count: 10
score: 10
type: Answer

http://stackoverflow.com/comment/40094057
comment on: http://stackoverflow.com/a/25648660
has text: First you have to find correct url. Than make sure Android can play it natively without SW decoders which MXPlayer can use. Also you can play/stream audio or video using VLC.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39926003
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25566328
type: Comment
has text: @TheLostMind I agree

http://stackoverflow.com/q/25709538
has comment: http://stackoverflow.com/comment/40192549
has body: I'm currently in the process of writing an Http Client abstraction layer for my application so I can easily switch between Http Clients in the life cycle of my application. The issue is, all Http Clients currently out there (Apache, Ning, Spray, Ok etc..) all use very different implementations which makes my job very hard. Now my question is, are there already pre-built projects out there that I can utilize so the only thing I need to do is write the implementations? If not, what would be the best way to go about it? It might be worth mentioning that my project is entirely Actor based Akka so interfacing isn't an option. I'm not asking for written code, just a concept since I can't quite wrap my head about how I would go about doing such thing.
tagged with: akka
has comment: http://stackoverflow.com/comment/40294474
answer count: 1
has comment: http://stackoverflow.com/comment/40271308
has comment: http://stackoverflow.com/comment/41805646
has title: Http Client Abstraction Layer
tagged with: actor
has comment: http://stackoverflow.com/comment/40292153
tagged with: abstraction
has comment: http://stackoverflow.com/comment/40192285
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40192350
score: 0
has comment: http://stackoverflow.com/comment/40192521
accepted answer: http://stackoverflow.com/a/26595548
tagged with: java
has comment: http://stackoverflow.com/comment/41805349
has answer: http://stackoverflow.com/a/26595548
type: Question
has comment: http://stackoverflow.com/comment/40302729
has comment: http://stackoverflow.com/comment/40229899
tagged with: apache-httpclient-4.x

http://stackoverflow.com/comment/39959439
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25584117
score: 0
has text: http://stackoverflow.com/questions/1106102/clone-vs-copy-constructor-vs-factory-method and http://stackoverflow.com/questions/2427883/clone-vs-copy-constructor-which-is-recommended-in-java

http://stackoverflow.com/comment/40145020
comment on: http://stackoverflow.com/q/25686271
score: 0
type: Comment
type: QuestionComment
has text: That info should be in the question

http://stackoverflow.com/comment/39965181
type: QuestionComment
type: Comment
score: 0
has text: did your next activity has setContentView(R.layout.somelayout); ?
comment on: http://stackoverflow.com/q/25587202

http://stackoverflow.com/comment/39930621
comment on: http://stackoverflow.com/a/25568705
type: Comment
type: AnswerComment
score: 0
has text: Why is `synchronized(this)` is being called in `ThreadB`? Isn't only the thread itself calls run, and no other threads?

http://stackoverflow.com/comment/40175159
type: Comment
comment on: http://stackoverflow.com/q/25702260
has text: if I only see one more "java strings compare" question,I will throw my cat out of the window.
score: 0
type: QuestionComment

http://stackoverflow.com/a/25659422
has comment: http://stackoverflow.com/comment/40098010
has comment: http://stackoverflow.com/comment/40102136
answers question: http://stackoverflow.com/q/25658554
has comment: http://stackoverflow.com/comment/40101046
score: 0
has comment: http://stackoverflow.com/comment/40101824
has comment: http://stackoverflow.com/comment/40102228
type: Answer
has comment: http://stackoverflow.com/comment/40101652
has body: First, it is a little bit strange that in all your loops you are looping through itemarr2, so i do not understand why don't you have only one loop with all the logic inside. Secondly you are looping through itemarr2 and then using the current index of itemarr2 to access and assign values in other arrays. If any of this arrays has a smaller size than itemarr2 you will get an array indexOutofbound exception. for(int i=1;i&lt;itemarr2.length;i++) { kotarr2[i]=Integer.parseInt(kotCB2[i]); //If size of itemarr2 is bigger than kotarr2 or is bigger than kotCB2. You will get an array indexOutofbound exception. } for(int i=1;i&lt;itemarr2.length;i++) { itemarr2[i]=Integer.parseInt(itemCB2[i]); //If size of itemarr2 is bigger than itemCB2. You will get an array indexOutofbound exception. } for(int i=1;i&lt;itemarr2.length;i++) { statarr2[i]=Integer.parseInt(statCB2[i]); //If size of itemarr2 is bigger than statarr2 or is bigger than statCB2. You will get an array indexOutofbound exception. } for(int i=1;i&lt;itemarr2.length;i++) { int kotint2=kotarr2[i]; //If size of itemarr2 is bigger than kotarr2. You will get an array indexOutofbound exception. int itemint2=itemarr2[i]; //If size of itemarr2 is bigger than itemarr2. You will get an array indexOutofbound exception. int statint2=statarr2[i]; //If size of itemarr2 is bigger than statarr2. You will get an array indexOutofbound exception. System.out.println( i+"the value of kot in available"+ kotint2); int availablebill = websrv.availablebill(billdetails_be.billno, kotint2, itemint2,statint2); } So you must ensure that the size of kotarr2, kotCB2, itemCB2, statarr2, statCB2 is always bigger or equal to the size of itemarr2, and as i said you can pul all that logic insdide of a single loop. Regarding your Js file we need to see how you set your count, but if the value of your count is bigger than the size of your dropdown1 then You will get an array indexOutofbound exception. UPDATE: You said that count = 18, but you do not init…

perl-module
tags question: http://stackoverflow.com/q/25652367
tag name: perl-module
type: Tag

http://stackoverflow.com/a/25685739
has body: Easy with Java8: Arrays.stream(files).parallel() .forEach((f) -&gt; putFile(f, sftpChannel, outputDir)); Note that sftpChannel must be thread-safe for this to work correctly, which might not give you a speedup in performance. I would create a channel per put operation, or use a connection pool to manage this for you. You can control the amount of parallelism used by changing the size of the common forkjoin pool like this (passed as a JVM argument): -Djava.util.concurrent.ForkJoinPool.common.parallelism=120 This will create a threadpool with 120 threads.
score: 0
answers question: http://stackoverflow.com/q/25685451
type: Answer

http://stackoverflow.com/comment/40067050
type: QuestionComment
comment on: http://stackoverflow.com/q/25643208
score: 0
type: Comment

http://stackoverflow.com/comment/40072758
type: Comment
type: AnswerComment
has text: I use chrome plugin POSTMAN to test and it sents Pyalod as header. As @nablex said it's two p's problem. When I change header to application/xml it works. I changed metdoh signature to public void createOrder(XMLSource source) and stream has content of xml that I sent.
comment on: http://stackoverflow.com/a/25645929
score: 0

relative-path
type: Tag
tags question: http://stackoverflow.com/q/25607734
tag name: relative-path
tags question: http://stackoverflow.com/q/25665867

http://stackoverflow.com/comment/40126856
comment on: http://stackoverflow.com/q/25568908
has text: Or in the latest Java 8. Consider raising a bug.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40036285
has text: I honestly couldn't understand the question, however I felt the need to point out that `variables` by convention are written in camelCase and never start with capital letters unless they're `static final` constants
comment on: http://stackoverflow.com/q/25625928
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25657331
has body: You cannot save file to the client system using javascript(GWT client side). Java script cannot access the disk contents. So if you need to save the file in client system, one option is to generate the file in server side and let the client download that file and save it.
type: Answer
answers question: http://stackoverflow.com/q/25650955
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/40133254
has text: I have never used JAXB, so I'm afraid I can't help you there
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25679170

http://stackoverflow.com/q/25575345
favorite count: 0
type: Question
tagged with: http://stackoverflow.com/tag/docx
tagged with: apache-poi
tagged with: xwpf
score: 13
has title: What is CTP, CTTbl classes (objects) in Apache POI?
type: AnsweredQuestion
has body: I'm trying to understand some parts of Apache POI. For instance, i;m trying to get text (or table, etc.) from an existing docx file. For example there is a method getParagraph(..CTP p) in XWPFDocument: It returns "a paragraph with a CTP class p". But what is CTP class? I've looked inside the xml structure of the document, but didn't find anything similar. As a result i don't know how to call a mthod in the first place. There is also a method getTable(CTTbl CTTbl) for the same XWPFDocument, that returns "a table by its CTtbl-Object. It seems there is a CP* something for every part/type of data inside ooxml documents, so i'd like to understand how to work with them. Moreover, from the documentation, it seems that those methods are the only direct way to get elements without sticking them into collection, or guessing their position.
upvote count: 14
accepted answer: http://stackoverflow.com/a/25577652
tagged with: java
has answer: http://stackoverflow.com/a/25577652
answer count: 1
tagged with: ctp
downvote count: 1

http://stackoverflow.com/a/25708597
has comment: http://stackoverflow.com/comment/40187416
has comment: http://stackoverflow.com/comment/40187541
score: 0
answers question: http://stackoverflow.com/q/25707777
has body: Try this. I hope I could help you. The Facebook package on your phone is called "com.facebook.kantana". Copy &amp; paste the following. Intent i; PackageManager manager = getPackageManager(); try { i = manager.getLaunchIntentForPackage("com.facebook.katana"); if (i == null) throw new PackageManager.NameNotFoundException(); i.addCategory(Intent.CATEGORY_LAUNCHER); startActivity(i); } catch (PackageManager.NameNotFoundException e) { } Update: Just put this in your onClick method: Intent i = new Intent(); i.setAction(Intent.ACTION_VIEW); i.setClassName("com.facebook.kantana, "com.xxx.your_class_name");//Add your class Name here startActivity(i);
type: Answer
has comment: http://stackoverflow.com/comment/40187138

http://stackoverflow.com/a/25608646
answers question: http://stackoverflow.com/q/25608309
has comment: http://stackoverflow.com/comment/40005207
type: Answer
has comment: http://stackoverflow.com/comment/40004415
score: 0
has body: I am guessing you entered one too many zeros in your port since 80003 is not valid. Anyway, you can use @PathVariable like this: @RequestMapping(value = "/{bookId}/list", method = RequestMethod.GET) public @ResponseBody Video getId(@PathVariable("bookId") long id) { ... }

http://stackoverflow.com/q/25577344
answer count: 1
type: Question
tagged with: c#
score: 0
tagged with: android-fragments
has answer: http://stackoverflow.com/a/25578383
tagged with: android
tagged with: java
tagged with: xamarin
has body: I'm developing an Android app using Xamarin studio, but this is not important. I use the pageViewer to upload the fragment (12 more or less). To the one display fragment i use a webView to display a local html page and with a swipe to the left, the webview content change to the next one. So, at the fifth frgament memory problems started even if i used different tasks in my code. My question is: Is there a way to 'detach' the fragment when i'm not displaying them? Can they not remain into my memory? Thanks for all This is my code, N.B: Java answers are accepeted as well protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.BookView); _loader = ProgressDialog.Show (this, "Loading...", "Please wait...", true); //return chapters count chapters = 12 //example //var dp = (int)Resources.DisplayMetrics.Density; _layout = FindViewById&lt;DrawerLayout&gt; (Resource.Id.drawer_layout); _view = FindViewById&lt;ViewPager&gt;(Resource.Id.bView); _view.SetBackgroundColor (Color.White); _currentAdapter = new AwesomeFragmentAdapter (SupportFragmentManager, path, name, chapters, this, _view); _view.Adapter = _currentAdapter; _view.OffscreenPageLimit = chapters; List&lt;int&gt; positions = new List&lt;int&gt; (); _view.PageSelected += (object sender, ViewPager.PageSelectedEventArgs e) =&gt; { //get details var page_load = new Task (() =&gt; { //return an object with the chapter details _chap = object; }); page_load.Start(); //find the webview _web = (WebView)_view.FindViewWithTag(300 + e.Position); WebSettings setting = _web.Settings; setting.CacheMode = CacheModes.Default; setting.JavaScriptEnabled = true; setting.BuiltInZoomControls = true; setting.DisplayZoomControls = false; setting.PluginsEnabled = true; setting.SetPluginState(WebSettings.PluginState.On); //setting.JavaScriptCanOpenWindowsAutomatically = true; if (positions.Contains(e.Position)) { _web.ClearCache(true); _web.ClearView(); } //Start when the scroll is finished _vi…
has title: Android viewPager out of memory using local html
linked to: http://stackoverflow.com/q/3130654
type: UnansweredQuestion

http://stackoverflow.com/a/25659698
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40139302
has comment: http://stackoverflow.com/comment/40104620
has body: I guess that you see this when starting IDE itself with Zulu? The Eclipse launcher has a nasty hack that parses the libjvm library to determine the vendor and sets launcher parameters accordingly. If I recall correctly - it sets Xmx more for the Oracle java. So try to explicitly increase the Xmx value in your eclipse.ini (to -Xmx1024m at least or may be even -Xmx2048m) and keep using Zulu.
has comment: http://stackoverflow.com/comment/40101519
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25659330
downvote count: 0
answers question: http://stackoverflow.com/q/25659330

http://stackoverflow.com/a/25701617
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40173605
has comment: http://stackoverflow.com/comment/40173562
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25701602
answers question: http://stackoverflow.com/q/25701602
downvote count: 0
has body: The difference between Person and LinkedList is that Person is only one person, LinkedList is an ordered list of person, that is more than one person. You should not use LinkedList if not in very specific cases, usually using List is enough, cause you're declaring the interface you need for the method to work, and not the specific implementation. Once you have a method with List, whether you pass LinkedList or ArrayList or another implementation compliant to the List semantics, should be functionally equivalent and "only" offer better performances, either on inserts, or on retrieval, or on memory consumption. However, these performance benefits are useful if you are doing very computationally intensive operations on the list, like looping a lot, adding or removing a lot of entries etc.. When used for a server call, I think the performance of serializing a LinkedList or another implementation (be it using java serialization or any other serialization, like json etc..) are minimal.
upvote count: 1

http://stackoverflow.com/a/25666830
answers question: http://stackoverflow.com/q/25665421
type: Answer
has body: I think you may be inventing a barrier to the correct solution. You say that your boolean stop flag must be volatile and so will interfere with the speed of the solution - well, yes and no - accessing a volatile does indeed do cache flushing but have you considered an AtomicBoolean? I believe the correct solution is to use an AtomicBoolean flag to get all processes to stop. You should check is in as finely grained fashion as is reasonable to get your system to stop quickly. It would be a mistake to attempt to clear all queues and interrupt all threads - this would lead to a horrible mess. static AtomicBoolean finished = new AtomicBoolean(); .... protected void compute() { if (!finished.get()) { if (endIndex - startIndex &lt; THRESHOLD) { // for (int i = startIndex; i &lt; endIndex &amp;&amp; !finished.get(); i++) { if (array[i] == target) { finished.set(true); System.out.print("Found at " + i); } } } else { ... } } }
score: 0
has comment: http://stackoverflow.com/comment/40111959
has comment: http://stackoverflow.com/comment/40112689

http://stackoverflow.com/comment/40027154
comment on: http://stackoverflow.com/q/25620837
type: QuestionComment
score: 0
has text: possible duplicate of [What's the best way to "round" a Color object to the nearest Color Constant?](http://stackoverflow.com/questions/6334311/whats-the-best-way-to-round-a-color-object-to-the-nearest-color-constant)
type: Comment

http://stackoverflow.com/comment/40138086
type: QuestionComment
comment on: http://stackoverflow.com/q/25681716
has text: Why are you using arrays instead of lists if you have to do such operations on them?
score: 0
type: Comment

http://stackoverflow.com/a/25671097
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25670917
answers question: http://stackoverflow.com/q/25670917
has body: Check the web.xml the welcome-files section, in that section you define the files used as main pages for your application, eclipse put them by default [index.html, index.jsp, ...], you could change that configuration to your welcome page or servlet url.
score: 1
type: Answer

http://stackoverflow.com/q/25572778
tagged with: benchmarking
has answer: http://stackoverflow.com/a/25607267
accepted answer: http://stackoverflow.com/a/25607267
has body: I am using the JMH benchmarking framework (http://openjdk.java.net/projects/code-tools/jmh/) to run benchmarks on my code. My understanding is that JMH forks the JVM multiple times during benchmarking in order to discard any profiles built up by the just-in-time (JIT) profiling performed by the JVM during execution. I understand why this is useful in some cases such as the below (copied verbatim from http://java-performance.info/jmh/): By default JHM forks a new java process for each trial (set of iterations). This is required to defend the test from previously collected “profiles” – information about other loaded classes and their execution information. For example, if you have 2 classes implementing the same interface and test the performance of both of them, then the first implementation (in order of testing) is likely to be faster than the second one (in the same JVM), because JIT replaces direct method calls to the first implementation with interface method calls after discovering the second implementation. However, in the case where you are benchmarking the same code repeatedly is there any advantage to running say 10 forks of 20 iterations each instead of 1 fork with 200 iterations? Many Thanks, Danny
type: AnsweredQuestion
has title: Why does JMH run different forks?
downvote count: 0
tagged with: jmh
tagged with: java
answer count: 1
score: 17
upvote count: 17
favorite count: 0
type: Question

http://stackoverflow.com/q/25688665
type: Question
accepted answer: http://stackoverflow.com/a/25694305
has answer: http://stackoverflow.com/a/25707859
upvote count: 5
tagged with: java
type: AnsweredQuestion
answer count: 2
score: 5
downvote count: 0
has body: I want to figure out the best way of confirming that my specified hazelcast config XML file was picked up (and not the hazelcast-default config). Right now, I am using the build metthod on the XmlClientConfigBuilder for the client setup and FileSystemXmlConfig for the server setup.
has answer: http://stackoverflow.com/a/25694305
tagged with: hazelcast
has title: best way to validate that my hazelcast xml config file was picked up
possible better answer: http://stackoverflow.com/a/25707859
favorite count: 0

http://stackoverflow.com/a/25643207
score: 0
accepted answer of: http://stackoverflow.com/q/25642388
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25642388
has body: I've been using a similar system where the "log agent" keeps its own log on how many bytes it has read from the log file it monitors. So every time you run the agent, you write the number of bytes into another file. When the agent is launched, it reads back in the number of bytes and skips that many bytes before reading the actual log file again. It works well, I'd recommend that. Alternatively you could save the number of lines read instead of bytes and then use that.
type: Answer

http://stackoverflow.com/q/25652483
score: -1
has title: How to create an array of byte arrays in java
has comment: http://stackoverflow.com/comment/40084175
downvote count: 6
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/12231453
has answer: http://stackoverflow.com/a/25652650
tagged with: java
has answer: http://stackoverflow.com/a/25652612
has answer: http://stackoverflow.com/a/25652530
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25652826
possible better answer: http://stackoverflow.com/a/25652650
tagged with: byte
answer count: 5
has answer: http://stackoverflow.com/a/25652826
has body: I want to create an array of byte[]. When i try: byte[] data = new byte[10]; This is an array of byte and not an array of byte[]. Thanks
upvote count: 5
tagged with: arrays
has answer: http://stackoverflow.com/a/25652523

http://stackoverflow.com/a/25692931
has body: The practical difference is that you can't create an instance of it. You would have to subclass it and create an instance of the subclass. As to WHY you would want to do this, in practice ... I'm hard pressed to think of a good reason. You could say that the class is only meaningful if someone creates a subclass that implements some function. But then why not make that function abstract in the super-class? I wouldn't rule out the possibility that someone might come up with some example where this makes sense, but I can't think of one. Just because it's possible to write a piece of code and that code compiles successfully doesn't mean that that it makes sense. I mean, I can write "total_price = item_price * zip_code + customer_height_in_cubits - 7.879", but that doesn't mean such a line of code would be meaningful.
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25692811
score: 1
type: Answer

http://stackoverflow.com/q/25551639
type: UnansweredQuestion
tagged with: apache
tagged with: session
tagged with: jboss
has title: Generate new JSESSIONID when on different application server
score: 0
tagged with: java
answer count: 1
has body: I've got a system with multiple jboss (4.2.3) servers behind multiple apache servers. In the situation where one of the jboss servers goes down we still get users with sessions for those servers coming in, however they "bounce" around the servers due to the application server ID in the JSESSIONID, causing apache to send the request to random servers for each request, resulting in session timeout errors. My initial thought was to create an interceptor in the application to invalidate the session if we detect that the session is actually for a different server (i.e. session.invalidate()) But that doesn't cause a new JSESSIONID to be generated (even with the fix described here https://issues.jboss.org/browse/JBAS-4436) My next idea was to create a valve to do the same job but on the Request instead of the HttpServletRequest, however I can't find the library to add ValveBase to jboss 4.2.3 (and I'm not even certain that valves are supported by 4.2.3) Is there either: a) Anything I've missed in getting one of my 2 ideas above to work or b) Any better ideas I haven't thought of for solving the problem ? (I would like to cluster the sessions but can't at the moment due to infrastructure problems) Thanks.
type: Question
has answer: http://stackoverflow.com/a/25566760
tagged with: ejb

http://stackoverflow.com/comment/40007861
score: 0
comment on: http://stackoverflow.com/q/25610298
has text: @PeterLawrey Maybe, but that way probably lies madness. What if you've got mutually recursive methods and you expect to see `a a b b a a b b` and that gets collapsed to `a b a b`? It's a nice thought, but I expect that just about "optimization" here would fail pretty nastily for some cases.
type: Comment
type: QuestionComment

jbox2d
tag name: jbox2d
type: Tag
tags question: http://stackoverflow.com/q/25578304

http://stackoverflow.com/q/25554452
answer count: 1
accepted answer: http://stackoverflow.com/a/25555272
has body: I'm developing a web application using GWT from Google. Currently I upload the image to the web server and save the image using a java servlet: for (FileItem item : sessionFiles) { String fileName = item.getName(); File file = new File("imagePath"); item.write(file); } After that I only have to provide the image URL to show it on browser. Unfortunately this is poor solution to my problem since this specific web application loads several preview images (product catalog) per page. Is there any way to load a smaller version of the saved image to the client when presenting the preview images (as you see on when you search images on Google)?
has answer: http://stackoverflow.com/a/25555272
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39908250
tagged with: java
has comment: http://stackoverflow.com/comment/39905089
has title: How to load smaller and faster images with java servlet?
tagged with: image
has comment: http://stackoverflow.com/comment/39904046
tagged with: servlets
type: Question
score: 0

http://stackoverflow.com/a/25619656
score: 0
answers question: http://stackoverflow.com/q/25619434
type: Answer
has body: I'd separate your problem into 2 different tasks Get stack trace and save it Find intersections. If you can change the code you are discovering you can just use code like new Throwable().printStackTrace(out) to get stack trace in the beginning of each interesting method. Save it to dedicated file and process later. If you cannot (or do not want) change the code that is being discovered you can easily implement the same with AspectJ. Recommendation: use dynamic weaving, it is easier and more flexible. Now the second task: searching for intersections. Unfortunately I do not know standard tools, but it seems that it is not so difficult to implement this. The implementation will depend on your requirements. If for example you just have to find the first common method in 2 stack traces the task is trivial. If however you need a real "diff" functionality you can use one of available java diff libraries. If personally found http://badiff.org/wiki/Badiff as a most flexible and well designed java diff library.

http://stackoverflow.com/comment/40101133
has text: At the following link you can find cup's license: http://www2.cs.tum.edu/projects/cup/install.php
comment on: http://stackoverflow.com/a/25661144
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39976539
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25593147
has text: 1+ to the question for the changes you made. For future reference, do you see how your minimal complete program helps us to identify your problem? It's a great way to help others to understand your problem and thus help you.
score: 0

http://stackoverflow.com/comment/39993142
type: QuestionComment
has text: @pgregory , sorry I have edited the post to add that info
score: 0
comment on: http://stackoverflow.com/q/25602146
type: Comment

http://stackoverflow.com/comment/40148509
type: Comment
type: QuestionComment
has text: @trashgod It's not a very large file that I'm loading (<20KB), it just has a lot of lines. I'm not so sure a table would suit what I'm trying to do, but even then, the suggested approach also puts it into a `JScrollPane`, so I don't see how that will avoid the issue. Either way, I also wanted to find out why I'm hitting a problem just as much as I want to find a solution.
comment on: http://stackoverflow.com/q/25674947
score: 0

http://stackoverflow.com/a/25575205
has comment: http://stackoverflow.com/comment/39944272
score: 0
accepted answer of: http://stackoverflow.com/q/25575136
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25575136
has body: Read about layout managers in Swing. You can use a GridBagLayout and assign your JTextField the desired weight and fill. Basically, create a GUI using this documentation as an example and play around with the options.
type: Answer

http://stackoverflow.com/a/25597481
has body: It's quite possible that the first thread finishes its (quite short) loop before the second thread starts its own loop, and therefore they appear to not interfere with each other. You would see the expected behavior if you try longer loops or add delays within the loop.
answers question: http://stackoverflow.com/q/25597457
downvote count: 0
score: 1
upvote count: 1
type: Answer

tableview
tags question: http://stackoverflow.com/q/25686624
type: Tag
tag name: tableview
tags question: http://stackoverflow.com/q/25701087

http://stackoverflow.com/comment/40096529
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25659169
has text: Well, I listed that as an option and not as the preferred way.

http://stackoverflow.com/q/25572479
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39938641
has comment: http://stackoverflow.com/comment/39938369
downvote count: 1
has answer: http://stackoverflow.com/a/25572533
favorite count: 0
has comment: http://stackoverflow.com/comment/39950573
has title: ArrayIndexOutOfBoundsException: 0 using Vector
tagged with: java
has answer: http://stackoverflow.com/a/25572634
tagged with: indexoutofboundsexception
score: -1
has comment: http://stackoverflow.com/comment/39950360
has comment: http://stackoverflow.com/comment/39950268
has body: I am getting an error: java.lang.ArrayIndexOutOfBoundsException: 0 at tesseract.BlockMaze.generate(BlockMaze.java:128) at tesseract.MazeMap.&lt;init&gt;(MazeMap.java:17) at tesseract.main.init(main.java:29) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Here are the parts: main line 29: map = new MazeMap(mwidth, mheight); MazeMap line 17: generate(false); BlockMaze line 128: maze[startX = 0][startY = rint(mzHyt - 2) + 1] = FLOOR; I am using a Vector type and I was wondering if maybe that was the problem that I was having. Is Vector a deprecated type and is there a replacement. Also is there an alternative, because I tried using ArrayList, but I wasn't entirely sure if it would do the same exact thing. Here is BlockMaze: package tesseract; import java.awt.Color; import java.util.Vector; public class BlockMaze extends Maze{ private static final long serialVersionUID = -4392133669361871887L; public static final byte WALL = 0, FLOOR = 1; private Vector pending; // list of available Sqr objects private int strt = 70; // prob of exploring from same sqr private int sdir = 60; // prob of exploring in same dir (if possible) private int thru = 90; // prob of blocking thru loops private int side = 60; // prob of blocking wide areas private int diag = 100; // prob of blocking diag connections private int dens = 15; // prob of leaving areas unexplored public BlockMaze () { setBackground(Color.black); } protected byte initSq () { return (byte) (WALL | DIRTY); } protected void drawSquare (int xx, int yy) { offscr.setColor(maze[xx][yy] == WALL ? Color.gray : Color.white); offscr.fillRect(leftOffset + (xx * sqWid), topOffset + (yy * sqHyt), sqWid, sqHyt); } public boolean isOpen (int x, int y) { return inBounds(x, y) &amp;&amp; sqr(x, y) == FLOOR; } private boolean isOpen (int x, int y, int allowProb) { return prob(allowProb) &amp;&amp; isOpen(x, y); } private boolean blocked (int x, int y) { return inBounds(x, y) &amp;&amp; sqr(x, y) == WALL; …
has comment: http://stackoverflow.com/comment/39938405
type: Question
answer count: 3
tagged with: vector
has answer: http://stackoverflow.com/a/25572539

http://stackoverflow.com/a/25566575
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Well, apparently Builder.all() does exist. This solved my problem: List&lt;BuildStepDescriptor&lt;? extends Builder&gt;&gt; builders = new ArrayList&lt;BuildStepDescriptor&lt;? extends Builder&gt;&gt;(); for ( hudson.model.Descriptor&lt;Builder&gt; descriptor : Builder.all() ) { if ( !( descriptor instanceof BuildStepDescriptor ) ) { continue; } BuildStepDescriptor&lt;? extends Builder&gt; buildStepDescriptor = (BuildStepDescriptor) descriptor; // newJob is a FreeStyleProject if ( buildStepDescriptor.isApplicable( newJob.getClass() ) &amp;&amp; hasDbc( buildStepDescriptor.clazz ) ) { builders.add( buildStepDescriptor ); } } for ( BuildStepDescriptor&lt;? extends Builder&gt; buildStepDescriptor : builders ) { System.out.println( buildStepDescriptor.getDisplayName() ); } private boolean hasDbc( final Class&lt;?&gt; clazz ) { for ( Constructor&lt;?&gt; constructor : clazz.getConstructors() ) { if ( constructor.isAnnotationPresent( DataBoundConstructor.class ) ) { return true; } } return false; }
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25563603
accepted answer of: http://stackoverflow.com/q/25563603

http://stackoverflow.com/a/25630890
score: 0
accepted answer of: http://stackoverflow.com/q/25630640
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25630640
has body: You need to run set PATH=%JAVA_HOME%\bin; again after setting the JAVA_HOME variable to 1.8 JAVA_HOME.

http://stackoverflow.com/comment/40168720
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25698880
type: Comment
has text: Firstly `Class` doesn't start with an uppercase letter in Java, class names should but you have separate `AClass` and `aClass` references. Also, what are you asking? What happens to objects created in `static` methods?

http://stackoverflow.com/comment/39963773
comment on: http://stackoverflow.com/q/25558699
score: 0
has text: @OliCharlesworth I think you are right, probably I need to change the topic to "rename" instead of refactoring. How IDE like Eclipse can find such a way to rename the variable and method is kinda magic to me.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25580261
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/39952810
has body: from your last question and from this question As far my knowledge I think you still not sure about Context in android . Some suggestions to solve your root problem: 1) In ReceiveFields() constructor you just use a context variable to solve the error like below.. Context ctx = null; public ReceiveFields(Context ctx){ this.ctx=ctx; //create a field Context ctx; } And here you can use PG_Android's solution to fix the error but you still not solve your root problem if you will not pass the main context from your activity. Just check your main activity from where you call/initialize the main class( I think TSMS) and pass the proper context the fix the main issue like: TSMS obj = new TSMS(your_current_activity.this); here your your_current_activity.this will working as the main context in all your classes and databases.. i think you understand..
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39953373
has comment: http://stackoverflow.com/comment/39953425
answers question: http://stackoverflow.com/q/25579987
has comment: http://stackoverflow.com/comment/39952897

http://stackoverflow.com/a/25702007
has body: The issue was that i was checking for anonymous account link right after the user signed up,while in the background a save task was going on with the current user. That made parse library go crazy, So what i did was use a callback for save and do all the work after save was completed.
type: Answer
answers question: http://stackoverflow.com/q/25700078
score: 0

http://stackoverflow.com/a/25702437
upvote count: 1
type: Answer
has body: The method setText(), wont throw any exceptions. If you want you can define your own exception and throw it using throw.(see http://www.java2novice.com/java_exception_handling_examples/create_custom_exception/ ) Not sure why you will want to do that..
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40175008
accepted answer of: http://stackoverflow.com/q/25702351
downvote count: 0
answers question: http://stackoverflow.com/q/25702351

http://stackoverflow.com/q/25609306
type: AnsweredQuestion
has body: I am trying to make a web browser for the fun of it, i seem to get errors when ever i put in my loadHtml method, when i comment that out everything works even the action listener. import java.awt.*; import javax.swing.*; import java.util.*; import java.awt.event.*; import java.applet.*; public class browserPannel extends JFrame{ public static void main(String[] arg) { JFrame browser = new JFrame("A Nun In A Weelchair"); browser.setSize(1000,700); browser.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); browser.setLocationRelativeTo(null); JPanel header = new JPanel(); header.setBackground(Color.lightGray); JTextField url = new JTextField(20); url.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { //loadHtml(event.getActionCommand); System.out.println("action performed"); } } ); url.setSize(890,30); url.setVisible(true); JButton send = new JButton("Send"); send.setSize(75,30); send.setVisible(true); JEditorPane htmlc = new JEditorPane(); htmlc.setBackground(Color.red); htmlc.setEditable(true); htmlc.setContentType("text/html"); header.add(url, BorderLayout.SOUTH); header.add(send); browser.getContentPane().add(header, BorderLayout.NORTH); browser.getContentPane().add(new JScrollPane(htmlc)); browser.pack(); browser.setVisible(true); } private void loadHtml(String link) { try{ //htmlc.setPage(link); //url.setText(link); }catch(Exception e){ System.out.println("ops sorry could not fined Virgine Mobile"); } } } from what i can tell it looks like it can not recognize the url and the htmlc I have tried to comment the htmlc.setPage and the url.setText, and when i do that my program compiles. why am i getting these errors, shouldn't it recognize that they are defined above?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40005590
accepted answer: http://stackoverflow.com/a/25609390
tagged with: browser
has answer: http://stackoverflow.com/a/25609390
answer count: 1
downvote count: 0
has title: My method to load the html from a url in a web browser does not work
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40005675
has comment: http://stackoverflow.com/comment/40005754
type: Question

http://stackoverflow.com/comment/40095893
type: AnswerComment
has text: You might want to write a couple of lines on the benefits and disadvantages of `BigDecimal`. There *are* places where `BigDecimal` is needed but taking such a coding and performance hit just *"to be on the safe fide"* is generally *not* reasonable...
comment on: http://stackoverflow.com/a/25658769
type: Comment
score: 0

http://stackoverflow.com/comment/40140235
type: Comment
score: 0
has text: Because to pass data to a sub process, you need to write data to the sub process input stream. So you need to write on to the parent process outputstream, which will be piped on to the sub process' input stream. I guess here your python script execution would be the sub process.
type: AnswerComment
comment on: http://stackoverflow.com/a/25683557

http://stackoverflow.com/q/25708949
has answer: http://stackoverflow.com/a/25711121
has answer: http://stackoverflow.com/a/25710223
tagged with: css
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40187001
score: 0
has body: I have recently started using JavaFX from a switch over from Swing but I have encountered a problem, basically the CSS from the Stylesheet that I have added isn't being added and just stays the same however from what I've read it should work. Main file: package com.callum.launch; import com.callum.construct.Window; public class Main { public static void main(String[] args) { Window.Create("Callum's Program", 980, 640, true); Window.launch(Window.class, args); } } Window File: package com.callum.construct; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.stage.Stage; public class Window extends Application { protected static String WindowTitle; protected static int WindowWidth; protected static int WindowHeight; protected static boolean WindowResizable; public static void Create(String title, int width, int height, boolean resizable) { WindowTitle = title; WindowWidth = width; WindowHeight = height; WindowResizable = resizable; } @Override public void start(Stage stage) throws Exception { Group root = new Group(); Scene window = new Scene(root, WindowWidth, WindowHeight); stage.setScene(window); stage.setTitle(WindowTitle); stage.setResizable(WindowResizable); stage.setMinWidth(WindowWidth); stage.setMinHeight(WindowHeight); window.getStylesheets().add("com/callum/construct/stylesheet.css"); stage.show(); } } Stylesheet: .root { -fx-background-color:#000; } The stylesheet is being found as I am not getting and error/warning in the console.
has comment: http://stackoverflow.com/comment/40186941
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/40187096
possible better answer: http://stackoverflow.com/a/25710223
type: Question
has title: JavaFX background colour not being set with CSS
answer count: 2
accepted answer: http://stackoverflow.com/a/25711121
has comment: http://stackoverflow.com/comment/40187029

http://stackoverflow.com/a/25898312
has body: You will get the "Invalid or Stale Connection" error when you have a connection in the connection pool which is no longer connected to the Database actively. Below are few scenarios which can lead to this Connection is manually aborted from the database by a dba. For example, if the connection was killed using "ALTER SYSTEM KILL SESSION" When a connection exists in the connection pool without being used for a long time and is disconnected due to the timeouts enforced by the database (idle_time) A database restart A network event has caused the connection to drop, probably because the network has become unavailable or a firewall has dropped a connection which has been open for too long. If you are setting the InactivityTimeout, then you have to make sure that it's less that the IDLE_TIME enforced by the database. You can get the IDLE_TIME with the below query select * from dba_profiles dp, dba_users du where dp.profile = du.profile and du.username ='YOUR_JDBC_USER_NAME'; When you use connectionCacheProperties, always make sure that you set the PropertyCheckInterval property to something less than the timeouts. The default value is 900 seconds which means that the cache daemon thread will only run every 15 minutes and enforce the timeouts. So you would always want to set this to a value lower than your timeout properties. I would always make sure that I use 0 as the MinLimit. Rewriting you config file a little bit would make it : 0 200 1 120 180 true 150 You might also get a "Invalid or Stale Connection Error" when your network is actually broken at the time when you try to validate an old connection obtained from the pool.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25589694
downvote count: 0
answers question: http://stackoverflow.com/q/25589694
upvote count: 9
type: Answer
score: 9

http://stackoverflow.com/comment/39970509
type: AnswerComment
has text: +1, nice catch, even slipped my eyes. Failed to see that once walking through the code pasted :-)
comment on: http://stackoverflow.com/a/25590061
score: 0
type: Comment

http://stackoverflow.com/q/25599835
has title: Forwarding variable number of parameters to function that accepts variable number of parameters via the ellipse operator
accepted answer: http://stackoverflow.com/a/25599960
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39988265
type: AnsweredQuestion
has body: In short, I have a function that accepts a variable number of params and another function that also accepts a variable number of paramaters, I need to forward all the variable paramaters in the method plus some extra to the second method that accepts variable paramaters ... action1(new Filter1()); action2(new Filter1(), new Filter2()); public void action1(Object ... params){ actionGeneric(new Action1(), params); } public void action2(Object ... params){ actionGeneric(new Action2(), params); } public void actionGeneric(Object ... params){ for (Object param : params){ if (param instanceof Action1){ // works fine } else if (param instanceof Action2){ // works fine } else if (param instanceof Filter1){ // never gets here } else if (param instanceof Filter2){ // never gets here } } } So my question is, how should I be forwarding those params in action1 / action2 in order for actionGeneric to see them as Filter1 / Filter2 instances and not (I'm guessing) array type?
tagged with: java
possible better answer: http://stackoverflow.com/a/25599905
has comment: http://stackoverflow.com/comment/39989214
has answer: http://stackoverflow.com/a/25599960
type: Question
has answer: http://stackoverflow.com/a/25599905
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39988250
has comment: http://stackoverflow.com/comment/39988308
linked to: http://stackoverflow.com/q/18475232
has comment: http://stackoverflow.com/comment/39988528
upvote count: 1

http://stackoverflow.com/a/25674385
upvote count: 1
answers question: http://stackoverflow.com/q/25673858
score: 1
has body: Put break; after every mil = mil + ...;
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40108479
comment on: http://stackoverflow.com/a/25657153
score: 0
type: Comment
has text: That is right, thank you. I'm checking for null body now, but why is my tag body null? <gl:escape>testing</gl:escape> Shouldn't is be "testing"?
type: AnswerComment

http://stackoverflow.com/q/25578353
type: Question
has comment: http://stackoverflow.com/comment/39964740
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39964661
tagged with: android
has comment: http://stackoverflow.com/comment/39961231
has answer: http://stackoverflow.com/a/25587020
has comment: http://stackoverflow.com/comment/39950478
score: 0
tagged with: view
has title: The specified child already has a parent Exception Error
tagged with: java
has body: I am currently having a problem with adding views to parents. I have no idea how to solve this. I have looked at other answers with the same exception but nothing was able to help me. Here is my code: int countdown = 0; CountDownTimer mCountDownTimer; TableRow tr1; TableRow tr2; TextView tv; protected void createNullUI() { tr1 = new TableRow(getBaseContext()); tr2 = new TableRow(getBaseContext()); tv = new TextView(this); tv.setText("Ooops, it looks like the user you were searching for does not exist... You will be redriced back to our homepage shortly =)"); tv.setMaxLines(2); tv.setTextSize(30); tv.setSingleLine(false); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); final ProgressBar mProgressBar = (ProgressBar) inflater.inflate(R.layout.progress, null, false); mProgressBar.setProgress(countdown); runOnUiThread(new Runnable() { public void run() { //set up the count down timer mCountDownTimer = new CountDownTimer(3000, 1000) { @Override public void onTick(long millisUntilFinished) { Log.v("Log_tag", "Tick of Progress" + countdown + millisUntilFinished); countdown++; mProgressBar.setProgress(countdown); } @Override public void onFinish() { countdown++; mProgressBar.setProgress(countdown); } }; mCountDownTimer.start(); TableLayout.LayoutParams tableRowParams = new TableLayout.LayoutParams( TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT); tr1.setLayoutParams(tableRowParams); tr2.setLayoutParams(tableRowParams); tr1.addView(tv); tr2.addView(mProgressBar); ((ViewGroup)tr1.getParent()).removeView(tr1); ((ViewGroup)tr2.getParent()).removeView(tr2); tableScrollView.addView(tr1); // &lt;--- Error here tableScrollView.addView(tr2); } }); } Exception: 08-30 02:44:37.446: E/AndroidRuntime(17698): FATAL EXCEPTION: main 08-30 02:44:37.446: E/AndroidRuntime(17698): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. 08-30 02:4…
answer count: 1
has comment: http://stackoverflow.com/comment/39950524

http://stackoverflow.com/comment/40065599
type: QuestionComment
score: 3
type: Comment
has text: What's a "wild class"?
comment on: http://stackoverflow.com/q/25642391

http://stackoverflow.com/q/25556819
tagged with: node.js
has comment: http://stackoverflow.com/comment/39991831
has title: Could not find implementation class: "cassandra"
has comment: http://stackoverflow.com/comment/39992281
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
tagged with: cassandra
has answer: http://stackoverflow.com/a/25618637
tagged with: titan
type: UnansweredQuestion
score: 1
tagged with: java
has body: I'm trying to connect to Titan backed with Cassandra (installed with the Rexster Titan-Server package) via Titan-Node. I get the error... java.lang.IllegalArgumentException: Could not find implementation class: "cassandra" ... when I run the following code.... var Titan = require('titan-node'); var gremlin = new Titan.Gremlin({ loglevel: 'OFF' }); var TitanFactory = gremlin.java.import('com.thinkaurelius.titan.core.TitanFactory'); var graph = TitanFactory.openSync('titan.config'); Config: storage.directory = "/tmp/titan" storage.backend = "cassandra" storage.hostname = "127.0.0.1" storage.port = 9160 Any ideas? I seem to have the required .jar within my Titan installation folder and also in the target/dependency folder within the Titan-Node package. Why can't Java find the file? Is there a missing classpath entry? If so would it need to be set for the database or for node? I figure it would be node because that's the app trying to load the class. EDIT Dan's suggestion gave me.... 'java.lang.IllegalArgumentException: Could not find implementation class: "com.thinkaurelius.titan.diskstorage.cassandra.thrift.CassandraThriftStoreManager"' ...and... 'java.lang.IllegalArgumentException: Could not find implementation class: "com.thinkaurelius.titan.diskstorage.cassandra.astyanax.AstyanaxStoreManager"' ...respectively. In fact whatever value you set storage.backend to in the config, that's the name of the class it can't find an implementation for that it reports in the exception message. If you look in the code here... https://github.com/thinkaurelius/titan/blob/master/titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/Backend.java ...the instantiate method that is throwing the exception uses the method parameter clazzname in the message which is passed in by the call in getImplementationClass. The latter ought to be looking up the class to load via the key set in storage.backend but oddly it doesn't seem to find anything so it uses the value as is. Even so, it st…

http://stackoverflow.com/comment/40151375
type: AnswerComment
score: 1
has text: Sure. This will split the entire uri, creating multiple strings. Of which only one is required. The generation of all those other strings is a waste. Elliott's solution doesn't suffer from this problem.
comment on: http://stackoverflow.com/a/25689627
type: Comment

http://stackoverflow.com/comment/40015452
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25598804
has text: I don't know Netbeans, but Eclipse keeps old versions of all updated source files for some time. You can then "restore from local history". Maybe NB also has that.

http://stackoverflow.com/q/25563275
tagged with: hbase
type: UnansweredQuestion
has title: overwriting hbase cell in a single put call
has answer: http://stackoverflow.com/a/25706512
score: 0
has answer: http://stackoverflow.com/a/25563794
answer count: 2
tagged with: java
has body: I am wondering what will be the behaviour of overwriting cell values in a single put call using Java API. For example HTable table; .... Put p = new Put("key".getBytes()); p.add("cf".getBytes(), "qualifier".getBytes(), "value1".getBytes()); p.add("cf".getBytes(), "qualifier".getBytes(), "value2".getBytes());` table.put(p); I want to know what would be the behaviour? Will there be only one version of cell inserted for row "key"? if yes which one? Will there be two versions of the cell inserted for row "key"? if yes what will be the order? If it is documented somewhere then a link to the documentation will be good to read as well.
type: Question

http://stackoverflow.com/comment/39970105
comment on: http://stackoverflow.com/a/25588705
has text: Thanks for the fast reply. Yes, I tried, I updated my post..please check it...Don't know where to proceed.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25679548
has comment: http://stackoverflow.com/comment/40133121
has comment: http://stackoverflow.com/comment/40133181
has comment: http://stackoverflow.com/comment/40133104
has comment: http://stackoverflow.com/comment/40133009
has comment: http://stackoverflow.com/comment/40133055
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40133041
has comment: http://stackoverflow.com/comment/40133063
answers question: http://stackoverflow.com/q/25679521
has comment: http://stackoverflow.com/comment/40133278
has body: You may try like this: string s = "Abc" + "\\"+ "def" + "\\" + "ghi"; or you may try to replcae your space(" ") with \ string result = s.replaceAll(" ","\\ ");
has comment: http://stackoverflow.com/comment/40133149

http://stackoverflow.com/comment/40025995
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25620386
has text: check [this](http://www.tutorialspoint.com/android/android_shared_preferences.htm)

http://stackoverflow.com/q/25711995
has comment: http://stackoverflow.com/comment/40192975
tagged with: jbutton
accepted answer: http://stackoverflow.com/a/25712311
has comment: http://stackoverflow.com/comment/40193420
possible better answer: http://stackoverflow.com/a/25779971
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25779971
has comment: http://stackoverflow.com/comment/40193066
tagged with: jtextfield
has title: JTextField Output to a new window with the use of JButton
has answer: http://stackoverflow.com/a/25712311
linked to: http://stackoverflow.com/q/9554636
linked to: http://stackoverflow.com/q/3002787
type: Question
has body: I have a question. Is it possible that all of the values entered on those JTextFields, Radio Buttons and Checkboxes can be printed/displayed on a new window if you press the "Submit" button? Please help me to know more. I am making a simple enrollment form here with the use of a Spring Layout because I think it fits for it. Here's my code: import java.awt.Component; import java.awt.Container; import java.awt.Font; import java.awt.BorderLayout; //import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.SpringLayout; import javax.swing.JRadioButton; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JCheckBox; import javax.swing.JPanel; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; class SpringSample { public static void main(String args[]) { JComboBox bDay; JComboBox days; JComboBox taon; JButton butones; JFrame frame = new JFrame("Enrollment Form"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); //JLabel title = new JLabel("Enrollment Registration"); SpringLayout layout = new SpringLayout(); contentPane.setLayout(layout); JPanel mainPanel = new JPanel(new BorderLayout()); /*JLabel titles = new JLabel("Enrollan na!"); Font font = new Font("Agency FB", Font.BOLD, 50); titles.setFont(font); mainPanel.add(titles, BorderLayout.PAGE_START); */ //last name Component last = new JLabel("Last Name:"); Component last2 = new JTextField(15); contentPane.add(last); contentPane.add(last2); layout.putConstraint(SpringLayout.WEST, last, 10, SpringLayout.WEST, contentPane);//pweto nugn name layout.putConstraint(SpringLayout.NORTH, last2, 25, SpringLayout.NORTH, contentPane);//gaano kataas o kababa yung box layout.putConstraint(SpringLayout.NORTH, last, 25, SpringLayout.NORTH, contentPane);//gaano kataas o kababa yung label layout.putConstraint(SpringLayout.WEST, last2, 20, Spr…
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40193282
tagged with: swing

pkix
tags question: http://stackoverflow.com/q/25585020
type: Tag
tag name: pkix

http://stackoverflow.com/comment/40094341
type: Comment
has text: there's a third way which is as fast as a simple pass and is extensible to *k* and that is the **selection algorithm** which finds the *kth* smallest (largest) element in linear time.
type: QuestionComment
comment on: http://stackoverflow.com/q/25657849
score: 0

http://stackoverflow.com/comment/39983607
type: Comment
has text: It is not right to give the answer away. Just hint to lead the OP to the right palce and I am sure you agree with me
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25597197

http://stackoverflow.com/comment/39958218
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25583339
type: QuestionComment
has text: if i give the input as 66 what would be the expected output?

http://stackoverflow.com/comment/39942285
comment on: http://stackoverflow.com/a/25574366
score: 0
type: AnswerComment
has text: Initially it was like that - all strings but I ran into the nullpoint exception error (added the logcat message under my initial post under the update section) so tried to adjust the code in order to resolve the issue
type: Comment

http://stackoverflow.com/q/25633476
has answer: http://stackoverflow.com/a/25635851
tagged with: playframework
downvote count: 0
tagged with: frameworks
upvote count: 1
type: UnansweredQuestion
tagged with: web
has answer: http://stackoverflow.com/a/25649573
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/21786252
has title: Change language with button on play framework
has answer: http://stackoverflow.com/a/25829094
has body: First sorry for my english... I was searching for all internet but I can't find the answer of my question. I tried everything, looked in documentation, tutorials, videos, etc... I put two buttons in the top of my page for the user can change the language, but I can't catch the value on my controller, I did everything but never can handle. I'm new on play :( please help...!! I have this on my view: &lt;`form method="GET" action="@{Application.language("value")}"/`&gt; &lt;`input&gt; name="language" type="submit" value="en" title="@Messages("button.en")" &lt;/`&gt; &lt;`input&gt; name="language" type="submit" value="es" title="@Messages("button.es")" &lt;/`&gt; &lt;`/form`&gt; And this on my controller: public static void language(String idiom) { String key = null; key = idiom; if(key.isEmpty()){ } else { Lang.apply(idiom); } } But when I try to catch the value on my controller always I received this message: [RuntimeException: Unrecognized language: value]
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/60759816
answer count: 4
tagged with: playframework-2.0

http://stackoverflow.com/a/25695113
accepted answer of: http://stackoverflow.com/q/25694879
type: AcceptedAnswer
score: 2
downvote count: 0
type: Answer
has body: Yes, Double Dispatch via reflection is a common replacement of the Visitor pattern in Java (and other languages that support introspection). However, the Visitor pattern is still useful to let users to extend closed hierarchies, ie add a new virtual function to all classes of a hierarchy without changing them.
answers question: http://stackoverflow.com/q/25694879
upvote count: 2

http://stackoverflow.com/a/25586531
has body: If I understand your question, one alternative would be to use a loop, public int shift4N(int num, int n) { for (int i = 0; i &lt; 4; i++) num &lt;&lt;= n; return num; }
type: Answer
answers question: http://stackoverflow.com/q/25586519
score: 0

http://stackoverflow.com/comment/40182490
score: 0
type: QuestionComment
has text: Best way to get help here is to attempt your project on your own, then post your code attempt here along with an explanation of what isn't working or what exact part you can't do. One of the keys here is you should be pointing only only a small problem. Right now this question is pretty vague and broad.
comment on: http://stackoverflow.com/q/25706166
type: Comment

http://stackoverflow.com/comment/39958301
has text: @kaze Yes, Please see my edit I uploaded some sample inputs and outputs
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25583339

http://stackoverflow.com/a/25659714
score: 2
has comment: http://stackoverflow.com/comment/40099234
answers question: http://stackoverflow.com/q/25659273
has comment: http://stackoverflow.com/comment/40098982
has comment: http://stackoverflow.com/comment/40099364
has comment: http://stackoverflow.com/comment/40097604
downvote count: 0
has body: Some suggestions for you: You can load the images at the start of application using multithreading. Use the class Executors to do it. Important is: you must load all the images before you show your UI. Another possibility is asynchronious loading of images. Use SwingWorker to load images. The loading must be implemented in the method doInBackground(). When some images are loaded you can use the methods publish()/process() to update your table model with new images. You can combine both and use Executors in doInBackground() method. I think, your problem is not the CPU load. Your problem is IO. Reading from hard disk is very slow and should be performed in background when it's possible.
has comment: http://stackoverflow.com/comment/40098174
has comment: http://stackoverflow.com/comment/40097662
has comment: http://stackoverflow.com/comment/40097508
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40097963

http://stackoverflow.com/q/25649648
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25652738
tagged with: reflection
has answer: http://stackoverflow.com/a/25652738
tagged with: java
has answer: http://stackoverflow.com/a/25649981
type: Question
tagged with: weld-se
possible better answer: http://stackoverflow.com/a/25649981
has title: Java reflection instance with Weld-SE context
has body: I have a problem with creating object via reflection with Weld context. I'm loading classes and their configuration from external files. Simplify my code looks like: final Class&lt;?&gt; moduleClass = Class.forName(properties.getProperty("className")); then I'm creating instance of this class final Constructor&lt;?&gt; constructor = moduleClass.getDeclaredConstructor(); module = (Module) constructor.newInstance(); Module class: @ModuleImpl public class ExampleModule extends AbstractModule (implements Module interface) { @Inject private Test test; Module is created sucessfully, but it hasn't weld context to inject Test class. And I cannot find the correct way. I tried to make own producer but I'm not much familiar with Weld and CDI in Java SE yet. My broken producer (I think that its totaly bad) public class InjectionProvider { @Produces public Module getInsrance(Class&lt;?&gt; clazz) throws ReflectiveOperationException { final Constructor&lt;?&gt; constructor = clazz.getDeclaredConstructor(); return (Module) constructor.newInstance(); } } I cannot find something about this problem, so if anyone can help me I will be glad. I really need this way of creating classes because I don't want to change my code everytime when I need change some property in Module classes. EDITED: I cannot make it with producers. But I found a workaround. I'm not sure if is it good solution but it works for now. I created a singleton class with Weld context. public class TheMightyWeld { private static Weld weld; private static WeldContainer weldContainer; public static WeldContainer getThePowerOfCreation() { if (weldContainer == null) { weld = new Weld(); weldContainer = weld.initialize(); } return weldContainer; } public static void shutdown() { if (weld != null) { weld.shutdown(); } } } And then I can initialize my app with TheMightyWeld.getPowerOfCreation().instance().select(FXApplicationStarter.class).get().startApplication(primaryStage, getParameters()); And later in code I can reuse it …
type: AnsweredQuestion

http://stackoverflow.com/a/25620241
type: Answer
answers question: http://stackoverflow.com/q/25619867
has comment: http://stackoverflow.com/comment/40027387
has body: mEditTextET.setInputType(InputType.TYPE_CLASS_NUMBER); mEditTextET.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL); mEditTextET.setKeyListener(DigitsKeyListener.getInstance(false,true));
has comment: http://stackoverflow.com/comment/40026115
score: 0

http://stackoverflow.com/q/25667960
has comment: http://stackoverflow.com/comment/40112598
answer count: 5
upvote count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40112586
has answer: http://stackoverflow.com/a/25668400
has comment: http://stackoverflow.com/comment/40112075
has comment: http://stackoverflow.com/comment/40112698
tagged with: class
has answer: http://stackoverflow.com/a/25668467
has body: In Java, if I want to reach a method which exists in the ancestor classes of a random object, can I do this? someObject.Super.theMethodOfSuperClass(); For instance: public class A { public int getOne() { return 1; } } public class B extends A { public static void main(String args[]) { B b = new B(); b.super.getOne(); // This..works? } } Will the last line work? P.S. I know without super (b.getOne()) works properly, I just want to understand the Object.SuperClasses.Methods thing..
has comment: http://stackoverflow.com/comment/40112672
has comment: http://stackoverflow.com/comment/40112221
has answer: http://stackoverflow.com/a/25668438
has answer: http://stackoverflow.com/a/25668372
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40112528
has answer: http://stackoverflow.com/a/25668734
favorite count: 0
has title: an Object's super class accessibilty
has comment: http://stackoverflow.com/comment/40112030
type: Question
tagged with: super

http://stackoverflow.com/q/25703477
linked to: http://stackoverflow.com/q/25702584
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25703563
tagged with: static
tagged with: java
answer count: 4
tagged with: void
has title: Altering Variables in a void method?
linked to: http://stackoverflow.com/q/5749251
type: UnansweredQuestion
has body: I need to set the temperature class, and need to alter the degrees in a void method. How do I access these variables in a void method, and ensure that the void method alters the parameters into the variables that I need? I need the degrees to be converted, and I don't know how to access the degree variable not in the set class? Temperature (double enteredtemp,char scale ){ degrees=Temperature.set(); } public void set (double enteredtemp, char scale){ if (scale=='r'||scale=='R'){ degrees=(enteredtemp/(9/5));} else if (scale=='c'|| scale=='C') {degrees=enteredtemp+273.15;} else if (scale=='F'||scale=='f'){degrees=((enteredtemp+459.67)*9/5);}
has answer: http://stackoverflow.com/a/25703522
has answer: http://stackoverflow.com/a/25703535
downvote count: 0
has answer: http://stackoverflow.com/a/25705502
score: 1
upvote count: 1
tagged with: variables

http://stackoverflow.com/q/25703092
has comment: http://stackoverflow.com/comment/40179734
score: 2
type: AnsweredQuestion
has body: I am creating an RSA signature on Android like this: Signature signature = Signature.getInstance("SHA512withRSA"); // With what private key? signature.initSign(privateKey); // What document to Sign? signature.update(BYdocument); // Give me the signed document byte[] BYsignedDocument = signature.sign(); Document and signature are packed in separated files. User must input the signature manually. This is why I am trying to stop them from inputting something that is not a signature. How do I check, if the signature BYsignedDocument is actually a signature without the need of the public key or the document?
upvote count: 2
has comment: http://stackoverflow.com/comment/40176276
has title: How to test if byte[] is a SHA512withRSA signature?
answer count: 1
has comment: http://stackoverflow.com/comment/40178040
downvote count: 0
has comment: http://stackoverflow.com/comment/40176204
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25703902
has comment: http://stackoverflow.com/comment/40417415
has comment: http://stackoverflow.com/comment/40177676
has comment: http://stackoverflow.com/comment/40177745
has comment: http://stackoverflow.com/comment/40176422
has answer: http://stackoverflow.com/a/25703902
tagged with: android
tagged with: java
tagged with: sha512
tagged with: cryptography
has comment: http://stackoverflow.com/comment/40176370
has comment: http://stackoverflow.com/comment/40179637
has comment: http://stackoverflow.com/comment/40177049
tagged with: digital-signature

http://stackoverflow.com/a/25571755
has comment: http://stackoverflow.com/comment/39937423
has comment: http://stackoverflow.com/comment/39939769
has comment: http://stackoverflow.com/comment/39939734
accepted answer of: http://stackoverflow.com/q/25570391
type: Answer
has body: The excludeParams is a property of the params interceptor and should be referenced like this .*?checkbox.* Note, if you use interceptor-ref tag on the action then it overrides the default interceptor stack and applicable only to this action config. For common usage consider creating a custom interceptor stack and make it default for any action configuration. You can set a logging level for interceptors and OGNL. Using log4j.properties log4j.logger.com.opensymphony.xwork2.interceptor=ERROR log4j.logger.com.opensymphony.xwork2.ognl=ERROR
answers question: http://stackoverflow.com/q/25570391
downvote count: 0
has comment: http://stackoverflow.com/comment/39939951
upvote count: 1
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39940756
has comment: http://stackoverflow.com/comment/39937125

http://stackoverflow.com/comment/40130907
type: Comment
has text: Thanks AntonH for the correction with the "Double.MIN_VALUE." This helps in case the value is a negative. Turns out I forgot a line of code as well.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25678284

http://stackoverflow.com/comment/39953200
type: AnswerComment
comment on: http://stackoverflow.com/a/25580538
has text: Is there s solution without third party libraries?
score: 0
type: Comment

http://stackoverflow.com/comment/39966177
type: AnswerComment
has text: @StephenC *Non sequitur.* A literal can also be used as a primary expression: that doesn't mean it *is* an expression.
score: 0
comment on: http://stackoverflow.com/a/25578181
type: Comment

jdbc
tags question: http://stackoverflow.com/q/25592524
tags question: http://stackoverflow.com/q/25567687
tags question: http://stackoverflow.com/q/25711970
tags question: http://stackoverflow.com/q/25592412
tags question: http://stackoverflow.com/q/25585218
tags question: http://stackoverflow.com/q/25684106
tags question: http://stackoverflow.com/q/25638134
tags question: http://stackoverflow.com/q/25677028
tags question: http://stackoverflow.com/q/25679372
tags question: http://stackoverflow.com/q/25631184
tags question: http://stackoverflow.com/q/25704522
tags question: http://stackoverflow.com/q/25600907
tags question: http://stackoverflow.com/q/25580798
tags question: http://stackoverflow.com/q/25699578
tags question: http://stackoverflow.com/q/25592047
tags question: http://stackoverflow.com/q/25619803
tags question: http://stackoverflow.com/q/25609022
tags question: http://stackoverflow.com/q/25631839
tags question: http://stackoverflow.com/q/25706875
tags question: http://stackoverflow.com/q/25610848
tags question: http://stackoverflow.com/q/25573034
tags question: http://stackoverflow.com/q/25663918
tags question: http://stackoverflow.com/q/25615641
tags question: http://stackoverflow.com/q/25610964
tags question: http://stackoverflow.com/q/25582698
tags question: http://stackoverflow.com/q/25679841
tags question: http://stackoverflow.com/q/25592162
tags question: http://stackoverflow.com/q/25615423
tags question: http://stackoverflow.com/q/25579630
tags question: http://stackoverflow.com/q/25699316
tags question: http://stackoverflow.com/q/25705762
tags question: http://stackoverflow.com/q/25709265
type: Tag
tags question: http://stackoverflow.com/q/25622301
tags question: http://stackoverflow.com/q/25658594
tags question: http://stackoverflow.com/q/25583113
tags question: http://stackoverflow.com/q/25599646
tags question: http://stackoverflow.com/q/25591826
tags question: http://stackoverflow.com/q/25623153
tags question: http://stackoverflow.com/q/25580210
tags question: http://stackoverflow.com/q/25607603
tag name: jdbc
tags question: http://stackoverflow.com/q/25684276
tags question: http://stackoverflow.com/q/25567813
tags question: http://stackoverflow.com/q/25630395
tags question: http://stackoverflow.com/q/25703759
tags question: http://stackoverflow.com/q/25675672
tags question: http://stackoverflow.com/q/25570907
tags question: http://stackoverflow.com/q/25579301
tags question: http://stackoverflow.com/q/25559417
tags question: http://stackoverflow.com/q/25601393
tags question: http://stackoverflow.com/q/25676280
tags question: http://stackoverflow.com/q/25659577
tags question: http://stackoverflow.com/q/25704182
tags question: http://stackoverflow.com/q/25694736
tags question: http://stackoverflow.com/q/25632460
tags question: http://stackoverflow.com/q/25677856
tags question: http://stackoverflow.com/q/25584275
tags question: http://stackoverflow.com/q/25617726
tags question: http://stackoverflow.com/q/25651120
tags question: http://stackoverflow.com/q/25711515
tags question: http://stackoverflow.com/q/25687972
tags question: http://stackoverflow.com/q/25656440
tags question: http://stackoverflow.com/q/25705278
tags question: http://stackoverflow.com/q/25567966
tags question: http://stackoverflow.com/q/25689587

http://stackoverflow.com/comment/40088138
has text: Redesign what? code or LDAP structure ?
comment on: http://stackoverflow.com/q/25649918
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25650708
has title: Java: How to do bitwise multiplication?
has answer: http://stackoverflow.com/a/25650740
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
type: Question
has body: I am learning to generate all Subsets of a set, and try to convert the following C program #include &lt;stdio.h&gt; #include &lt;math.h&gt; void printPowerSet(char *set, int set_size) { /*set_size of power set of a set with set_size n is (2**n -1)*/ unsigned int pow_set_size = pow(2, set_size); int counter, j; /*Run from counter 000..0 to 111..1*/ for(counter = 0; counter &lt; pow_set_size; counter++) { for(j = 0; j &lt; set_size; j++) { /* Check if jth bit in the counter is set If set then pront jth element from set */ if(counter &amp; (1&lt;&lt;j)) printf("%c", set[j]); } printf("\n"); } } /*Driver program to test printPowerSet*/ int main() { char set[] = {'a','b','c'}; printPowerSet(set, 3); getchar(); return 0; } Reference: http://www.geeksforgeeks.org/power-set/ My code looks like private static void printAllSubsets(final Set&lt;Integer&gt; set) { final int subsetSize = (int) Math.pow(2, set.size()); for (int counter = 0; counter&lt; subsetSize; counter++) { for (int i = 0; i&lt;set.size(); i++) { if(counter &amp; (1 &lt;&lt; i)) { } } } } but I get compilation error on if(counter &amp; (1 &lt;&lt; i)) as Required boolean Found int How can I achieve the same result as in C code here? I do not understand how bitwise operations are going on here Thanks
has comment: http://stackoverflow.com/comment/40080929
accepted answer: http://stackoverflow.com/a/25650740

http://stackoverflow.com/q/25653702
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: mysql
tagged with: executorservice
tagged with: scheduled-tasks
has body: I want to use Java's ScheduledExecutorService to schedule a delayed service to delete some rows in the database given the expiration date. But I found that even after the specified expiration date, the row in the database is not deleted. So the schedule task is not executed. My code is as follows: public int addNewGroup(final String groupName, Category category, Timestamp expireDate) { String sqlQuery = "INSERT INTO Groups (name, category, expireDate) VALUES (?, ?, ?)"; int numRows = jdbcTemplate.update(sqlQuery, new Object[] { groupName, category.toString(), expireDate }); //schedule the deleting temporary group task if (category == Category.temp) { final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); Runnable task = new Runnable() { @Override public void run() { String query = "DELETE FROM Groups WHERE name=?"; jdbcTemplate.update(query, new Object[] {groupName}); } }; scheduler.schedule(task, expireDate.getTime()-System.currentTimeMillis(), TimeUnit.MILLISECONDS); } return numRows; } This is my test code to insert a record to the DB which has an expiration date: public class StoregroupDaoTest { private StoregroupDao dao; @Before public void setup() { ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); dao = context.getBean(StoregroupDao.class); } @Test public void testAdd() { String groupName = "ABC"; Category category = Category.temp; @SuppressWarnings("deprecation") Timestamp expireTime = new Timestamp(114, 8, 3, 16, 57, 0, 0); //2014-09-03 16:57:00 int numRows = dao.addNewGroup(groupName, category, expireTime); } } The record is inserted to the DB. It is expected to be deleted by the scheduled task given above after the expiration time. But after the specified expiration time, when I queried the DB, the record is still there and is not deleted. So it seems that the schedule task is not executed at all. What is the problem here?
type: Question
has title: Why can't I schedule a fixed delay task using scheduler
answer count: 1
accepted answer: http://stackoverflow.com/a/25653794
has answer: http://stackoverflow.com/a/25653794

http://stackoverflow.com/a/25561730
type: Answer
has comment: http://stackoverflow.com/comment/39919095
score: 0
has body: Try this way,hope this will help you to solve your problem. Intent intent = new Intent(); intent.setClass(MainActivity.this, "YourPackageName.Line"); startActivity(intent); <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
answers question: http://stackoverflow.com/q/25561307
has comment: http://stackoverflow.com/comment/39920319

http://stackoverflow.com/q/25676631
has answer: http://stackoverflow.com/a/25676957
answer count: 3
tagged with: android-fragments
tagged with: java
tagged with: android-2.3-gingerbread
has answer: http://stackoverflow.com/a/25676713
possible better answer: http://stackoverflow.com/a/25676713
type: Question
has comment: http://stackoverflow.com/comment/40127851
tagged with: android
has title: Get User Android Version
has answer: http://stackoverflow.com/a/25676675
accepted answer: http://stackoverflow.com/a/25676675
has body: is there any way for my application to get the user's Android Version or API Level ? .. because i am working on an app that supports API 9 (2.3 Gingerbread) .. and since API 9 does not support DialogFragments even with android.support.v4.app.DialogFragment imported, i decided to do an if else statement instead if (the users Android Version is Lower than API 11) { i will show a new class instead of a Dialog Fragment containing all information about the developer } else if (the users Android Version is Higher than or equal to API 11) { my dialog fragment will show up containing all information about the developer } i hope anyone can help me out about this, thanks :)
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/25587173
downvote count: 0
type: Answer
has body: You can't call a non-static method from a static method. You can call it by creating an instance first. public static void main(String[] args){ deleteAfter instance = new deleteAfter(); instance.printed(); } You don't need the super keyword though. You only need the super keyword if you want to extend the implementation of the printed method in your sub-class : public void printed() { super.printed(); // some additional logic }
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/39965174
answers question: http://stackoverflow.com/q/25587158
has comment: http://stackoverflow.com/comment/39965219
has comment: http://stackoverflow.com/comment/39965096

http://stackoverflow.com/q/25599616
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39987869
possible better answer: http://stackoverflow.com/a/25599729
has answer: http://stackoverflow.com/a/25599729
has body: I'm trying to animate an object to move back and forth between two boundaries. For instance, once the x coordinate of the object reaches 500 it moves in the opposite direction to 200 and then moves back again until it reaches 500 and so on. However, the rectangle will only move to 500 and then stop. Here is a simplified version of my code: public class Test { public static class Game extends JComponent implements ActionListener { int width=100; int height=100; int x=300; int y=200; Timer timer; public Game() { timer = new Timer(20,this); timer.start(); } public void paint(Graphics g) { g.drawRect(x,y,width,height); g.setColor(Color.red); g.fillRect(x,y,width,height); } public void actionPerformed(ActionEvent e) { if(x&gt;100) { x+=5; } if(x&gt;500) { x-=5; } repaint(); } } public static void main(String[] args) { JFrame frame = new JFrame("Test"); frame.setPreferredSize(new Dimension(800,600)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Game()); frame.pack(); frame.setVisible(true); } }
has title: Java, Move Rectangle Back and Forth
type: Question
has comment: http://stackoverflow.com/comment/39987917
tagged with: java
accepted answer: http://stackoverflow.com/a/25599703
has comment: http://stackoverflow.com/comment/39987909
has comment: http://stackoverflow.com/comment/39987938
has answer: http://stackoverflow.com/a/25599703
has comment: http://stackoverflow.com/comment/39987958
has comment: http://stackoverflow.com/comment/39987935
type: AnsweredQuestion

http://stackoverflow.com/comment/39954566
score: 0
has text: @IanRoberts yes, I can use XSLT 2.0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25581145

http://stackoverflow.com/comment/39981619
has text: I have updated my answer with complete Java Class to do exactly what you want. See the output. Don't forget to mark the question as Resolved.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25586525
type: Comment

http://stackoverflow.com/comment/40067944
score: 1
type: Comment
type: QuestionComment
has text: The point of the question is to figure out exactly what you trying to accomplish. KeyEvents are used with GUI Programs. So say you have a Player in a console program, And you type a key. Nothing will happen. That's why I asked again, What are you trying to accomplish
comment on: http://stackoverflow.com/q/25643167

http://stackoverflow.com/comment/40011688
has text: `the client reads this from STDIN and sends to server via socket.` I get that part but what about when the client has to get a response/data from the server? It would read from the server's `stdIn` right?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25612693

http://stackoverflow.com/q/25608785
has title: apache-camel throttle does not work as expected
accepted answer: http://stackoverflow.com/a/25608941
has body: Apache-Camel: 2.12.2, activemq: 5.7 We noticed that in the following route throttling works fine for the first 100 exchanges. After that instead of sending 100 exchanges per second, it sends only 1 exchange per second. Now if we set timePeriodMillis=100 it seems to be working fine. Note that we send 500 exchanges at the same time. <property name="connectionFactory" ref="myProjectPooledConnectionFactory" /> <property name="preserveMessageQos" value="true" /> <property name="transacted" value="false" /> <property name="maxConcurrentConsumers" value="10" /> <property name="connectionFactory" ref="myProjectAmqConnectionFactory" /> <property name="maxConnections" value="20" /> <property name="idleTimeout" value="0" /> <property name="brokerURL" value="${myProject.broker.url}" /> <property name="copyMessageOnSend" value="false" /> <property name="useAsyncSend" value="true" /> <property name="connectionFactory" ref="pooledConnectionFactory"/> <property name="transacted" value="false"/> <property name="maxConcurrentConsumers" value="500"/> <property name="connectionFactory" ref="amqConnectionFactory" /> <property name="maxConnections" value="1" /> <property name="idleTimeout" value="0" /> <property name="brokerURL" value="${broker.url}" /> <property name="copyMessageOnSend" value="false" /> <property name="useAsyncSend" value="true" /> <from uri="{{queue.myProject.mint.in}}{{queue.myProject.mint.in.args}}"/> 100 <process ref="myProjectProcessor" /> <inOnly uri="myProject:{{queue.myProject}}"> <log logName="myProject.myProjectProcessor" loggingLevel="INFO" message="this is a test message" />
favorite count: 0
type: Question
tagged with: throttling
has answer: http://stackoverflow.com/a/25608941
tagged with: apache-camel
tagged with: spring
type: AnsweredQuestion
downvote count: 0
tagged with: activemq-classic
upvote count: 1
score: 1
tagged with: java
answer count: 1

http://stackoverflow.com/comment/40044414
type: Comment
comment on: http://stackoverflow.com/a/25626212
has text: Looking into this problem further. map is an object of class jMapViewer. This stores a list of map markers in a List<MapMarker>. It then iterates through this to redraw the map markers. The problem appears to be that the map.removeAllMarkers() removes them while this is happening.
type: AnswerComment
score: 0

http://stackoverflow.com/q/25564045
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25564185
has title: Sending message to multiple consumer in ActiveMQ
favorite count: 0
has answer: http://stackoverflow.com/a/25564185
type: Question
possible better answer: http://stackoverflow.com/a/25588781
score: 2
has comment: http://stackoverflow.com/comment/39925838
has answer: http://stackoverflow.com/a/25588781
has comment: http://stackoverflow.com/comment/39921979
has body: I am new to ActiveMQ. I have tried to implement producer-consumer (sender-receiver) in activemq. In my code, I am easily send &amp; receive the messages from single producer to single consumer via ActiveMQ. But, the problem is, I can't send the message to multiple consumers from the same producer. Here is my producer &amp; consumer class. MsgProducer.java package jms_service; import javax.jms.JMSException; import javax.jms.Session; import javax.jms.TextMessage; import org.apache.activemq.ActiveMQConnectionFactory; public class MsgProducer { private static String url = "failover://tcp://localhost:61616"; public static javax.jms.ConnectionFactory connFactory; public static javax.jms.Connection connection; public static javax.jms.Session mqSession; public static javax.jms.Topic topic; public static javax.jms.MessageProducer producer; public static void main(String[] args) throws JMSException { connFactory = new ActiveMQConnectionFactory(url); connection = connFactory.createConnection("system","manager"); connection.start(); mqSession = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); topic = mqSession.createTopic("RealTimeData"); producer = mqSession.createProducer(topic); producer.setTimeToLive(30000); TextMessage message = mqSession.createTextMessage(); int seq_id =1; while(true) { message.setText("Hello world | " +"seq_id #"+seq_id); producer.send(message); seq_id++; System.out.println("sent_msg =&gt;&gt; "+ message.getText()); // if(seq_id&gt;100000) break; try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace();} } } } MsgConsumer.java package jms_service; import java.text.SimpleDateFormat; import java.util.Calendar; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.Session; import javax.jms.TextMessage; import org.apache.activemq.ActiveMQConnectionFactory; public class MsgConsumer { private static String url = "failover://tcp://localhost:61616"; public static javax.jms.Con…
downvote count: 1
has comment: http://stackoverflow.com/comment/39922610
has answer: http://stackoverflow.com/a/60826167
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39922548
answer count: 3
tagged with: activemq-classic

http://stackoverflow.com/q/25675868
tagged with: regex
has comment: http://stackoverflow.com/comment/40126646
score: 0
answer count: 2
has body: Title may not be clear, but what I am trying to do is: For a sample line of a text file (that may be a program): public static void main(String[] args){ I want to build an array of every string as well as each symbol used. In this line case I want: ArrayList x = ["public", "static", "void", "main", "(", "String","[","]","args",")","{"] My first thought was to: Split the string on whitespaces and all symbols to get all the strings with characters. Add these to arraylist Split the original line on characters or something to get the symbols Add to arraylist Any ideas on the best way to do this? I can't really see a clear solution.
tagged with: java
has answer: http://stackoverflow.com/a/25676197
has comment: http://stackoverflow.com/comment/40126737
has comment: http://stackoverflow.com/comment/40126741
type: Question
has answer: http://stackoverflow.com/a/25676719
type: UnansweredQuestion
has title: Java - processing a text file to identify each string delimited by a whitespace or a symbol
has comment: http://stackoverflow.com/comment/40126736

http://stackoverflow.com/q/25643370
favorite count: 0
has comment: http://stackoverflow.com/comment/40067542
type: Question
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/40103639
has answer: http://stackoverflow.com/a/30951782
has comment: http://stackoverflow.com/comment/40067241
tagged with: netbeans
score: 3
has title: Can't see Sinhala Unicode characters in NetBeans
answer count: 2
has comment: http://stackoverflow.com/comment/40095001
has body: I tried to print Sinhala characters in NetBeans 7.1 Java application.(In windows 7) Other languages like Chinese and Urdu .. etc will show the correct character. But Sinhala characters are not displaying correctly. It will display as little boxes both in the code and the output. though here in SO it show as "සිංහල" . How can I fix it ? I can do this without a problem in eclipse environment. String a = "世界你好"; System.out.println(a); System.out.println("कई"); // sinhala char c = '\u0D85'; System.out.println(c); System.out.println("\u0D85"); System.out.println("සිංහල"); System.out.println(java.nio.charset.Charset.defaultCharset().name()); I tried changing the Sources -> Encoding type to UTF-8. and now my netbeans.conf file I changed netbeans_default_options and added -J-Dfile.encoding=UTF-8 like below netbeans_default_options="-J-Dfile.encoding=UTF-8 -J-Dorg.netbeans.modules.tomcat.autoregister.token=1378930362898 -J-Dorg.netbeans.modules.tomcat.autoregister.catalinaHome=\"C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.20\" -J-Dorg.glassfish.v3ee6.installRoot=\"C:\Program Files\sges-v3\" -J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true" How can I fix this. ?
has answer: http://stackoverflow.com/a/61541465
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40084601
tagged with: utf-8
has comment: http://stackoverflow.com/comment/40078655
tagged with: unicode

http://stackoverflow.com/a/25574864
type: Answer
answers question: http://stackoverflow.com/q/25553180
score: 0
has body: I ended up creating a new database in my SharedPreferences to store only checked apps. Here is my BaseAdapter class: package com.ibc.android.demo.appslist.app; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.TextView; import com.spicycurryman.getdisciplined10.app.R; import java.util.HashSet; import java.util.List; // public class ApkAdapter extends BaseAdapter { //Pastebin link: http://pastebin.com/LGRicg4U , http://pastebin.com/c4WfmhMK , http://pastebin.com/gFuuM4dY, http://pastebin.com/4Q7EP9G4 // http://pastebin.com/Te2g072w, http://pastebin.com/NLT5iUiA , SharedPreferences sharedPrefs; SharedPreferences sharedPrefsapp; List&lt;PackageInfo&gt; packageList; Activity context; PackageManager packageManager; boolean[] itemChecked; HashSet checked; String PACKAGE_NAME; public ApkAdapter(Activity context, List&lt;PackageInfo&gt; packageList, PackageManager packageManager) { super(); this.context = context; this.packageList = packageList; this.packageManager = packageManager; itemChecked = new boolean[packageList.size()]; } private class ViewHolder { TextView apkName; CheckBox ck1; TextView packageName; } public int getCount() { return packageList.size(); } public Object getItem(int position) { return packageList.get(position); } public long getItemId(int position) { return 0; } @Override public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder holder; LayoutInflater inflater = context.getLayoutInflater(); if (convertView == null) { convertView = inflater.inflate(R.layout.installed_apps, null); holder = new ViewHolder(); holder.apkName …

http://stackoverflow.com/comment/40096891
has text: What do you mean by handling ?
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25659395
type: QuestionComment

join
type: Tag
tag name: join
tags question: http://stackoverflow.com/q/25692601
tags question: http://stackoverflow.com/q/25654463

http://stackoverflow.com/comment/40071819
type: AnswerComment
comment on: http://stackoverflow.com/a/25637740
has text: Take a look at `SolutionDao` and `XStreamSolutionDao` in optaplanner-examples
score: 0
type: Comment

http://stackoverflow.com/a/25689267
has comment: http://stackoverflow.com/comment/40150649
has comment: http://stackoverflow.com/comment/40150689
score: 2
upvote count: 2
downvote count: 0
has body: In some problems the answers are very big numbers, but forcing you to implement long arighmetics is not the purpose of the problem authors. Therefore they ask you to calculate answer modulo some number, like 1000000007, so you don't have to implement long arithmetics, but the answer is still verifiable.
has comment: http://stackoverflow.com/comment/40150810
answers question: http://stackoverflow.com/q/25689186
type: Answer

http://stackoverflow.com/comment/128692438
type: Comment
type: QuestionComment
has text: Now, in 2022 it seems like this eventually happened. Documentation is so old and relies on deprecated Spring components.
score: 0
comment on: http://stackoverflow.com/q/25685484

http://stackoverflow.com/q/25584562
has title: How do I Modify JLabels in a Window without ActionListener?
favorite count: 0
has comment: http://stackoverflow.com/comment/39960682
type: Question
tagged with: jlabel
tagged with: jframe
possible better answer: http://stackoverflow.com/a/25586927
has comment: http://stackoverflow.com/comment/39960593
accepted answer: http://stackoverflow.com/a/25584812
tagged with: swing
score: -1
has answer: http://stackoverflow.com/a/25584812
has answer: http://stackoverflow.com/a/25586927
has body: I have a question about JLabels. I am trying to program an application that has a window (Set up with JFrame.) with many JLabels. Anyway, I was wondering if there was a way I could have the window show, then modify the JLabels' text. The problem I am having is that the window won't show up until the program reaches the end of the class. Is there a way I can get around that? Do I have to use a Thread? If so, how would I do that. Thanks, ~Rane Example: public class Start extends JFrame{ private static final long serialVersionUID = 1L; Random random = new Random(); JPanel panel = new JPanel(); JLabel label = new JLabel("Label"); panel.add(label); add(panel); while(true){ int rnd = random.nextInt(4); label.setText("" + rnd); } } // I want to do that, but the window won't show until the loop ends. In this case, the loop // never will end. How would I do something like this if not the same exact thing?
type: AnsweredQuestion
answer count: 2
tagged with: while-loop
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39960400
downvote count: 1

http://stackoverflow.com/q/25692372
has body: For a project I'm working on, I try to create a multi-dimensional pivot on large data sets. I have all the keys I want to use as ints, so basically, I want to return a set of ( int1, int2, int3, .. intN ) -&gt; (Aggregate1, Aggregate2, ... , AggregateM) I cannot use a N-dimensional array, as it might get huge and probably will be sparse. I've looked a Trove, but they do not have a Multi-key map. Apache commons has a multi-key map, but that is for Objects; that would probably work, but seems less interesting as the ints will get auto-boxed to Integers and vice versa. Does anyone know of a primitive multi-key map implementation? (That maps to objects?) Or, does anyone have great hints, maybe there is a better approach to my problem? [edit] Insertion time is less interesting, I need the performance on the lookup, as the map will be heavily used to lookup values. [edit2] Thanks for all the answers. My implemenation choice is a custom class containing an int[], immutable so the hashcode can be calculated on construction time. private static class MultiIntKey { int[] ints; private int hashCode; MultiIntKey( int[] ints ) { this.ints = ints; this.hashCode = Arrays.hashCode( this.ints ); } @Override public int hashCode() { return this.hashCode; } @Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( this.getClass() != obj.getClass() ) { return false; } MultiIntKey other = (MultiIntKey) obj; if ( this.hashCode != other.hashCode ) { return false; } if ( !Arrays.equals( this.ints, other.ints ) ) { return false; } return true; } }
has comment: http://stackoverflow.com/comment/40161260
has answer: http://stackoverflow.com/a/25692456
linked to: http://stackoverflow.com/q/1855170
has comment: http://stackoverflow.com/comment/40280854
has comment: http://stackoverflow.com/comment/40156885
has comment: http://stackoverflow.com/comment/40280790
has comment: http://stackoverflow.com/comment/40159725
has comment: http://stackoverflow.com/comment/40156920
upvote count: 1
has title: Fast primitive int multi-key map?
tagged with: dictionary
has comment: http://stackoverflow.com/comment/40156848
tagged with: multikey
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25692704
linked to: http://stackoverflow.com/q/15582944
tagged with: performance
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40156817
downvote count: 0
accepted answer: http://stackoverflow.com/a/25693118
has comment: http://stackoverflow.com/comment/40303701
has comment: http://stackoverflow.com/comment/40158231
has answer: http://stackoverflow.com/a/25693118
possible better answer: http://stackoverflow.com/a/25692704
answer count: 4
has answer: http://stackoverflow.com/a/25693065
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40324618

http://stackoverflow.com/q/25620446
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/58975956
has answer: http://stackoverflow.com/a/26556339
score: 8
type: Question
answer count: 2
tagged with: android-gradle-plugin
has comment: http://stackoverflow.com/comment/57110692
accepted answer: http://stackoverflow.com/a/26556339
downvote count: 0
has answer: http://stackoverflow.com/a/32474635
has body: I am writing an android sdk and I now want to distribute it but I am having problems with its dependencies. I am using gradle and android studio. My sdk has a dependency on volley and gson and I have them added as jars with in my sdk. When ever I try to create an aar or a jar to use within a separate client app I always get a crash when ever my sdk tries to reference volley as it wasnt included in either the aar or jar. Any ideas on how I should be doing this? I have looked into creating fat jars with out much success. I have also tried using remote dependencies like below but even after a gradle build in the client app both volley and gson are still not included. This is currently what I have in my sdk build.gradle dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.mcxiaoke.volley:library-aar:1.0.0' compile 'com.google.code.gson:gson:2.3' } then with in the client build gradle I have repositories { flatDir { dirs 'libs' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile(name:'mysdk-1.0.0', ext:'aar') } I am using ./gradlew clean build to build the aar and jar of my sdk Can anyone tell me the correct way to include dependencies in my own lib?
favorite count: 0
type: AnsweredQuestion
has title: How do I include dependencies in my android library
upvote count: 8
possible better answer: http://stackoverflow.com/a/32474635

http://stackoverflow.com/comment/94261651
has text: Thanks @DrunkenPoney, fixed now
comment on: http://stackoverflow.com/a/25688306
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39940922
has text: I tought using streams would be simpler. - I can't edit my previous comment, I meant A is a random 64 byte array generator
type: AnswerComment
comment on: http://stackoverflow.com/a/25572302
score: 0
type: Comment

http://stackoverflow.com/comment/39962913
has text: Looking at your classpath, I see `C:\j2sdkee1.3\lib\j2ee.jar`. This sounds like you are using a *very* out-dated version of Java EE. I'm not much into Java's history, but maybe the `ConnectionPool` class didn't exist in there (did this ever work before or are you using such an old jdk on your machine only?). I'd also not recommend using such an old version, though upgrades can be tricky if the codebase is old and/or bad.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25585707

http://stackoverflow.com/a/25611057
score: 1
has body: Using the following expressions matches the video-id and title fine in your given example. ID: "data-video-id=\"([^\"]+)\"" Title: "data-title=\"([^\"]+)\""
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25610966

http://stackoverflow.com/q/25617763
tagged with: jinfo
has comment: http://stackoverflow.com/comment/40032930
has body: When I run jinfo or jmap to any Java process, it will "suspend" the Java process. It's 100% reproduced for the long running processes. Here're the detailed steps: Pick a Java process which is running over 25 days(It's wired because this doesn't work for new processes). Run ps to check the state of the process, should be "Sl" which is expected. Run jinfo or jmap to this process(BTY, jstack doesn't have this issue). Run ps to check the state of the process. This time it changes to "Tl" which means STOPPED and the process doesn't response any requests. Here's the output of our process: [work@hadoop ~]$ ps aux |grep "qktst" |grep "RegionServer" work 36663 0.1 1.7 24157828 1150820 ? Sl Aug06 72:54 /opt/soft/jdk/bin/java -cp /home/work/app/hbase/qktst-qk/regionserver/:/home/work/app/hbase/qktst-qk/regionserver/package//:/home/work/app/hbase/qktst-qk/regionserver/package//lib/*:/home/work/app/hbase/qktst-qk/regionserver/package//* -Djava.library.path=:/home/work/app/hbase/qktst-qk/regionserver/package/lib/native/:/home/work/app/hbase/qktst-qk/regionserver/package/lib/native/Linux-amd64-64 -Xbootclasspath/p:/home/work/app/hbase/qktst-qk/regionserver/package/lib/hadoop-security-2.0.0-mdh1.1.0.jar -Xmx10240m -Xms10240m -Xmn1024m -XX:MaxDirectMemorySize=1024m -XX:MaxPermSize=512m -Xloggc:/home/work/app/hbase/qktst-qk/regionserver/stdout/regionserver_gc_20140806-211157.log -Xss256k -XX:PermSize=64m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/work/app/hbase/qktst-qk/regionserver/log -XX:+PrintGCApplicationStoppedTime -XX:+UseConcMarkSweepGC -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:SurvivorRatio=6 -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+CMSParallelRemarkEnabled -XX:+UseNUMA -XX:+CMSClassUnloadingEnabled -XX:CMSMaxAbortablePrecleanTime=10000 -XX:TargetSurvivorRatio=80 -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=100 -XX:GCLogFileSize=128m -XX:CMSWaitDuration=2000 -XX:+CMSScave…
tagged with: jvm
has comment: http://stackoverflow.com/comment/40032478
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40034378
tagged with: jvm-hotspot
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5287010
has comment: http://stackoverflow.com/comment/40027582
has comment: http://stackoverflow.com/comment/40030041
tagged with: jmap
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40034118
downvote count: 0
answer count: 0
has title: Disastrous bug when running jinfo and jmap
has comment: http://stackoverflow.com/comment/40029810
tagged with: java

http://stackoverflow.com/q/25624644
downvote count: 0
upvote count: 1
tagged with: maven
has answer: http://stackoverflow.com/a/25624878
has body: I have a new app, the pom for which has parent tags and all. I have to include in this app another dependency whose parent is different than the current apps parent. The problem is the version tag for the new dependency. The current pom : <?xml version="1.0" encoding="UTF-8" standalone="no"?> <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 abc-pom com.abc 4.480.0-SNAPSHOT ../../pom.xml com.abc.libs dynamixSession jar dynamixSession ..... ..... com.pqr.someOtherProject SomeCoreProcessing 4.2.14.2-SNAPSHOT provided This pom works. Since I am hardcoding version number here, do I need to update this pom everytime the version changes ? Or will it be updated automatically. But I doubt that it updates automatically. I would like to use '${project.version}' so that I don't have to update it. But if I use '${project.version}' it tries to look for 'com.pqr.someOtherProject.SomeCoreProcessing:4.480.0-SNAPSHOT', which is not existing. Is there a way arround this or am I stuck with harcoding the version in my pom ? Thanks
type: AnsweredQuestion
has title: Maven - using version in the dependency
score: 1
tagged with: java
tagged with: dependencies
accepted answer: http://stackoverflow.com/a/25624745
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25624745
answer count: 2
possible better answer: http://stackoverflow.com/a/25624878

http://stackoverflow.com/comment/42252957
comment on: http://stackoverflow.com/q/25675626
type: QuestionComment
has text: Hi Alasdair, I've just added snippets you want. Only the `queue` is missing, which is pulled via JNDI. Transaction manager is configured as `<tx:jta-transaction-manager />`.
score: 0
type: Comment

http://stackoverflow.com/comment/40105926
comment on: http://stackoverflow.com/a/25660676
type: Comment
has text: Correct, sorry my bad
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40040874
has text: are you having the json jar in your classspath?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25628407
type: Comment

jackson-modules
type: Tag
tags question: http://stackoverflow.com/q/25650678
tag name: jackson-modules

http://stackoverflow.com/comment/40078289
type: AnswerComment
score: 0
has text: Thanks for the reply. Any tutorial? I have never worked with it.
type: Comment
comment on: http://stackoverflow.com/a/25649188

orientdb
tags question: http://stackoverflow.com/q/25601318
tag name: orientdb
tags question: http://stackoverflow.com/q/25698164
type: Tag

http://stackoverflow.com/comment/39932450
has text: I had also the same problem, but the solution for me was that the library that im referencing had a jar file library that i also referenced in the main project. so there was a conflict by their v4 package. I had to remove the library referenced by that project and referenced it from the projects that have been imported in my eclipse.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25568407
type: QuestionComment

http://stackoverflow.com/a/25605646
type: Answer
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25605254
has body: Is there is any different to put most possible true condition in if, else-if or else condition Actually, the answer with Java is that "it depends". You see, when you run Java code, the JVM starts out by using the using the interpreter while gathering statistics. One of the statistics that may be recorded is which of the paths in a branch instruction is most often taken. These statistics could then used by the JIT compiler to influence code reordering, where this does not alter the compiled code's semantics. So if you were to execute your code, with two different datasets (i.e. "mostly zero" and "mostly non-zero"), it is possible that the JIT compiler would compile the code differently. Whether it can actually make this optimization depends on whether it can figure out that the reordering is valid. For example, can it deduce that the conditions being tested are mutually exclusive? So how does this affect the complexity? Well ... lets do the sums for your simplified example, assuming that the JIT compiler doesn't do anything "smart". And assume that we are not just dealing with arrays of length 10 (which renders the discussion of complexity moot). Consider this: For each zero, the loop does one test and one increment - say 2 operations. For each non-zero element, the loop does two tests and one increment - say 3 operations. So that is roughly 2N operations for N elements when all zero versus 3N operations when all non-zero. But both are O(N) ... so the Big O complexity is not affected. (OK I left some stuff out ... but you get the picture. One of the cases is going to be faster, but the complexity is not affected.)
answers question: http://stackoverflow.com/q/25605254
score: 6
upvote count: 6

http://stackoverflow.com/q/25691419
tagged with: swt
has answer: http://stackoverflow.com/a/25691652
possible better answer: http://stackoverflow.com/a/25691652
type: AnsweredQuestion
score: 0
has body: I have an SWT Text control. I am trying to figure out how to listen for when the user is finished modifying the control, ie it is modified and then tabbed out of. I don't want my listener to be called every time a character changes in the textbox, and I don't want it to be called when the user traverses through the fields on the page. I only want it when the user modifies and then leaves the control. I've looked at the various listeners available for the Text control, but unless I'm missing something, I don't see anything like this. Did I miss it?
has title: Can I fire event only when user finishes modifying Text widget?
tagged with: java
has answer: http://stackoverflow.com/a/25718247
accepted answer: http://stackoverflow.com/a/25718247
type: Question
tagged with: listener
answer count: 2

http://stackoverflow.com/a/25609940
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25609818
has comment: http://stackoverflow.com/comment/40016335
accepted answer of: http://stackoverflow.com/q/25609818
type: Answer
has body: If any change is detected in the call state the of the device,(I assume that you know how to register a listener to listen to call states) call back function - public void onCallStateChanged(int state, String incomingNumber) is triggered, with the state and incoming number. Various states are - CALL_STATE_IDLE, CALL_STATE_OFFHOOK, and CALL_STATE_RINGING 1) IDLE – when there is no incoming call 2) OFFHOOK – when the line is busy 3) RINGING – when call is incoming The "TUUUU TUUUUU" sound you are talking about, is the functionality provided by the network provider and you CAN'T do anything related to that.
has comment: http://stackoverflow.com/comment/40010115
score: 0

maven-nar-plugin
tag name: maven-nar-plugin
tags question: http://stackoverflow.com/q/25614139
type: Tag

http://stackoverflow.com/q/25645760
tagged with: function
tagged with: java
tagged with: nested
has comment: http://stackoverflow.com/comment/40072688
has comment: http://stackoverflow.com/comment/40072967
tagged with: parsing
type: Question
has comment: http://stackoverflow.com/comment/40072224
has title: Java code parser for the closure of method calls starting at a particular method
has body: I need to parse code of single java function collecting all the occurences of a particular string with regex (in the names of variables, string assignments, comments etc.) which sounds as a task of a simple text parser. But the problem arises when I need to collect all the occurences also inside the closure of method calls starting at a particular method. How can I implement a parser that traverse the closure of method calls starting at a particular method and collect all the occurences of a particular string? So if I have a code: public void A() { String abc = "$[LABEL_123]" B(); } public void B() { String def = "$[LABEL_456]" // $[LABEL_000] C(); } public void C() { String ghi = "$[LABEL_789]" } For the function A I should have an array: ["$[LABEL_123]", $[LABEL_000], "$[LABEL_456]", "$[LABEL_789]"]
has comment: http://stackoverflow.com/comment/40074036
score: 0
has comment: http://stackoverflow.com/comment/40072958
has comment: http://stackoverflow.com/comment/40072617
answer count: 0
has comment: http://stackoverflow.com/comment/40072521
type: UnansweredQuestion

spring-ws
tags question: http://stackoverflow.com/q/25647239
tags question: http://stackoverflow.com/q/25701826
tag name: spring-ws
type: Tag

http://stackoverflow.com/q/25595843
tagged with: bitmap
has answer: http://stackoverflow.com/a/25595893
has comment: http://stackoverflow.com/comment/39981034
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25595937
score: 0
tagged with: android
tagged with: java
possible better answer: http://stackoverflow.com/a/25595937
type: Question
answer count: 2
has body: I am currently trying to add a bitmap image to a ImageView but it is throwing a NPE. I have no idea what the problem is as it has worked in the past. I have just recreated the project because of some issues with the previous workspace. Here is the method where I add the Bitmap to the ImageView: private void insertElement(String data, String key, int i, Bitmap bm, boolean flag, boolean b) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View newRow = inflater.inflate(R.layout.row, null, false); newRow.setLayoutParams(new TableRow.LayoutParams( TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); TextView dataTextView = (TextView) newRow .findViewById(R.id.rowTextView); dataTextView.setText("\t " + data); ImageView iv = (ImageView) newRow.findViewById(R.id.imageView); newRow.setId(i); newRow.setOnClickListener(new OnClickListener() { //ommited }); View v = new View(this); v.setLayoutParams(new TableRow.LayoutParams( TableRow.LayoutParams.MATCH_PARENT, 1)); v.setBackgroundColor(Color.argb(18, 111, 111, 111)); dataTextView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); int sf = 1; if (i == 0) { sf = 2; dataTextView.setShadowLayer(3, 0, 0, Color.BLACK); dataTextView.setTextColor(getResources().getColor(R.color.white)); } if (bm == null &amp;&amp; iv == null) { iv.setVisibility(View.GONE); } else { iv.setImageBitmap(bm); // &lt;---------- Error here /** !original code! * iv.setImageBitmap(getCroppedBitmap(Bitmap.createScaledBitmap( Bitmap.createScaledBitmap(bm, bm.getWidth() / 2 * sf, bm.getWidth() / 2 * sf, true), dataTextView.getMeasuredHeight() * sf, dataTextView.getMeasuredHeight() * sf, true), iv, key)); */ } if (flag) { dataTextView.setTextSize(40); tableScrollView.addView(newRow, i); } else { tlcard.addView(newRow, i - 1); if (!b) { tlcard.addView(v, i); } } } The line that throws the exception is iv.setImageBitmap(bm). Obviously, bm is not null, and iv is not either. Here is the xml fi…
has title: Cannot set ImagView's image
tagged with: imageview
accepted answer: http://stackoverflow.com/a/25595893

http://stackoverflow.com/comment/40142797
comment on: http://stackoverflow.com/q/25684807
has text: 09-05 13:48:10.689: W/IInputConnectionWrapper(29080): getSelectedText on inactive InputConnection 09-05 13:48:10.689: W/IInputConnectionWrapper(29080): setComposingText on inactive InputConnection 09-05 13:48:20.049: E/SpannableStringBuilder(29080): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 09-05 13:48:20.049: E/SpannableStringBuilder(29080): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 09-05 13:48:33.769: I/click(29080): clickt
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25707446
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40215133
accepted answer of: http://stackoverflow.com/q/25706748
type: Answer
has comment: http://stackoverflow.com/comment/40215746
has body: First of all, the original question introduces somewhat bizarre code. Not sure what it is good for but lets leave that aside. Second thing, the chosen answer and the one that you copy-pasted here is just a different way to do the same code as in the question. So, what does this (bizarre) method do: Checks if the key is mapped to a value and if not assigns the value and exists. If it was, recalculate the value and replace the old value. Why do we need the loop then? Cause if 2 threads are recalculating the value and do the replace "together", only 1 is going to be successful and hence return from the method. The "loosing" thread will need to go thru the process again. Probably will get a new value in the putIfAbsent call and will recalculate a new value to be replaced, this time might be OK. A few things to note: I would recommend reading carefully the APIs of ConcurrentMap's putIfAbsent and replace methods. There is a corner case (that will never happen in reality) that a call to this method will be stuck forever cause it will always "loose" to another call. I suspect that synchronizing this whole method will be better avoiding this whole cumbersome loopings. But since I am not fully aware of what this code aims to resolve I can not officially claim that.
answers question: http://stackoverflow.com/q/25706748
has comment: http://stackoverflow.com/comment/40244186

http://stackoverflow.com/a/25612047
type: Answer
answers question: http://stackoverflow.com/q/25603813
upvote count: 2
has body: You could try to use auto discovery. Then the connection will show up automatically in JMC -Dcom.sun.management.jmxremote.autodiscovery=true You can also name the connection so you can identify it easily. -Dcom.sun.management.jdp.name=App and disable security -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
score: 2
downvote count: 0

http://stackoverflow.com/q/25650126
has body: Been wrestling with this problem for a while, would love some input. The problem I want to solve collects all of the dates in one specific year which fall on a particular day of the week, for example, every Tuesday in 2014. The dates are stored in an ArrayList&lt;Date&gt;. This list is then returned. Also have to validate to make sure the year is not 0 and the day of the week submitted must be a number between 1-7. If there are any issues, I would love to know what I have screwed up. public List&lt;Date&gt; getDatesforDayOfWeek(int year, int dayOfWeek) throws InvalidDateException, ParseException { List&lt;Date&gt; dateList = new ArrayList&lt;&gt;(); if (year &lt;= 0 || (1 &gt; dayOfWeek &amp;&amp; dayOfWeek &gt; 7)) { throw new InvalidDateException("Year or day of week is invalid."); } else { Calendar newCal = Calendar.getInstance(); newCal.set(YEAR, year); newCal.set(DAY_OF_YEAR, 1); while (newCal.get(YEAR) &lt; year + 1) { int currentDayOfWeek = newCal.get(DAY_OF_WEEK); Date newDate = null; if (currentDayOfWeek &gt;= dayOfWeek) { int dayOfMonth = newCal.get(DAY_OF_MONTH); String strDayOfMonth = String.valueOf(dayOfMonth); String strYear = String.valueOf(year); DateUtility d1 = new DateUtility(); Date passDate = newCal.getTime(); String weekDay = d1.getWeekDayNameAbbreviation(passDate); String monthAbbreviation = d1.getMonthAbbreviation(passDate); String finalString = new String(); finalString.concat(weekDay).concat(" "). concat(monthAbbreviation).concat(" "). concat(strDayOfMonth).concat(" "). concat(strYear); SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd YYYY"); Date theDate = format.parse(finalString); dateList.add(theDate); } newCal.add(Calendar.DATE, 1); } } return (dateList); }
tagged with: date
score: 4
has answer: http://stackoverflow.com/a/25650373
answer count: 3
has comment: http://stackoverflow.com/comment/40080293
has comment: http://stackoverflow.com/comment/40080331
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25650389
has comment: http://stackoverflow.com/comment/40127055
has comment: http://stackoverflow.com/comment/40080605
favorite count: 0
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/25650722
has comment: http://stackoverflow.com/comment/40080155
has comment: http://stackoverflow.com/comment/40080216
has title: Pulling all dates that fall on specific date of the week in a year - Java
has comment: http://stackoverflow.com/comment/40079847
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40080106

http://stackoverflow.com/comment/40139553
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25682233
has text: Only color of Phone number should change but with this everything is changing.

double
tags question: http://stackoverflow.com/q/25572623
tags question: http://stackoverflow.com/q/25553442
tags question: http://stackoverflow.com/q/25692274
tags question: http://stackoverflow.com/q/25576558
tags question: http://stackoverflow.com/q/25555126
tags question: http://stackoverflow.com/q/25609641
tags question: http://stackoverflow.com/q/25574421
tags question: http://stackoverflow.com/q/25634526
tags question: http://stackoverflow.com/q/25683391
tags question: http://stackoverflow.com/q/25644812
tags question: http://stackoverflow.com/q/25688744
tags question: http://stackoverflow.com/q/25647534
tag name: double
tags question: http://stackoverflow.com/q/25632733
tags question: http://stackoverflow.com/q/25595811
type: Tag
tags question: http://stackoverflow.com/q/25646801

http://stackoverflow.com/a/25676626
type: Answer
has comment: http://stackoverflow.com/comment/40136175
has body: There are two basic rules for writing efficient code: Don't do work that you don't need to do. Don't allocate memory if you can avoid it. Actually, thinking for two hours is a bit not enough, but... First of all, I'd like to suggest you reading Performance Tips, so that you could think of performance on the stage of design, and not when all is complete and should be re-written to make it beautiful. The first tip in that article is: avoid creating unnecessary objects. While OOP is cool with all that object orientedness, it's not that great for mobile devices with limited resources. It's better not to create too many layers. Talking about Services, AsyncTasks and the rest: they are not a layer. They come in parallel. But if you want, for example, an AsyncTask for downloading data, which will be used in different activities, you should implement it in a separate class for sure. You will be able to access the code from different places and avoid memory leaks (for example, during screen rotation or other configuration changes). Sometimes different activities (or fragments) should use the same pieces of code. In this situation I'd create a base Activity class and extend all my activities from that class rather than from the default android.app.Activity. This is for the beginning. But from my own experience I can say, that no matter how much you think about it or read, you won't create a masterpiece on the first attempt. All comes with experience. Ideas which seemed great on paper may become unapplicable or inefficient when you implemented them. Some people study and improve, others not. Good luck.
answers question: http://stackoverflow.com/q/25676101
upvote count: 3
has comment: http://stackoverflow.com/comment/40149855
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25676101
score: 3

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/25702844
type: Tag
tags question: http://stackoverflow.com/q/25671326
tags question: http://stackoverflow.com/q/25597814
tags question: http://stackoverflow.com/q/25587723
tags question: http://stackoverflow.com/q/25604094
tags question: http://stackoverflow.com/q/25571343
tags question: http://stackoverflow.com/q/25561759
tags question: http://stackoverflow.com/q/25587106

osx-mavericks
type: Tag
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/25581314

http://stackoverflow.com/a/25650659
has body: You probably haven't created a separate layout for 7" or 10" tablets. Once you do that, your "error" in PlayStore will go away. Have alook here: http://developer.android.com/guide/practices/tablets-and-handsets.html
score: 0
answers question: http://stackoverflow.com/q/25650322
type: Answer

http://stackoverflow.com/a/25643023
has body: Use Calendar#add() method where first argument is DATE and second value is either 1 or -1 based on next or previous day. sample code: Calendar cal=Calendar.getInstance(); cal.setTime(date); // set the date //cal.add(Calendar.DATE, 1); // next day cal.add(Calendar.DATE, -1); // prev day System.out.println(cal.getTime());
answers question: http://stackoverflow.com/q/25642989
type: Answer
score: 0

http://stackoverflow.com/comment/40022053
type: AnswerComment
type: Comment
has text: That doesn't explain why the override does work for the getter.
comment on: http://stackoverflow.com/a/25618274
score: 0

http://stackoverflow.com/a/59045755
has comment: http://stackoverflow.com/comment/138635719
answers question: http://stackoverflow.com/q/25707433
score: 21
type: Answer
has comment: http://stackoverflow.com/comment/138635411
has body: You can use: @Getter(onMethod_={@Synchronized}) @Setter(onMethod_={@Synchronized}) private String idSesion; with Lombok @Synchronized
downvote count: 0
upvote count: 21
has comment: http://stackoverflow.com/comment/127886815

http://stackoverflow.com/q/25611371
type: AnsweredQuestion
score: 0
has body: I'm working with basic collections right now and I'm having troubles with they ArrayList methods like .get(int) because that would return the entire object, in my case Name,Age,Phone,Salary,...etc but I just want to get the name of the object in the position desired. The list is already loaded and the methods done, and I`m currently with this : System.out.println("Desired Position?"); pos = Integer.parseInt(in.nextLine()); for(Employee i : list) { if(list.indexOf(i)==pos) // &lt;- Was out of ideas here { System.out.println(i.getName()); } } So... the thing is: I enter the position and that for-each loop is supposed to check through the list, if the index of the list matches with the one I want, it prints the name. Thank you, and sorry for my barely comprehensible English
tagged with: java
has title: How do i get, for example : getName() of the desired position inside an ArrayList <MyClass>?
has comment: http://stackoverflow.com/comment/40009364
has answer: http://stackoverflow.com/a/25611445
type: Question
has comment: http://stackoverflow.com/comment/40009330
answer count: 2
possible better answer: http://stackoverflow.com/a/25611396
has answer: http://stackoverflow.com/a/25611396
accepted answer: http://stackoverflow.com/a/25611445
tagged with: arraylist
tagged with: foreach

http://stackoverflow.com/a/25670552
has comment: http://stackoverflow.com/comment/40116989
has comment: http://stackoverflow.com/comment/40116884
has body: You need to group your regex.It is currently Si(.*?)[(P)|(I)] Whereas it should be Si(.*?)\(I\)|Si(.*?)\(P\) See demo. http://regex101.com/r/oO8zI4/8
has comment: http://stackoverflow.com/comment/40116822
score: 0
answers question: http://stackoverflow.com/q/25670401
type: Answer

http://stackoverflow.com/q/25575346
has answer: http://stackoverflow.com/a/25575495
has comment: http://stackoverflow.com/comment/39944216
answer count: 3
has body: As an exercise i have to write a very simple software for a swimming pool. The parent class is User. Adult and Child are two classes that extend User. DisabledChild and DisabledAdult extend User and implement an interface Disabled with a single extra-method that just prints "i'm disabled!" In main i create different objects of these classes depending on their age parameter and a 'disabled' boolean, then i put them into a list, like this: public void insertData() { int age; Adult a = null; DisabledAdult da = null; Scanner scanIn = new Scanner(System.in); List l = new ArrayList(); do { System.out.println("Insert user name, type 'quit' to exit"); name = scanIn.next(); System.out.println("Insert age"); age = scanIn.nextInt(); if (age &gt; 16) { System.out.println("Is the adult disabled? ( y/n)"); String disabled = scanIn.next(); if("y".equals(disabled)) { da = new DisabledAdult(); l.add(da); // l is a list! } else { a = new Adult(); l.add(a); } } else{ // similar as above, but for children. } } while (!"quit".equals(name)); scanIn.close(); Here comes the problem: when i put stuff inside my list they become Objects, and i can't go back to their original class even with .getClass().getName(). So i can't use their specific methods, like the one implemented from Disabled interface. I'm forced to cast Obj into an User (because everyone in the swimming pool is an user), like this: for (Object obj : l) { User u = (User) obj; } But i can't use the extra-methods of DisabledAdult or DisabledChild because they are defined in the interface Disabled, not User! If i do obj.getClass().getName(); I can see their original class, but I can only access Object methods. I think i could do something like: if (obj instanceof Adult){ Adult a = (Adult) obj; } if (obj instanceof Child){ Child c = (Child) obj; } ... But it looks horrible because i should check this for every kind of user, if they are disabled or not, etc. What can i do? Thank you.
score: 1
has comment: http://stackoverflow.com/comment/39944110
tagged with: java
has answer: http://stackoverflow.com/a/25575416
downvote count: 0
has answer: http://stackoverflow.com/a/25575428
upvote count: 1
has comment: http://stackoverflow.com/comment/39944032
favorite count: 0
type: Question
has title: Get the original class from Objects inside a List
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39943997

http://stackoverflow.com/comment/39998379
comment on: http://stackoverflow.com/a/25603814
type: Comment
type: AnswerComment
has text: Pleasure. BTW, when you refer to other users use the '@' sign before the user name in order for the other user to get the message (e.g. @shlomi33 and not shlomi33)
score: 0

http://stackoverflow.com/q/25697387
answer count: 1
has title: Tabs and menu in same line | Android
type: Question
has answer: http://stackoverflow.com/a/25698016
tagged with: layout
accepted answer: http://stackoverflow.com/a/25698016
type: AnsweredQuestion
score: 0
tagged with: android
tagged with: java
has body: I created an app and I use this example http://developer.android.com/training/implementing-navigation/lateral.html. when I use the onCreateOptionsMenu(Menu menu) function and menu button create its shown in the first line and the line of the tabs is one behind it. How can I make the tabs and the menu button(three dots) be in the same line? I tried this requestWindowFeature(Window.FEATURE_NO_TITLE); also this actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowHomeEnabled(false); and this is only removed the title and the icon and now I have one empty line with menu button(...) this its how its look now Thanks

http://stackoverflow.com/q/25612612
tagged with: javadoc
downvote count: 0
has comment: http://stackoverflow.com/comment/40011622
has body: I was going through the Java TCP Client Server tutorials where they are explaining how a echo server works and how a TCP client interacts with the echo server. For the TCP Client, they have given this snippet and are explain what it is: String hostName = args[0]; int portNumber = Integer.parseInt(args[1]); try ( Socket echoSocket = new Socket(hostName, portNumber); PrintWriter out = new PrintWriter(echoSocket.getOutputStream(), true); BufferedReader in = new BufferedReader( new InputStreamReader(echoSocket.getInputStream())); BufferedReader stdIn = new BufferedReader( new InputStreamReader(System.in)) ) later on, a few lines below (around 8 lines) they say: To send data through the socket to the server, the EchoClient example needs to write to the PrintWriter. To get the server's response, EchoClient reads from the BufferedReader object stdIn, which is created in the fourth statement in the try-with resources statement. Why does it say that To get the server's response, EchoClient reads from the BufferedReader object stdIn Isn't stdIn used for reading from the System's standard input and not the socket's standard input? Should the Echo client read from the in BufferedReader? If I am wrong, could you clarify my misunderstanding? http://docs.oracle.com/javase/tutorial/networking/sockets/readingWriting.html Edit Maybe I wasnt clear enough. When the client has to get data from the server. Does it get it form this: BufferedReader in = new BufferedReader( new InputStreamReader(echoSocket.getInputStream())); or this: BufferedReader stdIn = new BufferedReader( new InputStreamReader(System.in)) The doc says from the second one. That doesn't make sense, it should be the first one
possible better answer: http://stackoverflow.com/a/25612736
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40011528
has comment: http://stackoverflow.com/comment/40011696
answer count: 2
tagged with: java-io
has answer: http://stackoverflow.com/a/25612736
accepted answer: http://stackoverflow.com/a/25612693
has comment: http://stackoverflow.com/comment/40011578
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/25612693
has comment: http://stackoverflow.com/comment/40011637
has title: Is this a typo in the java tutorials?
upvote count: 3
tagged with: java

http://stackoverflow.com/a/25651812
has comment: http://stackoverflow.com/comment/40392578
has comment: http://stackoverflow.com/comment/40293006
has comment: http://stackoverflow.com/comment/40372338
has comment: http://stackoverflow.com/comment/40276802
has body: Here's an example of what you are looking for: import java.awt.Color; import java.awt.Dimension; import java.awt.GradientPaint; import java.io.File; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.renderer.category.BarRenderer; import org.jfree.data.category.CategoryDataset; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.ui.ApplicationFrame; import org.jfree.ui.RefineryUtilities; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; public class BarChartDemo extends ApplicationFrame { public BarChartDemo(final String title) throws Exception { super(title); final CategoryDataset dataset = createDataset(); final JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(500, 270)); setContentPane(chartPanel); } /** * Returns a sample dataset. * * @return The dataset. * @throws ParserConfigurationException * @throws IOException * @throws SAXException */ private CategoryDataset createDataset() throws Exception { final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document document = db.parse(new File("src/input.xml")); NodeList nodeList = document.getElementsByTagName("result"); for(int x=nodeList.getLength()-1;x&gt;=0;x--){ dataset.addValue(10.0, nodeList.item(x).getAttributes().getNamedItem("state").getNodeValue(),nodeList.item(x).getAttributes().getNamedItem("key").getNodeValue()); } return dataset; } /** * Creates a sample ch…
has comment: http://stackoverflow.com/comment/40110348
type: Answer
answers question: http://stackoverflow.com/q/25650857
has comment: http://stackoverflow.com/comment/40111628
has comment: http://stackoverflow.com/comment/40315975
has comment: http://stackoverflow.com/comment/40266708
score: 2
has comment: http://stackoverflow.com/comment/40257325
has comment: http://stackoverflow.com/comment/40419763
accepted answer of: http://stackoverflow.com/q/25650857
upvote count: 2
has comment: http://stackoverflow.com/comment/40296662
has comment: http://stackoverflow.com/comment/40358368
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40099012
downvote count: 0
has comment: http://stackoverflow.com/comment/40112560
has comment: http://stackoverflow.com/comment/40266963
has comment: http://stackoverflow.com/comment/40296607

http://stackoverflow.com/comment/40082000
comment on: http://stackoverflow.com/a/25637740
score: 0
type: Comment
has text: I found those but instead of me writing from scratch file I/O support using import java.io.File, the good folks at OptaPlanner probably have something under the hood, don't they? What would that be? Here is my read line for the problem file set: CloudBalance unsolvedCloudBalance = (CloudBalance) solutionDao.readSolution(file); The question is how does one get "file" from OptaPlanner?
type: AnswerComment

http://stackoverflow.com/comment/40090499
type: AnswerComment
comment on: http://stackoverflow.com/a/25655480
type: Comment
has text: Where exactly do you mean for that to go? In the for loop, or the Tile class?
score: 0

http://stackoverflow.com/a/25655906
has comment: http://stackoverflow.com/comment/40091157
has comment: http://stackoverflow.com/comment/40090966
answers question: http://stackoverflow.com/q/25655611
score: 0
has body: finalizer can't throw exceptions Yes it can, but you must be careful about it. The correct way to call a method in finalize() is as follows: protected void finalize() throws Throwable { try { myMethod(); } finally { super.finalize(); } }
type: Answer

http://stackoverflow.com/q/25573350
tagged with: serial-port
tagged with: jboss
type: Question
answer count: 0
type: UnansweredQuestion
has body: for reading a GPS signal from COM3, I'm trying to connect to the port via Java using PureJavaComm (http://www.sparetimelabs.com/purejavacomm/purejavacomm.php) Using the code below all of the systems COM ports are found and listed: List&lt;String&gt; list = new ArrayList&lt;String&gt;(); Enumeration portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { list.add(portId.getName()); } } System.out.println("Ports: " + list.toString()); Nevertheless, if I'm trying to connect to one port by using the below code I'm getting a PortInUseException. The weird thing is, the exception appears by using the code on all com ports, even the ones which are simulated. try { portId = CommPortIdentifier.getPortIdentifier("COM3"); } catch (NoSuchPortException e1) { e1.printStackTrace(); } SerialPort serialPort = null; try { serialPort = (SerialPort) portId.open("GpsApp", 2000); serialPort.close(); } catch (PortInUseException e) { log.error(e); } portId.currentOwner() returns null and portId.isCurrentlyOwned returns false. On the other side, connecting to the same port by using putty works just fine. Do you have any ideas? I'm using a Win7 x64 OS and 64Bit Java 1.7, the deployment server is a JBoss 7.2.0 I already tried to disable the COM Port I want to connect to, restart and enable it again. Unfortunately, it didn't help.
has comment: http://stackoverflow.com/comment/39957860
downvote count: 0
has comment: http://stackoverflow.com/comment/46019209
has comment: http://stackoverflow.com/comment/39940552
has comment: http://stackoverflow.com/comment/39940228
upvote count: 1
has comment: http://stackoverflow.com/comment/39940421
tagged with: windows-7-x64
favorite count: 0
has title: Opening Serial Port with PureJavaComm leads to PortInUseException
tagged with: exception
score: 1
tagged with: java

http://stackoverflow.com/comment/106656940
type: AnswerComment
has text: So much easier... :)
type: Comment
comment on: http://stackoverflow.com/a/36867587
score: 0

http://stackoverflow.com/a/33743413
upvote count: 16
has comment: http://stackoverflow.com/comment/101962440
type: Answer
has comment: http://stackoverflow.com/comment/70161693
answers question: http://stackoverflow.com/q/25602117
has body: I also struggled with this issue for quite some time. I had the same issue with the blank page as @Catscratch and nothing worked. Strangely enough, if you wrap the same code in a Javascript function, it all works. Thus, webView.loadUrl("javascript:(function() { document.getElementById('email_field').value = '" + email + "'; })()"); works, while webView.loadUrl("javascript:document.getElementById('email_field').value = '" + email + "';"); does not work. And all of this without needing setDomStorageEnabled(true) and without setWebChromeClient()
score: 15
downvote count: 1

http://stackoverflow.com/comment/40070227
type: Comment
score: 0
type: AnswerComment
has text: Sorry, I ment to write `getTest();`.
comment on: http://stackoverflow.com/a/25640103

http://stackoverflow.com/a/25808227
has body: The problem is that the for loop isn't written correctly: I tried this code: public static void main(String []args){ for(int i = 0;i &lt; 10;i = i++) { System.out.println(i); } } It loops infinitly and prints out 0 all the time. Your loop is: for(int currentHeight = 0; currentHeight &lt; numberHeight; currentHeight = currentHeight++) and should be for(int currentHeight = 0; currentHeight &lt; numberHeight; currentHeight++) or: for(int currentHeight = 0; currentHeight &lt; numberHeight; currentHeight += 1) How increment / decrement operators work as prefix or suffix: Java: Prefix/postfix of increment/decrement operators?
has comment: http://stackoverflow.com/comment/40400783
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25703774

http://stackoverflow.com/a/25561396
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/39979199
has body: Not sure that this will help you, but i think you don't necessary to use autoit to interact with dialog. I don't know java, but in C# there are a lot of libs to get any window and has possibility to interact with any element in app (e.g. UIAutomation). You can use winapi to get browse For file dialog and find textBox in it. Or you can use .net library for same purposes, i think there are a lot of articles how to use .net library in java (java .net interop).
answers question: http://stackoverflow.com/q/25561067

http://stackoverflow.com/q/25560612
type: Question
linked to: http://stackoverflow.com/q/5392695
score: 0
tagged with: android
tagged with: java
has title: Android class reference not found error
accepted answer: http://stackoverflow.com/a/25560727
tagged with: eclipse
has answer: http://stackoverflow.com/a/25560727
tagged with: class
type: AnsweredQuestion
has body: I'm making an android app. I reference a java project called recognition. When I call a function from it, from my android project, it crashes, with this log: The java project uses BufferedImage objects and is set to JRE 1.6. Does anyone know what the problem is? Thanks EDIT: I think the problem is Path requires 1.7, but android is using 1.6 How can I fix that? 08-28 21:52:04.595: E/AndroidRuntime(21763): FATAL EXCEPTION: main 08-28 21:52:04.595: E/AndroidRuntime(21763): java.lang.NoClassDefFoundError: java.nio.file.Paths 08-28 21:52:04.595: E/AndroidRuntime(21763): at recognition.Recognize.getImage(Recognize.java:168) 08-28 21:52:04.595: E/AndroidRuntime(21763): at recognition.Recognize.getInitialImage(Recognize.java:80) 08-28 21:52:04.595: E/AndroidRuntime(21763): at recognition.Recognize.runAnalysis(Recognize.java:46) 08-28 21:52:04.595: E/AndroidRuntime(21763): at android.arin.SpeciesScreen.onActivityResult(SpeciesScreen.java:131) 08-28 21:52:04.595: E/AndroidRuntime(21763): at android.app.Activity.dispatchActivityResult(Activity.java:5361) 08-28 21:52:04.595: E/AndroidRuntime(21763): at android.app.ActivityThread.deliverResults(ActivityThread.java:3201) 08-28 21:52:04.595: E/AndroidRuntime(21763): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3248) 08-28 21:52:04.595: E/AndroidRuntime(21763): at android.app.ActivityThread.access$1200(ActivityThread.java:143) 08-28 21:52:04.595: E/AndroidRuntime(21763): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289) 08-28 21:52:04.595: E/AndroidRuntime(21763): at android.os.Handler.dispatchMessage(Handler.java:99) 08-28 21:52:04.595: E/AndroidRuntime(21763): at android.os.Looper.loop(Looper.java:137) 08-28 21:52:04.595: E/AndroidRuntime(21763): at android.app.ActivityThread.main(ActivityThread.java:4950) 08-28 21:52:04.595: E/AndroidRuntime(21763): at java.lang.reflect.Method.invokeNative(Native Method) 08-28 21:52:04.595: E/AndroidRuntime(21763): at java.lang.reflect.Method.invoke(Me…
answer count: 1

http://stackoverflow.com/a/25583271
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25583113
has body: if((rs.getString(1)).equals("")){ System.out.println("Invalid PIN"); } without rs.next(), rs.getString(1) is not possible Try this: if(rs.next()){ System.out.println(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3)+" "+rs.getString(4)); } else { System.out.println("Invalid PIN"); }

http://stackoverflow.com/q/25553202
has answer: http://stackoverflow.com/a/25553474
answer count: 1
downvote count: 0
upvote count: 1
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/9734503
score: 1
linked to: http://stackoverflow.com/q/7187581
has body: I have the following error: Exception: javax.xml.soap.SOAPException: javax.xml.soap.SOAPException: Message send failed: com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl cannot be cast to oracle.j2ee.ws.saaj.soap.MessageImpl at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.call2(HttpSOAPConnection.java:234) at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:141) at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:134) My code is: SOAPMessage soapMessage = MessageFactory.newInstance().createMessage(); soapMessage.getSOAPPart().getEnvelope().addNamespaceDeclaration("http://action.web.nnn.some.com/", "act"); SOAPElement elemement = soapMessage.getSOAPPart().getEnvelope().getBody().addChildElement("getSomeMethod", "http://action.web.nnn.some.com/").addChildElement("arg0"); elemement.addTextNode(someDate); soapMessage.saveChanges(); SOAPMessage responce = SOAPConnectionFactory.newInstance().createConnection().call(soapMessage, wsdlUrl); The application running under: Java(TM) SE Runtime Environment (build 1.7.0_15-b33) WebLogic Server 12.1.2.0.0 The error appeared after adding the following line into setDomainEnv: set JAVA_OPTIONS=%JAVA_OPTIONS% -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl I am trying to switch implementation of SAAj to saaj-impl-1.3.23.jar. My question is: how to properly ask Weblogic to use provided SAAJ implementation instead of its own?
favorite count: 0
tagged with: saaj
linked to: http://stackoverflow.com/q/8166580
type: Question
tagged with: weblogic
has title: com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl cannot be cast to oracle.j2ee.ws.saaj.soap.MessageImpl
accepted answer: http://stackoverflow.com/a/25553474

http://stackoverflow.com/q/25688642
accepted answer: http://stackoverflow.com/a/25688745
has comment: http://stackoverflow.com/comment/40149505
has answer: http://stackoverflow.com/a/25688745
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40150090
tagged with: generics
possible better answer: http://stackoverflow.com/a/25688777
favorite count: 0
has body: This code will not compile, and I don't understand why. The error is at the indicated line: static &lt;T extends DB&gt; T createModelObjectFromCopy(T fromRow) { T mo = null; try { --&gt; mo = fromRow.getClass().newInstance(); } catch (InstantiationException | IllegalAccessException ex) { Logger.getLogger(DBTypes.Table.class.getName()).log(Level.SEVERE, null, ex); } return Table.initializeFromCopy(mo, fromRow); } } fromRow is a value object that wraps immutable types. From the declaration it is clear that fromRow must be of type T. The variable mo must be of the very same type T. Why can the reflectively instantiated new instance not be assigned to mo? I assume that the class object returned by fromRow.getClass() is Class&lt;T&gt; and that newInstance() -should- instantiate a new instance of T.
has comment: http://stackoverflow.com/comment/40150029
type: Question
has answer: http://stackoverflow.com/a/25688777
has comment: http://stackoverflow.com/comment/40149410
tagged with: casting
has comment: http://stackoverflow.com/comment/40149709
has title: Java: won't compile - incompatible types that must be compatible
has comment: http://stackoverflow.com/comment/40149323
type: AnsweredQuestion
score: 3
upvote count: 3
answer count: 2

http://stackoverflow.com/comment/77577361
type: Comment
has text: Why _in brief_ ? I you can provide a more complete explanation, by all means, do it!
type: AnswerComment
comment on: http://stackoverflow.com/a/45307610
score: 1

http://stackoverflow.com/q/25583424
has comment: http://stackoverflow.com/comment/39959513
type: UnansweredQuestion
score: -4
answer count: 1
has comment: http://stackoverflow.com/comment/39959635
has comment: http://stackoverflow.com/comment/39959903
downvote count: 4
has comment: http://stackoverflow.com/comment/39958626
tagged with: saxparser
tagged with: java
has comment: http://stackoverflow.com/comment/39962483
has comment: http://stackoverflow.com/comment/40041695
has comment: http://stackoverflow.com/comment/39959639
has body: i need to read this xml file using sax parser , but the problem is beacuse of the same child node name in different nodes. This is the file: 200000 <oa:Code>88</oa:Code> <oa:Description languageID="en-us">addres1</oa:Description> <oa:Description languageID="ar-ae">addres2</oa:Description> <oa:Code>55</oa:Code> <oa:Description languageID="en-us">Loc1</oa:Description> <oa:Description languageID="ar-ae">Loc2</oa:Description> import java.util.ArrayList; import java.util.List; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class MyHandler2 extends DefaultHandler { private MasterData masterdata= null; private IssueAuthority issueAuth = null ; private List<IssueAuthority> issueAuthList = null ; public MasterData getMasterData() { return masterdata; } boolean bmaster = false ; boolean bLiceNum = false; boolean bissueAuth = false ; boolean bautCode = false ; boolean bautDescAr = false ; boolean bautDescEn = false ; @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equalsIgnoreCase("MasterData")) { //initialize Employee object and set id attribute masterdata = new MasterData(); System.out.println("MasterData"); }else if (qName.equalsIgnoreCase("LicenseNumber")) { bLiceNum = true; System.out.println("qName"+qName); }else if (qName.equalsIgnoreCase("IssueAuthority")) { bissueAuth = true; }else if (qName.equalsIgnoreCase("oa:Code")) { bautCode = true; } } @Override public void endElement(String uri, String localName, String qName) throws SAXException { if (qName.equalsIgnoreCase("IssueAuthority")) { issueAuthList = new ArrayList<IssueAuthority>() ; issueAuthList.add(issueAuth) ; } if (qName.equalsIgnoreCase("MasterData")) { //add Employee object to list masterdata.setIssueAuthority(issueAuthList); } } @Override public void characters(char ch[], int start, int length) throws SAXException { if (bLiceNum) { masterdata.setLicenseNumbe…
has comment: http://stackoverflow.com/comment/39958436
favorite count: 0
type: Question
has title: reading xml file using sax parser problems
upvote count: 0
has answer: http://stackoverflow.com/a/25629637

http://stackoverflow.com/q/25573977
downvote count: 0
tagged with: jsp
favorite count: 0
accepted answer: http://stackoverflow.com/a/25574144
has answer: http://stackoverflow.com/a/25574144
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25574578
answer count: 5
possible better answer: http://stackoverflow.com/a/25574122
has body: I'm really new to JSP and Servlets and all that jazz, and I'm confused about how to approach it. Right now my main confusion is as follows: It seems there are two ways to get a web page to display on the screen in a Java EE/JSP project: Create an HTML page with the extension .jsp and in the web.xml file, map it to a url pattern (let's assume just /) Create a Java class that extends Servlet, override the doGET() method to return a string of HTML code and map to this Java class in the web.xml. My JSP project requires a decent amount of Java code to perform logic and login/logout operations. I've read that it's bad practice to inlcude Java code inside JSP pages as it becomes impossible to reuse, hard to keep track of, messy etc. I want to include much of code in Java, which will feel much more natural for me. How should I build my project (assuming it's a simple beginner project in which I want to employ the best practices for organization, testing etc in preparation for building a larger project)? How can cleanly deploy web pages from inside Java classes, rather than having many JSP pages containing bits of Java code?
tagged with: servlets
has answer: http://stackoverflow.com/a/25574122
has title: Programmatically Display a web page from a Servlet class
has answer: http://stackoverflow.com/a/25574171
has answer: http://stackoverflow.com/a/25574461
upvote count: 2
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/25615270
has body: To my understanding, all beans are thread safe? If I have a stateless bean, and it is called 5 times, it can either reuse the bean in the pool or create new beans, in this sense each call is a new instance. A singleton will be locked until it is free, so how is that different? what are a few examples of when to use stateless and when to use singleton when worrying about concurrency(authentication/adding/deleting)
favorite count: 0
linked to: http://stackoverflow.com/q/17115533
type: Question
has comment: http://stackoverflow.com/comment/40041384
tagged with: ejb
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40017575
has comment: http://stackoverflow.com/comment/40016850
answer count: 0
score: 1
tagged with: java
downvote count: 0
has title: trying to understand the thread safety of singleton or stateless session beans
upvote count: 1

http://stackoverflow.com/q/25621722
has answer: http://stackoverflow.com/a/25622414
type: Question
answer count: 2
has title: Dropwizard hibernate field not populating
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25621965
score: 0
has body: I've got a very simple User Entity which populates a username and password field from a (h2) database. I seem unable to add a further field though for a boolean isAdmin - I've tried primitive and object Boolean. The SQL hibernate executes is logged and when I run it returns all the fields from the user table for the given user including the boolean value (true). Yet the Boolean remains null. Any ideas how I can get this field populating? @Entity @Table(name = "users") @NamedQueries({ @NamedQuery( name = "eu.wansdyke.smaash.core.User.findAll", query = "SELECT u FROM User u" ), @NamedQuery( name = "eu.wansdyke.smaash.core.User.deleteByUsername", query = "DELETE FROM User WHERE username = :username" ), @NamedQuery( name = "eu.wansdyke.smaash.core.User.findByUsername", query = "SELECT u FROM User u WHERE u.username = :username" ) }) @NamedNativeQueries({ @NamedNativeQuery( name = "eu.wansdyke.smaash.core.User.setPassword", query = "merge into users (username, password) key(username) values (:username, :password)" ) }) public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; @Column(name = "username", nullable = false) private String username; @Column(name = "password", nullable = false) private String password; @Column(name = "isadmin", nullable = false) private Boolean isAdmin; public User() { } public User(String username) { this.username = username; } public long getId() { return id; } public String getUsername() { return username; } public String getPassword() { return password; } public Boolean isAdmin() { return isAdmin; } }
tagged with: dropwizard
tagged with: sql
tagged with: java
tagged with: hibernate
tagged with: h2

http://stackoverflow.com/a/25566673
has comment: http://stackoverflow.com/comment/39936787
has body: I don't think your "springBoot" task is actually doing anything (it's empty). Probably you meant to do this? springBoot { mainClass = "net.myproject.smpp.client.Application" } to configure the Spring Boot plugin, and then $ ./gradlew bootRun or $ ./gradlew build &amp;&amp; java -jar build/libs/*.jar to build a jar and run it. Edit: and make sure your main class is not in the default package (if you get that right you don't even need to declare it in the springBoot closure as long as there is only one main class in your app).
has comment: http://stackoverflow.com/comment/39955546
has comment: http://stackoverflow.com/comment/39960790
has comment: http://stackoverflow.com/comment/39956657
upvote count: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39934117
has comment: http://stackoverflow.com/comment/39936561
score: 2
answers question: http://stackoverflow.com/q/25565764
has comment: http://stackoverflow.com/comment/39935427

http://stackoverflow.com/q/25627810
answer count: 2
tagged with: jframe
type: UnansweredQuestion
tagged with: user-interface
downvote count: 1
has body: How do I change the normal default theme to something like this?
favorite count: 0
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25627859
score: -1
has answer: http://stackoverflow.com/a/25627855
has title: Java GUI changing colour of theme
upvote count: 0

http://stackoverflow.com/comment/39949599
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25578373
has text: Try removing `seekTo` from `onResume()` in `if` condition

nullpointerexception
tags question: http://stackoverflow.com/q/25676216
tags question: http://stackoverflow.com/q/25694872
tags question: http://stackoverflow.com/q/25578334
tags question: http://stackoverflow.com/q/25635964
tags question: http://stackoverflow.com/q/25552744
tags question: http://stackoverflow.com/q/25626532
tags question: http://stackoverflow.com/q/25596599
tags question: http://stackoverflow.com/q/25649791
tags question: http://stackoverflow.com/q/25564627
tags question: http://stackoverflow.com/q/25639260
tags question: http://stackoverflow.com/q/25571883
tags question: http://stackoverflow.com/q/25690010
tags question: http://stackoverflow.com/q/25673362
tags question: http://stackoverflow.com/q/25666669
tags question: http://stackoverflow.com/q/25667864
type: Tag
tags question: http://stackoverflow.com/q/25701555
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/25634889
tags question: http://stackoverflow.com/q/25673309
tags question: http://stackoverflow.com/q/25621501
tags question: http://stackoverflow.com/q/25560315
tags question: http://stackoverflow.com/q/25574421
tags question: http://stackoverflow.com/q/25610084
tags question: http://stackoverflow.com/q/25616096

http://stackoverflow.com/comment/40155233
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25691374
score: 0
has text: What does "I also need to find the largest average cost" mean? Average of what?

http://stackoverflow.com/q/25697247
has comment: http://stackoverflow.com/comment/40174667
has body: What I want to do is use a general function to define different 'value' properties for one particular/many annotations used in the respective class based on a class-specific unique identifier, of which the most obvious one is the class name. I'm using NetBeans. I used the Ctrl+Space keyword to check for autocomplete suggestions. There doesn't seem to be a way to do this. What are the possible bottlenecks in doing so? Some code... @ManagedBean @CustomScoped(value = uniqueFunction(this.class.name())) public class DetectionMethodCB extends CommonChildCB&lt;DetectionMethod&gt; implements Serializable { }
has answer: http://stackoverflow.com/a/25697315
favorite count: 0
type: Question
has title: Is there a way to use the current class name in an annotation property (say value) in Java?
has comment: http://stackoverflow.com/comment/40165999
has comment: http://stackoverflow.com/comment/40173555
accepted answer: http://stackoverflow.com/a/25697315
score: 2
upvote count: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/40165972
tagged with: java
has comment: http://stackoverflow.com/comment/40166053
tagged with: annotations
answer count: 1
has comment: http://stackoverflow.com/comment/40166123
has comment: http://stackoverflow.com/comment/40173489
has comment: http://stackoverflow.com/comment/40166007

http://stackoverflow.com/comment/40104232
has text: neither one, use a Handler
type: QuestionComment
comment on: http://stackoverflow.com/q/25663731
score: 3
type: Comment

newline
tags question: http://stackoverflow.com/q/25640805
tag name: newline
tags question: http://stackoverflow.com/q/25554846
type: Tag

http://stackoverflow.com/q/25575483
downvote count: 5
has body: I am not using any threading concept in my application - by default is it single or multi-threaded?
possible better answer: http://stackoverflow.com/a/25575498
upvote count: 11
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25575498
answer count: 2
has comment: http://stackoverflow.com/comment/39944010
tagged with: java
tagged with: multithreading
score: 6
accepted answer: http://stackoverflow.com/a/25575547
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25575547
has comment: http://stackoverflow.com/comment/39944050
has title: Is Java single-threaded or multi-threaded by default?

http://stackoverflow.com/q/25677466
upvote count: 1
tagged with: java
has body: If we have a method like this: List&lt;TypeA&gt; retrieve(List&lt;TypeB&gt; sTypes) { List&lt;TypeA&gt; aList = null; if(sTypes != null) for(TypeB type : sTypes){ TypeA a = type.getA(); aList.add(a); } return aList; } Instead of returning this list, is there a way we can make it immutable not using final keyword? If we return the list there might be chance that someone can add to the list and hence not immutable anymore.
has comment: http://stackoverflow.com/comment/40129323
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25677561
tagged with: collections
has comment: http://stackoverflow.com/comment/40133308
favorite count: 0
type: Question
type: UnansweredQuestion
has title: how to make a method not return List, and strive for immutability?
linked to: http://stackoverflow.com/q/7713274
has comment: http://stackoverflow.com/comment/40129432
score: 0
tagged with: list

http://stackoverflow.com/comment/123921304
type: Comment
has text: @LakpriyaSenevirathna, I have noticed that when the phone is connected to both wif & data, calling `isNetworkConnected()` returns `false` when wifi is turned off, even though mobile data is still on. What I did is, I called it after 100-200 milliseconds delay and it returns `true` as expected.
comment on: http://stackoverflow.com/a/66517237
type: AnswerComment
score: 1

http://stackoverflow.com/a/25682572
has comment: http://stackoverflow.com/comment/40150434
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/40144600
has body: It is hard to say what is best, the solution also depends on how secure you want this to be. Fixed RSA keypair - you could generate an RSA keypair and use them to encrypt the traffic. This however will not protect the conversation from someone who decompiles your APK file and extracts the RSA keys - though you can try to make this hard by obfuscating your code and hiding the key by XORing it or using reflection to access it on your application. There are some relevant suggestions here and questions/answers about implementation here. Dynamic encryption keys with SSL - the encryption keys to use is negotiated for each client separately, on the fly. For this the clients need to trust the server (i.e be sure that they are really talking to your server, not someone else's). This is very much like SSL, where the server proves its identity by providing a certificate signed by a third party. If using SSL is an option, there is an answer for using self-signed certificates here. Dynamic encryption keys customized - you could set up your own security scheme, but then you'll have to make it bulletproof yourself.
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25682037
has comment: http://stackoverflow.com/comment/40140951
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25682037

http://stackoverflow.com/comment/40003419
comment on: http://stackoverflow.com/q/25607282
type: QuestionComment
type: Comment
score: 0
has text: When I use `buffer.asFloatBuffer()`, the new `FloatBuffer` also contains all the bytes that come after the data I need. I'd like to send the `FloatBuffer` to OpenGL, with only the vertex data.

http://stackoverflow.com/comment/40158894
type: QuestionComment
comment on: http://stackoverflow.com/q/25601681
has text: @Yazan As I examined my code again more carefully, I noticed that a message is sent while loading the page. Do you know where the problem is?
score: 0
type: Comment

http://stackoverflow.com/q/25653407
tagged with: import
has body: Here is my webservice code in c# framework 4.5 for retrievung data and adding it into a json array. [WebMethod(Description = "Webservice for generating category wise report in JSON form")] public string getCategoryWiseReport(string distr) { string dist = "23"; distr = dist; var con = new SqlConnection("data source=xxxx;initial catalog=xxxxx;integrated security=true"); StringBuilder JSON = new StringBuilder(); con.Open(); var cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = "RepSum"; cmd.CommandType = CommandType.StoredProcedure; DataTable dt = new DataTable(); SqlDataAdapter ad = new SqlDataAdapter(cmd); cmd.Parameters.AddWithValue("@dri", dri); cmd.ExecuteNonQuery(); ad.Fill(dt); JSON.Append("{"); JSON.Append("\"Report\":["); for (int i = 0; i &lt;= (dt.Rows.Count - 1); i++) { for (int j = 0; j &lt;= 8; j++) { JSON.Append("{"); JSON.Append("\"code\":\"" + dt.Rows[i][j].ToString() + "\", "); JSON.Append("\"desg\":\"" + dt.Rows[i][j].ToString() + "\", "); JSON.Append("\"name\":\"" + dt.Rows[i][j].ToString() + "\", "); JSON.Append("\"name\":\"" + dt.Rows[i][j].ToString() + "\", "); JSON.Append("\"complaint_re\":\"" + dt.Rows[i][j].ToString() + "\", "); JSON.Append("\"omplaint_d\":\"" + dt.Rows[i][j].ToString() + "\", "); JSON.Append("\"complaint_pg\":\"" + dt.Rows[i][j].ToString() + "\", "); JSON.Append("\"complaint_im\":\"" + dt.Rows[i][j].ToString() + "\", "); JSON.Append("\"omplaint_t\":\"" + dt.Rows[i][j].ToString() + "\", "); } if (JSON.ToString().EndsWith(",")) { JSON = JSON.Remove(JSON.Length - 1, 1); } JSON.Append("]}"); } con.Close(); return JSON.ToString(); } And this is my android app which stops when i execute this application whose work is basically to populate the listview with json data coming from the above webservice. Error is ::: org.json.jsonexception: expected literal value at character 211 of {"Report" :[{ package com.example.newasynctask; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.js…
type: Question
has comment: http://stackoverflow.com/comment/40086682
has comment: http://stackoverflow.com/comment/40086318
type: UnansweredQuestion
has title: Listview in android is not populating with data
tagged with: android
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/40086521
tagged with: listview
score: 0
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40086555

http://stackoverflow.com/comment/40166644
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25697506
type: Comment
has text: @PaulMcKenzie I tried SEH exception with try/catch block and this approach does a good job of pausing the execution of the program (with breakpoints) and preventing the JVM from automaticaly aborting the program. However, I wasn't able to pinpoint the location of the error (file and line number) which I'd like to have especially when there are many nested function calls.

unit-testing
tags question: http://stackoverflow.com/q/25659756
tags question: http://stackoverflow.com/q/25594090
tags question: http://stackoverflow.com/q/25703551
tags question: http://stackoverflow.com/q/25600007
tags question: http://stackoverflow.com/q/25564533
tags question: http://stackoverflow.com/q/25586021
tags question: http://stackoverflow.com/q/25681147
type: Tag
tags question: http://stackoverflow.com/q/25706840
tags question: http://stackoverflow.com/q/25626220
tag name: unit-testing
tags question: http://stackoverflow.com/q/25568584
tags question: http://stackoverflow.com/q/25624161
tags question: http://stackoverflow.com/q/25669693
tags question: http://stackoverflow.com/q/25631029
tags question: http://stackoverflow.com/q/25709502
tags question: http://stackoverflow.com/q/25617942
tags question: http://stackoverflow.com/q/25694715
tags question: http://stackoverflow.com/q/25698880
tags question: http://stackoverflow.com/q/25602146
tags question: http://stackoverflow.com/q/25676790
tags question: http://stackoverflow.com/q/25669410
tags question: http://stackoverflow.com/q/25674619
tags question: http://stackoverflow.com/q/25711781
tags question: http://stackoverflow.com/q/25676426
tags question: http://stackoverflow.com/q/25567851
tags question: http://stackoverflow.com/q/25565448
tags question: http://stackoverflow.com/q/25678750

http://stackoverflow.com/a/25615468
downvote count: 0
answers question: http://stackoverflow.com/q/25615423
score: 3
has body: You need to add your MySQL connector jar file while compiling and running your program, you can do it the following way, To compile : javac -g -cp mysql-coonectivity.jar; YourFileName.java To Run java -cp mysql-coonectivity.jar; YourMainClass NOTE: The above written syntax assumes that your jar file is present at same location as of your program.
type: Answer
has comment: http://stackoverflow.com/comment/40017105
has comment: http://stackoverflow.com/comment/40018871
upvote count: 3

http://stackoverflow.com/q/25602117
linked to: http://stackoverflow.com/q/37644551
score: 9
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/46658695
downvote count: 0
has comment: http://stackoverflow.com/comment/39994559
tagged with: javascript
tagged with: webview
has comment: http://stackoverflow.com/comment/39992921
favorite count: 0
has body: I try to fill out a form inside a webview from the android client app. I know how it should work, but the getElementById always returns null for me. I tried it on different websites. Here is my example for www.google.com. MyWebView view = new MyWebView(this); view.getSettings().setJavaScriptEnabled(true); view.loadUrl("http://www.google.com"); view.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView v, String url) { v.loadUrl(url); return true; } @Override public void onPageFinished(WebView v, String url) { v.loadUrl("javascript:document.getElementById('mib').value = 'aaa';"); } }); setContentView(view); And the MyWebView class (only for information). class MyWebView extends WebView { Context context; public MyWebView(Context context) { super(context); this.context = context; } @Override public boolean onTouchEvent(MotionEvent event) { // do some multi touch stuff return true; } } I always get the error: 09-01 04:35:26.453: I/chromium(2962): [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot set property 'value' of null", source: https://www.google.de/?gws_rd=ssl (1) But the element "mib" should be on the site. Using a desktop browser (chrome with mobile simulation) everything is working fine. I have no idea, whats going wrong here. Thanks for hints! Edit: I got some progress. Regarding this site, I also need setDomStorageEnabled(true). No I can find the DOM object and set the value, but instead of showing the modified site I get a new blank one with only the value I set. E.g. a white blank site with the text "aaa".
possible better answer: http://stackoverflow.com/a/33743413
type: Question
upvote count: 9
has answer: http://stackoverflow.com/a/33743413
has title: Android WebView always returns null for javascript getElementById on loadUrl
tagged with: android
tagged with: java
answer count: 3
accepted answer: http://stackoverflow.com/a/25606090
has answer: http://stackoverflow.com/a/25606090

http://stackoverflow.com/comment/128437110
score: 0
has text: This article proposes to use the prefix `possible_blabla` for optional members (or accessor I suppose). https://betterprogramming.pub/useful-tips-for-naming-your-variables-8139cc8d44b5
comment on: http://stackoverflow.com/q/25553387
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40017513
comment on: http://stackoverflow.com/a/25615719
type: Comment
score: 0
type: AnswerComment
has text: @user3977863 Yes. Try with resources was added in Java 7. Are you on an older version of Java?

http://stackoverflow.com/comment/39960714
score: 1
type: Comment
type: QuestionComment
has text: I don't know if and where the names are documented. Best ask the PMD folks.
comment on: http://stackoverflow.com/q/25584501

http://stackoverflow.com/a/25587720
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25587675
has comment: http://stackoverflow.com/comment/39966584
has comment: http://stackoverflow.com/comment/39966624
has body: Just get System.out.println(...) out of the while loop. And declare average variable before the loop body. public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Please type some words, then press enter: "); String words = sc.nextLine(); int count = 0; double sum = 0; double average = 0; sc = new Scanner(words); while (sc.hasNext()) { String userInput = sc.next(); double charNum = userInput.length(); sum = charNum + sum; count++; if (count &gt; 0) { average = sum / count; } } System.out.println("Average word length = " + average); }
has comment: http://stackoverflow.com/comment/39966284
has comment: http://stackoverflow.com/comment/39966548
has comment: http://stackoverflow.com/comment/39966170
has comment: http://stackoverflow.com/comment/39966354
accepted answer of: http://stackoverflow.com/q/25587675
has comment: http://stackoverflow.com/comment/39966400
has comment: http://stackoverflow.com/comment/39966650
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/39966199

http://stackoverflow.com/comment/39920274
has text: Ok I've realised the mistake: was running with a version of `TestMain` that loaded `MyClassLoader` but skipped instantiation, hence giving the "false positive". Thanks for your time and help in debugging.
score: 1
comment on: http://stackoverflow.com/a/25562470
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25645521
has body: Only thing you have to do is public CashCard(String name, double amount, int amountcardisused){ this.amount = amount; this.name = name; this.amountcardisused = amountcardisused; //remove the below line from here listofcashcards = new ArrayList&lt;CashCard&gt;();// dont include this here } and in your testcashcard class after System.out.print("Enter The Amount This Card Is Already Used: "); int youramountcardisused = in.nextInt(); add CashCard cashcard1 = new CashCard("abc",1000,2); listofcashcards.add(cashcard1);
answers question: http://stackoverflow.com/q/25645351
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/40071271

http://stackoverflow.com/a/25712331
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25708734
has body: As shown in How to Use Scroll Panes: Providing Custom Decorations, you can use the scroll pane's setCorner() method to add a colored Component: JPanel panel = new JPanel(); panel.setBackground(Color.gray); scrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, panel); You may have to set the panel's opacity to true, and you may want to select a suitable color from the the current Look &amp; Feel using the UIManager.
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25708734
type: AcceptedAnswer

sysdate
tag name: sysdate
type: Tag
tags question: http://stackoverflow.com/q/25569607

http://stackoverflow.com/q/25587558
has title: Sending/Receiving Interface
has body: I don't know how I would do something like this: Component A has an input and an output, so does Component B A's output is connected to the input of B, these connections are one-way (output-> input). an Input can have only 1 connection, however, an output can have as many connections as it likes. If Component B is deleted, the connection between A and B is terminated, same thing if A is deleted. An output sends a single signal to ALL of it's connections. I should also mention that everything runs at a rate of 30 FPS. My question here is that is how would I go about doing this in java? More importantly rendering it. If there is a library for this, it would be nice to point it out. (If my question is crap forgive me, it's the second question I've asked on this site)
favorite count: 0
type: Question
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: components
answer count: 0
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/40094855
comment on: http://stackoverflow.com/a/25657802
type: Comment
score: 0
type: AnswerComment
has text: maybe you have some blank or wrong formatted lines within your text file. Also consider using an opensource csvreader.

http://stackoverflow.com/comment/40054113
score: 0
has text: why have you use Integer in your one method ? and you want to subtract `findChange()` and `findMoney()`'s output from `findDollars()`'s output ? right.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25635597

http://stackoverflow.com/q/25674802
has comment: http://stackoverflow.com/comment/40144579
answer count: 1
has comment: http://stackoverflow.com/comment/40132700
has title: Spring batch item reader reading from multiple databases
tagged with: spring-batch
has body: I have an Item object as below: class Item{ private String idProperty; private String prop1Db1; private String prop2Db1; private String prop1Db2; private String prop2Db2; // getters and setters here } Now, for a given idProperty, two of the properties comes from one database, while other two properties comes from another database (as clear from the property names). The tables in both the databases have idProperty as the common property. One approach I could take is read the first three properties from the first database. Pass the incomplete Item to a Processor and fire a query in the Processor to get other two properties to complete the Item before passing it to Writer. However, for a huge number of records (millions), it will be a huge performance hit just with the number of queries I will have to fire in the Processor. Is there any way to do it in the Reader itself ? A Reader which reads from two database simultaneously to create an Item before sending it to Processor and Writer ahead ?
linked to: http://stackoverflow.com/q/21304364
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/25679997
has answer: http://stackoverflow.com/a/25679997
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/25630621
has comment: http://stackoverflow.com/comment/40078792
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40078917
upvote count: 2
score: 2
has body: You can use the StyledText addCaretListener to listen for movements of the caret. In your MyEditor class use: StyledText styledText = (StyledText)getAdapter(Control.class); styledText.addCaretListener(listener);
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25629986
accepted answer of: http://stackoverflow.com/q/25629986

mbeans
tags question: http://stackoverflow.com/q/25663063
tags question: http://stackoverflow.com/q/25625304
type: Tag
tag name: mbeans

serversocket
tags question: http://stackoverflow.com/q/25664083
tags question: http://stackoverflow.com/q/25601165
type: Tag
tags question: http://stackoverflow.com/q/25594197
tags question: http://stackoverflow.com/q/25706352
tag name: serversocket

http://stackoverflow.com/comment/81894228
has text: Agreed. Apologized for misunderstood. There no such kind of feature for auto import XML file for spring beans. You must have to specify it in your configuration class.
comment on: http://stackoverflow.com/a/25688306
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40001604
type: Comment
type: QuestionComment
has text: curious_mind, it didn't work
score: 0
comment on: http://stackoverflow.com/q/25605898

http://stackoverflow.com/comment/40066870
has text: What extraneous methods? `keyPressed(KeyEvent)` `KeyReleased(KeyEvent e)` `keyTyped(KeyEvent e)` They're all relevant in some way, or don't need anything if not...
type: Comment
comment on: http://stackoverflow.com/q/25643167
score: 0
type: QuestionComment

http://stackoverflow.com/comment/94375283
comment on: http://stackoverflow.com/a/25554911
score: 1
type: Comment
has text: @ClintEastwood the convention is not to do it. You’re not expecting those who are discouraging it to spent time to invent a convention of how to do it, do you?
type: AnswerComment

http://stackoverflow.com/a/25611398
has comment: http://stackoverflow.com/comment/40009639
type: Answer
has body: @Path("/users/{username}") public class UserResource { @GET @Produces("text/xml") public String getUser(@PathParam("username") String userName) { ... } } Documentation: http://docs.oracle.com/javaee/6/tutorial/doc/gilik.html Really nice tutorial: http://www.vogella.com/tutorials/REST/article.html
answers question: http://stackoverflow.com/q/25611144
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40010236
has comment: http://stackoverflow.com/comment/40009912
has comment: http://stackoverflow.com/comment/40010817

http://stackoverflow.com/a/25643757
upvote count: 1
score: 1
has body: matcher.find() does the job for you and no need to check with matcher.end() == str.length() API says If the match succeeds then more information can be obtained via the start, end, and group methods
type: Answer
answers question: http://stackoverflow.com/q/25643621
downvote count: 0

http://stackoverflow.com/a/42804266
has body: I found the same issue and just fixed it today. Although i have declared javax.servlet-api in my pom.xml but still got the issue. Then I fixed it by adding javax.servlet-api:3.10.jar file into project's class path.
answers question: http://stackoverflow.com/q/25589152
downvote count: 0
score: 5
upvote count: 5
type: Answer

http://stackoverflow.com/comment/40120354
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25672682
has text: you need to display message outside of loop
score: 1

http://stackoverflow.com/comment/90955677
comment on: http://stackoverflow.com/a/25678950
has text: and how to workaround this bug? is this bug reported as an issue somewhere?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25608996
has comment: http://stackoverflow.com/comment/40007591
has comment: http://stackoverflow.com/comment/40041313
has body: There were multiple flaws: a) Unnecessary swapping outside the loop temp = a[small_index]; a[small_index]= a[low]; a[low]= temp; b) The improper initialization of large_index. c) Calling the recursive function without checking the values of small_index and large_index. I have rectified them, now the function will look like: if (low &lt; high) { int temp = 0; int pivot = a[low]; int large_index = low; int small_index = high; while (large_index &lt;= small_index) { while (a[small_index] &gt; pivot) small_index--; while (a[large_index] &lt; pivot) large_index++; if (large_index &lt;= small_index) { temp = a[large_index]; a[large_index] = a[small_index]; a[small_index] = temp; large_index++; small_index--; } } if(low &lt; small_index) { quicksort(low, small_index); } if(large_index &lt; high) { quicksort(large_index, high); } } Now, watching the variables in your piece of code: (your code will fail in the final iteration of any given input unless the input is not sorted) Consider the input 2,1 1st iteration: pivot = 2 large_index = 1; small_index = 1; while1: 1&lt;=1 -&gt; true while2: 1&gt;2 false. while3: 1&lt;2 true. -&gt; large_index++ 2nd time in while loop large_index =2 which is &gt; the size of a. Resulting in IndexArrayOutOfBounds. Which shows that your initialization of large_index was wrong. It should have been: large_index = low; instead of low+1; Hope this helps.
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40006800
has comment: http://stackoverflow.com/comment/40005195
has comment: http://stackoverflow.com/comment/40015081
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25608731

http://stackoverflow.com/q/25580302
has answer: http://stackoverflow.com/a/25580701
accepted answer: http://stackoverflow.com/a/25580701
has answer: http://stackoverflow.com/a/25580710
type: AnsweredQuestion
downvote count: 2
answer count: 2
upvote count: 1
tagged with: java
has title: How can I set conents of View1 to View2?
linked to: http://stackoverflow.com/q/4427278
has body: Private View View2; ... View View1 = ChartFactory.getLineChartView(this, dataset, renderer); ... View2 = (View)findViewById(R.id.View2); ... The View1 shows a Line Chart generated from a dataset. The View2 is a View of the MainActivity. View1 can show with setContentView(View1);. How can I show the Line Chart in View2?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39952768
tagged with: android-view
tagged with: android
score: -1
possible better answer: http://stackoverflow.com/a/25580710

http://stackoverflow.com/q/25607632
type: Question
has answer: http://stackoverflow.com/a/25607872
accepted answer: http://stackoverflow.com/a/25607872
tagged with: plugins
has body: I have a plugin which adds a view. This view contains a table which contains on each row some informations. I would like to have a popup menu when I press the right mouse click. How can I add the extension org.eclipse.ui.menus and after creating the menuContribution to see it in the view ?
tagged with: eclipse-plugin
has title: Java plugin pop-up menu
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
tagged with: eclipse

http://stackoverflow.com/comment/40091158
type: Comment
has text: I am using Eclipse to build/compile the application.
type: AnswerComment
comment on: http://stackoverflow.com/a/25653347
score: 0

http://stackoverflow.com/a/25637934
has comment: http://stackoverflow.com/comment/40792015
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25637684
downvote count: 0
answers question: http://stackoverflow.com/q/25637684
score: 2
type: Answer
has body: If I understand the question correctly, you're looking for a function that will repair strings that have been damaged by others' encoding mistakes? Here's one that seems to work on the example you gave: static String fix(String badInput) { byte[] bytes = badInput.getBytes(Charset.forName("cp1252")); return new String(bytes, Charset.forName("UTF-8")); } fix("FrÃ©dÃ©ric") == "Frédéric"

http://stackoverflow.com/a/25708983
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25708033
type: Answer
upvote count: 4
score: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25708033
has body: Solved it by using the approach from JNLP Webstart Launch Issue and Copying a binary file outside of a jar , with one change: File f = new File ("./phantomjs.exe"); if (!f.exists()) { InputStream in = Myclass.class.getClassLoader().getResourceAsStream("phantomjs.exe"); OutputStream out = new FileOutputStream("./phantomjs.exe"); IOUtils.copy(in, out); } System.setProperty("phantomjs.binary.path","./phantomjs.exe");

http://stackoverflow.com/comment/39988850
type: Comment
comment on: http://stackoverflow.com/q/25599648
type: QuestionComment
has text: do u mean change `hdparm -I /dev/sda | grep Serial` to `/sbin/hdparm -I /dev/sda | grep Serial`? I tried it and still didn't work it returns blank...
score: 0

http://stackoverflow.com/a/25679384
has comment: http://stackoverflow.com/comment/40133416
accepted answer of: http://stackoverflow.com/q/25679274
type: Answer
score: 2
upvote count: 2
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25679274
has comment: http://stackoverflow.com/comment/40133068
has body: I don't see any problem in using Java. But it needs both hardware and software support. You need a fingerprint scanner, check/ask your manufacturer, if they provide the API for Java. If you want to develop a mobile application, then I have doubt, if you really need to store the fingerprints as I don't think Apple/Samsung is going to provide you those. They provides API for that and all you need is to implement those API in your program. If you want to store the fingerprint information's in a database, then you have several choices: If your fingerprint collection is small, then just storing it in a Treemap will be enough instead of using a database. It will increase the performance of the application as there will be no need to retrieve data from the database. For a fingerprint application, performance matters. However, for big number of collections, you can use relational databases like Mysql or others. For accessing relational databases, Java provides an API for database access, called JDBC. Checkout these links for more about JDBC: http://docs.oracle.com/javase/tutorial/jdbc/basics/ http://en.wikipedia.org/wiki/Java_Database_Connectivity So, you have freedom to choose your preferred database. Even Mysql is enough to store the fingerprints data.

http://stackoverflow.com/q/25579769
has comment: http://stackoverflow.com/comment/39952833
possible better answer: http://stackoverflow.com/a/25589220
tagged with: applet
upvote count: 1
has comment: http://stackoverflow.com/comment/39952819
has answer: http://stackoverflow.com/a/25589220
tagged with: synchronized
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39951895
has answer: http://stackoverflow.com/a/25588380
linked to: http://stackoverflow.com/q/218384
has body: I'm making a maze game using tiles. The maze changes shape in regular intervals. At this time the tilearray gets empty before the maze recreates. I'm getting NPE errors after different intervals and after a while the game stops. Probably because some methods tries to access before it is actually recreated. I tried to put if(... !=null) in some places and even tried to synchronize some part (which I'm not really familiar with). Edit: Thank you for Arvind for pointing out the problem. I managed to fix it but I would still appriciate some more help as it is not the best and most neat fix I think. Tile t was equal to null at some cases. I simply just checked it and put a continue; into the for loop to avoid the error. Thank you very much for any help and advice in advance! With this error the game still runs: Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException at shiftingmaze.Game.paintTiles(Game.java:161) at shiftingmaze.Game.paint(Game.java:115) at shiftingmaze.Game.update(Game.java:107) at sun.awt.RepaintArea.updateComponent(Unknown Source) at sun.awt.RepaintArea.paint(Unknown Source) at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$400(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.Even…
has comment: http://stackoverflow.com/comment/39953082
accepted answer: http://stackoverflow.com/a/25588380
has comment: http://stackoverflow.com/comment/39951923
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/39953212
has comment: http://stackoverflow.com/comment/39952772
has comment: http://stackoverflow.com/comment/39958825
score: 1
tagged with: java
has title: AWT-EventQueue-1 NullExceptionPointer
downvote count: 0

http://stackoverflow.com/comment/40122104
type: Comment
has text: That's the weirdest brace style I've seen yet.
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/25673530

bash
tags question: http://stackoverflow.com/q/25606777
tags question: http://stackoverflow.com/q/25703593
type: Tag
tags question: http://stackoverflow.com/q/25647806
tags question: http://stackoverflow.com/q/25599406
tag name: bash

http://stackoverflow.com/a/25697980
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25697690
type: Answer
has body: From Size-limited queue that holds last N elements in Java Apache commons collections 4 has a CircularFifoQueue which is what you are looking for. Quoting the javadoc: CircularFifoQueue is a first-in first-out queue with a fixed size that replaces its oldest element if full. If you are using an older version of the Apache commons collections (3.x), you can use the CircularFifoBuffer which is basically the same thing without generics. Update: updated answer following release of commons collections version 4
score: 1

hadoop
tags question: http://stackoverflow.com/q/25601779
tags question: http://stackoverflow.com/q/25576193
tags question: http://stackoverflow.com/q/25650815
tags question: http://stackoverflow.com/q/25708897
tags question: http://stackoverflow.com/q/25636562
tags question: http://stackoverflow.com/q/25551548
tags question: http://stackoverflow.com/q/25705945
tags question: http://stackoverflow.com/q/25618406
tag name: hadoop
tags question: http://stackoverflow.com/q/25638297
tags question: http://stackoverflow.com/q/25702844
tags question: http://stackoverflow.com/q/25587811
tags question: http://stackoverflow.com/q/25665346
tags question: http://stackoverflow.com/q/25707666
tags question: http://stackoverflow.com/q/25678084
tags question: http://stackoverflow.com/q/25628393
tags question: http://stackoverflow.com/q/25700459
tags question: http://stackoverflow.com/q/25593533
type: Tag
tags question: http://stackoverflow.com/q/25711266
tags question: http://stackoverflow.com/q/25607320
tags question: http://stackoverflow.com/q/25669531
tags question: http://stackoverflow.com/q/25701795
tags question: http://stackoverflow.com/q/25606417
tags question: http://stackoverflow.com/q/25556354
tags question: http://stackoverflow.com/q/25694490
tags question: http://stackoverflow.com/q/25588391
tags question: http://stackoverflow.com/q/25638371
tags question: http://stackoverflow.com/q/25661784
tags question: http://stackoverflow.com/q/25617474
tags question: http://stackoverflow.com/q/25570189
tags question: http://stackoverflow.com/q/25603450
tags question: http://stackoverflow.com/q/25626477

http://stackoverflow.com/comment/40074336
comment on: http://stackoverflow.com/q/25589963
type: QuestionComment
type: Comment
score: 0
has text: Thank you for your suggestions Andreas. I have answered my question to explain which of your suggestions worked for me and also raised an issue over at GitHub (#70), as per your request.

http://stackoverflow.com/q/25607781
accepted answer: http://stackoverflow.com/a/25719608
has answer: http://stackoverflow.com/a/25629305
has answer: http://stackoverflow.com/a/25719608
has title: Message Header Size for JMS producer in ActiveMq v5.10
has body: I was trying to use Message Size related stats (Minimum message size, Maximum message size, Average message size, Total message size by using DestinationStatistics.getMessages().getCount() ) provided in ActiveMQ v5.10 and found that header size is 1028 bytes (send message of different sizes and size returned by API is 1028 bytes more). I am not able to understand why size is this. Is it prefixed? Is there anyway to see what constitute header. Thanks EDIT: So basically producer is sending a text message of 1024 bytes (chars) using java code on a queue to broker which is received by consumer listening onto that queue. I am logging message sizes using the above said API and I found that message size reported is 2052 bytes and not 1024 bytes.
tagged with: activemq-classic
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40003209
tagged with: jms
tagged with: middleware
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25629305

http://stackoverflow.com/comment/40037632
has text: Hi Dave. Did you find a solution? Maybe we find a issue that has no solution with org.w3c.Document
comment on: http://stackoverflow.com/a/25551952
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39919081
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25562045
has text: **Patient:** Wherever i touch my body with my hand, it aches doctor. **Doctor:** ...Oh i guess the problem is not in your whole body but in your hand... **:P** @BoratSagdiyev

http://stackoverflow.com/comment/40008237
score: 0
comment on: http://stackoverflow.com/q/25610624
type: QuestionComment
has text: Is this mean when I convert list to array converts to other type but from array to list they just wrap it. This is the part that I do not understand why they had two different way in converting between each others?
type: Comment

http://stackoverflow.com/q/25657983
tagged with: java
answer count: 1
downvote count: 0
tagged with: log4j
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/117167585
upvote count: 2
tagged with: swt
has answer: http://stackoverflow.com/a/25658103
has comment: http://stackoverflow.com/comment/40094664
type: AnsweredQuestion
score: 2
has body: I want to store the log4j messages to java util list and then fetch the log4j messages from the list . so how can we store the log4j messages to the list.Please help me how can we do this.
tagged with: list
accepted answer: http://stackoverflow.com/a/25658103
has title: How can we store the log4j messages to a java util list

http://stackoverflow.com/comment/40187447
score: 0
type: AnswerComment
has text: Please answer to answers via a comment.
type: Comment
comment on: http://stackoverflow.com/a/25685815

http://stackoverflow.com/a/25579470
has body: Highlight the current project: Click on the properties button: Click on the Required Libraries tab, then click New: Give the library an appropriate name, then click Add -&gt; Add Archive: Use the navigator to select the .jar file, then click OK on the Set Library window. Ensure the libraries are checked, then click OK: After this, the project should build correctly. Note I couldn't locate the library with the exact name yours had, but when I went looking for them I had to download both POI Scratchpad and Apache POI in order to get it working, so pay close attention to exactly which packages aren't found if it still doesn't build when you follow the steps above
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25578876
type: Answer
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25578876

http://stackoverflow.com/a/48337479
type: Answer
has body: This is my 100/100 solution: public int solution1(int A, int B, int K) { return A == 0 ? B / K - A / K + 1 : (B) / K - (A - 1) / K; } 0 is divisible by any integer so if A is 0, you should add one to the answer.
score: 0
answers question: http://stackoverflow.com/q/25661519

http://stackoverflow.com/comment/40152623
comment on: http://stackoverflow.com/a/25690076
has text: @KishorePaparthi: Yes, if you convert a `Date` to a `String` it will always use the local time zone. That's just what `toString()` does though - it doesn't represent the value in the `Date` itself. It's not at all clear to me why you'd want to do anything with `GregorianCalendar` - if you've got two `Date` objects, you can tell unambiguously which occurred first (or whether they're equal).
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25589963
tagged with: jbehave
type: Question
has comment: http://stackoverflow.com/comment/40074336
tagged with: jbehave-plugin
accepted answer: http://stackoverflow.com/a/25646847
has body: I am new to JBehave and am attempting to use the JBehave-JUnit-Runner to display test results nicely in JUnit in Eclipse Luna (on Ubuntu 12.04). I am using JBehave-JUnit-Runner 1.1.2, JUnit 4.12-beta-1 and JBehave-core 4.0-beta-9. When I right-click on my story file and 'Run as JUnit Test' all is well. However, when I put the @RunWith(JUnitReportingRunner.class) at the top of my story class as required for JBehave-JUnit-Runner, I get the following error: java.lang.RuntimeException: java.lang.NullPointerException at de.codecentric.jbehave.junit.monitoring.JUnitReportingRunner.run(JUnitReportingRunner.java:80) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.NullPointerException at de.codecentric.jbehave.junit.monitoring.JUnitScenarioReporter.afterStory(JUnitScenarioReporter.java:114) at org.jbehave.core.reporters.DelegatingStoryReporter.afterStory(DelegatingStoryReporter.java:49) at org.jbehave.core.reporters.ConcurrentStoryReporter.afterStory(ConcurrentStoryReporter.java:120) at org.jbehave.core.embedder.PerformableTree.performBeforeOrAfterStories(PerformableTree.java:399) at org.jbehave.core.embedder.StoryManager.performStories(StoryManager.java:102) at org.jbehave.core.embedder.StoryManager.runStories(StoryManager.java:93) at org.jbehave.core.embedder.StoryManager.runStoriesAsPaths(StoryManager.java:74) at org.jbehave.core.embedder.Embedder.runStoriesAsPaths(Embedder.java:204) at de.codecentric.jbehave.junit.monitoring.JUnitReportingRunner.run(JUnitReporting…
has comment: http://stackoverflow.com/comment/39986927
has answer: http://stackoverflow.com/a/25646847
has title: JBehave-Junit-Runner throwing NullPointerException
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: junit
has comment: http://stackoverflow.com/comment/39987063
tagged with: eclipse
answer count: 1

http://stackoverflow.com/comment/39987088
comment on: http://stackoverflow.com/a/25595213
type: AnswerComment
score: 0
has text: Same exception? Wich version of httpClient.jar do you use?
type: Comment

swipe
type: Tag
tag name: swipe
tags question: http://stackoverflow.com/q/25644667

osgi
tags question: http://stackoverflow.com/q/25644851
type: Tag
tags question: http://stackoverflow.com/q/25613479
tags question: http://stackoverflow.com/q/25669636
tags question: http://stackoverflow.com/q/25623285
tags question: http://stackoverflow.com/q/25662109
tags question: http://stackoverflow.com/q/25657257
tag name: osgi
tags question: http://stackoverflow.com/q/25581446
tags question: http://stackoverflow.com/q/25670577
tags question: http://stackoverflow.com/q/25666676

http://stackoverflow.com/comment/40078111
comment on: http://stackoverflow.com/q/25648984
type: Comment
has text: could another solution be to add the wildcard * to the jar's manifest?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39984641
score: 0
comment on: http://stackoverflow.com/q/25592170
type: QuestionComment
has text: @ankur-singhal, it's still the same
type: Comment

http://stackoverflow.com/comment/40176422
comment on: http://stackoverflow.com/q/25703092
score: 0
type: Comment
type: QuestionComment
has text: The hash is 512 bytes. The signature in Java is bigger than that. This is why I suspect there must be a header. If the signature in fact would only be the hash in this implementation, I could just simply test for size (would be good enough).

http://stackoverflow.com/a/25705305
answers question: http://stackoverflow.com/q/25705148
has body: Make the counter variable public instead of private. Change its declaration to: public static int counter = 1; Then inside your planetClick() method, add this line: Ship.counter++; That will increment the counter variable by one every time planetClick() is called.
score: 0
type: Answer

http://stackoverflow.com/a/25687897
has body: Check this link Now I can develope topologies in Netbeans, test them locally, and eventually deploy them to my Nimbus on the cluster. This solution works great for me!!! Add to conf file: conf.put(Config.NIMBUS_HOST, "123.456.789.101); //YOUR NIMBUS'S IP conf.put(Config.NIMBUS_THRIFT_PORT,6627); //int is expected here Also, add the following : System.setProperty("storm.jar", &lt;path-to-jar&gt;); //link to exact file location (w/ dependencies) to avoid the following error: [main] INFO backtype.storm.StormSubmitter - Jar not uploaded to master yet. Submitting jar... Exception in thread "main" java.lang.RuntimeException: Must submit topologies using the 'storm' client script so that StormSubmitter knows which jar to upload. Cheers!
answers question: http://stackoverflow.com/q/25674798
score: 5
type: AcceptedAnswer
upvote count: 5
accepted answer of: http://stackoverflow.com/q/25674798
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40093651
type: Comment
type: QuestionComment
score: 0
has text: The only error I get is the last line of `String gameAnswer = input.nextLine();`, because `gameAnswer` is already defined...
comment on: http://stackoverflow.com/q/25657421

http://stackoverflow.com/a/25680986
has body: protected String getId(String result) { try { JSONObject jsonObject = new JSONObject(result); JSONObject data = new JSONObject(jsonObject.getString("data")); JSONObject user = new JSONObject(jsonObject.getString("user")); String id = user.getString("id"); return id; }catch (Exception e) { Log.d("error", e.getLocalizedMessage()); } return null; }
answers question: http://stackoverflow.com/q/25680877
type: Answer
has comment: http://stackoverflow.com/comment/40158435
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25613006
has body: In this way I can answer myself: Predicate predicate = cBuilder.between(a.get(Oferta_.fechaFin),fechaInicio,fechaFin); cQuery.select(a).where(predicate);
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25612931

http://stackoverflow.com/q/25616594
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40018907
has comment: http://stackoverflow.com/comment/40019089
duplicate of: http://stackoverflow.com/q/41577234
tagged with: spring-security
type: Question
has comment: http://stackoverflow.com/comment/40019006
has comment: http://stackoverflow.com/comment/40018870
linked to: http://stackoverflow.com/q/41577234
has body: I have a maven project. my css and js files are under -src -main -webapp -resources ( -css and -js ) My application is deployed successfully but css and js are not getting loaded while opening jsp page on browser ( http://url:8080/test_jboss_local/admin). Getting : 00:44:12,027 INFO [STDOUT] WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/test_jboss_local/resources/css/main.css] in DispatcherServlet with name 'appServlet' 00:44:12,054 INFO [STDOUT] WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/test_jboss_local/resources/js/jquery.1.10.2.min.js] in DispatcherServlet with name 'appServlet' 00:44:12,164 INFO [STDOUT] WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/test_jboss_local/resources/js/main.js] in DispatcherServlet with name 'appServlet' Servlet-context.xml : <annotation-driven /> <context:annotation-config /> <context:component-scan base-package="com.abc" /> <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <beans:property name="prefix" value="/WEB-INF/views/" /> <beans:property name="suffix" value=".jsp" /> </beans:bean> <resources mapping="/admin/**" location="/resources/" /> Security-context.xml : <intercept-url pattern="/admin**" access="ROLE_USER" /> <authentication-manager> <authentication-provider> <user name="vvv" password="123456" authorities="ROLE_USER" /> </authentication-provider> </authentication-manager> Web.xml: contextConfigLocation /WEB-INF/spring/root-context.xml /WEB-INF/spring/security-context.xml appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/appServlet/servlet-context.xml 1 appServlet / appServlet *.css appServlet *.js org.springframework.web.context.ContextLoaderListener springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* Root-context.xml: <!-…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40019027
tagged with: spring
has comment: http://stackoverflow.com/comment/40018885
has title: No mapping found for HTTP request with URI for css and js in DispatcherServlet
tagged with: css
has comment: http://stackoverflow.com/comment/40019117
score: 0
answer count: 0

http://stackoverflow.com/q/25569392
has comment: http://stackoverflow.com/comment/39933025
score: 0
has comment: http://stackoverflow.com/comment/39932863
has comment: http://stackoverflow.com/comment/39933095
has comment: http://stackoverflow.com/comment/39932275
tagged with: java
has comment: http://stackoverflow.com/comment/39932978
has body: My query from the MasterList Table fetches following records: id listName listValue 1 Type of Repository Animal Specimen 2 Type of Repository Human Specimen 3 Type of Repository Environmental Specimen 4 Type of Repository Microorganism Culture Collection 5 Type of Repository Vegetal Specimen 6 Type of Repository Other Each record/row is an object and is stored as list of objects in the following list List&lt;MasterList&gt; typeOfRepositoryMasterList Also each object has corresponding getter methods for columns available like obj.getListValue(); Then from other query to biobankList Table I have following records: biobankId listName listValue 1 Type of Repository Animal Specimen 1 Type of Repository Human Specimen 1 Type of Repository Microorganism Culture Collection 1 Type of Repository Vegetal Specimen Similarly these records are also available as list of objects as List&lt;biobankList&gt; typeOfRepositoryBiobankList and each object here also has corresponding getter methods. What I want to do is, for all the listValue in the first record set, if there is the same listValue in the second record set, add that to the new list say selectedList. The two listValues which are not present in the second record set should be added to the availableList. The picture might explain better. for(MasterList attributeMaster: typeOfRepositoryMasterList){ boolean selected = false; for(biobankList attribute: typeOfRepositoryBiobankList){ if(attributeMaster.getListValue().equals(attribute.getListValue())){ System.out.println("equal"); selected = true; selectedList.add(new KeyValuePair( attribute.getListName()+"_"+attribute.getListValue(), attribute.getListValue())); break; } if(!selected){ System.out.println("not equal"); availableList.add(new KeyValuePair( attributeMaster.getListName()+"_"+attributeMaster.getListValue(), attributeMaster.getListValue())); } } } The query is working fine but this nested for loop code is clearly not working as it adds the same values multiple times. Edit:…
has comment: http://stackoverflow.com/comment/39932621
has comment: http://stackoverflow.com/comment/39932055
type: AnsweredQuestion
tagged with: liferay
has comment: http://stackoverflow.com/comment/39933579
tagged with: list
answer count: 2
has comment: http://stackoverflow.com/comment/39932495
has answer: http://stackoverflow.com/a/25569684
accepted answer: http://stackoverflow.com/a/25569684
has title: Iterate and compare Java List
has answer: http://stackoverflow.com/a/25569810
possible better answer: http://stackoverflow.com/a/25569810
type: Question

http://stackoverflow.com/comment/40106050
comment on: http://stackoverflow.com/q/25664234
type: Comment
has text: This is not a proper answer but if you're working with dates on a regular basis the library Joda-Time is a must.
score: 0
type: QuestionComment

http://stackoverflow.com/q/25554762
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/25555195
tagged with: maven-plugin
has body: I'm working on a plugin that will push a package file to a custom CI/CD service for automated deploys and I'd like to utilize the build number plugin's functionality for creating build numbers. Is there a way for me to make my plugin pull the build number plugin into a project that it's being used in?
type: Question
tagged with: maven
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39908133
has title: Can you make a maven plugin pull in another plugin?

http://stackoverflow.com/a/25704382
answers question: http://stackoverflow.com/q/25704325
downvote count: 0
has comment: http://stackoverflow.com/comment/40193728
has comment: http://stackoverflow.com/comment/40188512
has comment: http://stackoverflow.com/comment/40182335
upvote count: 20
type: Answer
has comment: http://stackoverflow.com/comment/40179401
has comment: http://stackoverflow.com/comment/40184753
has body: When types are mutable, it's often useful to return a copy so that a client can't fundamentally modify your data, at least without telling you about it. Consider: public class Person { private Date dateOfBirth; public Date getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(Date dateOfBirth) { // Do some validation, e.g. that it's after 1800 this.dateOfBirth = dateOfBirth; } } That looks okay, right? But what about: Person person = new Person(); person.setDateOfBirth(new Date()); // Now... fine. // Aha! Modify the Date to a very long time ago. Now anyone else // using the Person will be messed up... person.getDateOfBirth().setTime(Long.MIN_VALUE); If getDateOfBirth returns a copy instead, then any changes the caller makes to the Date object that the return value refers to will be irrelevant to anyone else. The Person object is still valid, because it only has a valid date. Of course, this should be documented so that whoever wrote the above code would expect it not to affect the Person object, due to a copy being returned. A better solution than all of this copying is to favour immutable types, however - when you've got a reference to an immutable object, you can share that as widely as you like, knowing that no-one can change its state under your feet.
has comment: http://stackoverflow.com/comment/40189193
score: 20

http://stackoverflow.com/q/25635806
score: 1
tagged with: java
tagged with: spring-mvc
answer count: 0
has title: Validation in service Layer with Spring MVC
downvote count: 0
upvote count: 1
has body: I would like to know how to perform a clean code to organize validation in my service layer. So, I have this service: public interface PersonService { public Person getPerson(int idperson); public List getPeopleWithFather( int idFather); } For the validation of the service layer I use Spring AOP (Aspectj), so for validate the first method : public Person getPerson(int idperson){ return personRepository.getPerson(idperson); } @AfterReturning( pointcut="execution(* business.PersonService.getPerson(..))", returning = "result") public void afterRunning(JoinPoint joinPoint, Object result){ Person person = (Person) result; if(person == null){ throw new PersonNotFound(); } } So in my service, I dont need to write try/catch or maybe conditions of validate. But, I don't know how I can organize my code for the second method, because : First, I need to validate that the father exists with his id. get list of children. One way is to do so: public List getPeopleWithFather( int idFather){ Person father = getPerson(idFather); if(father != null){ return personRepository.getPeopleWithFather(father); } return null; } Other way is : public List getPeopleWithFather( int idFather){ Person father = ((PersonService) AopContext.currentProxy() ).getPerson(idFather); return personRepository.getPeopleWithFather(father); } @AfterThrowing(pointcut="execution(* business.PersonService.getPeopleWithFather(..))", throwing = "throwable") public void afterThrowing(JoinPoint joinPoint, Exception throwable){ if( throwable instanceof PersonNotFound){ throw new PersonNotFound("whatever"); } } There a more elegant way to perform these validations?. Thanks in advance.
tagged with: backend
favorite count: 0
type: Question
tagged with: service-layer
type: UnansweredQuestion

http://stackoverflow.com/q/25567920
tagged with: apache
answer count: 1
has comment: http://stackoverflow.com/comment/39933139
tagged with: tomcat
has answer: http://stackoverflow.com/a/25612765
type: Question
has title: Load Balance Apache Httpd, Mod_Jk 32bit, Tomcat 7, Windows 2008 R2
tagged with: mod-jk
type: UnansweredQuestion
has body: Please need help in configuring the Load Balancer with Apache HTTPD 2.4 and Tomcat 7. I have seen many posts on this topic and managed to configure to an extent. The strange problem i am facing is if I start 2 instances of tomcat and try to browse the APP URL, I get "This webpage is not available". If I stop one instance, I am able browse the App. Apache HTTPD and Tomcat servers are running on the same machine. workers.properties worker.list=router,status worker.worker1.port=8109 worker.worker1.host=172.16.0.79 worker.worker1.type=ajp13 worker.worker1.lbfactor=1 worker.worker1.local_worker=1 worker.worker1.sticky_session=0 worker.worker2.port=8209 worker.worker2.host=172.16.0.79 worker.worker2.type=ajp13 worker.worker2.lbfactor=1 worker.worker2.local_worker=0 worker.worker2.sticky_session=0 worker.router.type=lb worker.router.balanced_workers=worker1,worker2 worker.router.local_worker_only=1 worker.status.type=status Httpd.conf &lt;IfModule mod_proxy.c&gt; &lt;IfModule mod_proxy_ajp.c&gt; Include "conf/extra/httpd-ajp.conf" &lt;/IfModule&gt; &lt;/IfModule&gt; LoadModule jk_module modules/mod_jk.so JkWorkersFile conf/workers.properties JkLogFile logs/jk.log JkLogLevel debug JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " JkMount /jk_status status JkMount /APP/* router Server.xml &lt;Connector port="8109" protocol="AJP/1.3" redirectPort="8443" tomcatAuthentication="false"/&gt; &lt;Connector port="8209" protocol="AJP/1.3" redirectPort="8443" tomcatAuthentication="false"/&gt; error.log [Fri Aug 29 14:49:49.245851 2014] [ssl:warn] [pid 4312:tid 420] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name [Fri Aug 29 14:49:49.698251 2014] [ssl:warn] [pid 4312:tid 420] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name [Fri Aug 29 14:49:49.745051 2014] [mpm_winnt:notice] [pid 4312:tid 420] AH00455: Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.11 mod_jk/1.2.39 configured -- resuming…
score: 0
tagged with: java

http://stackoverflow.com/comment/40082075
comment on: http://stackoverflow.com/q/25651092
type: QuestionComment
type: Comment
has text: What about the numbers? Are they exact or examples? If examples, what are the allowed ranges in there?
score: 0

http://stackoverflow.com/comment/39989679
comment on: http://stackoverflow.com/q/25600575
has text: Seems like the beginning of Singleton pattern implementation.
type: Comment
score: 4
type: QuestionComment

http://stackoverflow.com/q/25570308
has answer: http://stackoverflow.com/a/25570338
possible better answer: http://stackoverflow.com/a/25570599
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25570689
answer count: 3
has answer: http://stackoverflow.com/a/25570599
upvote count: 3
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39933906
has comment: http://stackoverflow.com/comment/39933811
has comment: http://stackoverflow.com/comment/39933807
has title: find non- common elements between two string arrays
favorite count: 0
type: Question
has body: There was a problem that is How to find non- common elements between two string arrays. Eg: String[] a = {"a", "b", "c", "d"}; String[] b = {"b", "c"}; // O/p should be a,d I have tried the below approach but please advise is there any other efficient way to achieve the same String[] a = {"a", "b", "c", "d"}; String[] b = {"b", "c"}; Set&lt;String&gt; set = new HashSet&lt;&gt;(a.length); for (String s : a) { set.add(s); } for (String s : b) { set.remove(s); } return set; please advise is there any other efficient approach also we can achieve this in java
accepted answer: http://stackoverflow.com/a/25570338
downvote count: 0

http://stackoverflow.com/q/25580464
score: 0
answer count: 2
tagged with: java
tagged with: java-me
has title: Which Java edition do I have?
type: Question
tagged with: jakarta-ee
possible better answer: http://stackoverflow.com/a/25580560
has body: How can I reliably determine whether my installed Java is J2ME, J2SE or J2EE? Please assume a Linux environment that has one JRE, but no a-priori knowledge of which edition. A preferential solution would be a one-liner that references some concrete existing resource, ie not compiling code specific to one of these and seeing what fails to build. Edit: I was hoping the answer would produce one of J2EE, J2SE or J2ME suitable for piping. java -version has to be parsed with a-priori knowledge of implementations, e.g. if the output contains JDK, infer J2SE. I am caving and accepting it, but if a new answer that meets this criteria is posted I'll accept that instead.
has answer: http://stackoverflow.com/a/25580560
has answer: http://stackoverflow.com/a/25580472
accepted answer: http://stackoverflow.com/a/25580472
type: AnsweredQuestion

http://stackoverflow.com/q/25647597
favorite count: 0
type: Question
has title: Simplify opening the file in the same folder as .jar
has comment: http://stackoverflow.com/comment/40075341
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40081043
has answer: http://stackoverflow.com/a/25648522
tagged with: java-8
has comment: http://stackoverflow.com/comment/40082630
score: 2
answer count: 2
has body: There's a runnable jar file and data.txt file next to it. data.txt may change dynamically. The program needs to read the content of this file. My first attempt at opening the file doesn't work: new InputStreamReader(getClass().getResourceAsStream("/data.txt"), "UTF-8"); I came to the following solution, but it is complex and a little bit awkward: new InputStreamReader(new FileInputStream(new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getParent() + "/data.txt"), "UTF-8"); It is difficult to understand what is going on here. I tried new File("./data.txt") and NPE was thrown. How to open data.txt file that is in the same folder as .jar file, but in more readable way?
tagged with: file-io
has answer: http://stackoverflow.com/a/25647801
has comment: http://stackoverflow.com/comment/40080193
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/8775303
downvote count: 1

http://stackoverflow.com/a/25552638
score: 3
has comment: http://stackoverflow.com/comment/39900435
has comment: http://stackoverflow.com/comment/39900622
has comment: http://stackoverflow.com/comment/39900627
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/39900710
accepted answer of: http://stackoverflow.com/q/25552613
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39900484
answers question: http://stackoverflow.com/q/25552613
has body: They'll both have the same outcome. Create a variable to store the result of the cast if you need to reuse the cast reference. When you perform a cast, you are setting yourself up for ClassCastException, so always be mindful. You can always check the type before you attempt a cast if (newStudent instanceof Student) { Student studentRef = (Student) newStudent; }
has comment: http://stackoverflow.com/comment/39900497

http://stackoverflow.com/a/25685050
score: 0
answers question: http://stackoverflow.com/q/25684900
type: Answer
has body: Likely what you want to do is extract the response from the HttpMethod that was executed. There are a few different methods within the HttpMethod for this, but I imagine you just want to do String response = post.getResponseBodyAsString();

http://stackoverflow.com/comment/40099203
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25659126
has text: see my comment above

http://stackoverflow.com/comment/40055685
score: 0
type: AnswerComment
has text: You are right, there is no harm in adding the "res/" in front of the file name. Wow, good catch on the "if(s = null)" . My code underwent a bunch of changes, and was just left over. It works now. THANKS SO MUCH. Been at this ALL day. You rule.
comment on: http://stackoverflow.com/a/25636684
type: Comment

http://stackoverflow.com/q/25646091
favorite count: 0
type: AnsweredQuestion
tagged with: apache-cloudstack
tagged with: java
has comment: http://stackoverflow.com/comment/40098808
upvote count: 4
has comment: http://stackoverflow.com/comment/40123844
score: 4
has comment: http://stackoverflow.com/comment/40074141
accepted answer: http://stackoverflow.com/a/25684249
has comment: http://stackoverflow.com/comment/40093719
type: Question
possible better answer: http://stackoverflow.com/a/25681827
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25681827
has comment: http://stackoverflow.com/comment/40074247
has title: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
has comment: http://stackoverflow.com/comment/40095059
has body: I needed to build Cloudstack from source and followed this article in the documentation. But everytime I built it with maven, I got stuck with following error. Guessing as a solution, I tried this build with oracle jdk-8, openjdk-7 and openjdk6. And also tried tomcat6 and tomcat8. But got no solution. What is going wrong? I think the reason could be a problem with a plugin but have no idea how to solve. I searched online for this error, but got no workaround. [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (compile) on project cloud-apidoc: Command execution failed. Process exited with an error: 1 (Exit value: 1) -&gt; [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (compile) on project cloud-apidoc: Command execution failed. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorI…
tagged with: maven
has answer: http://stackoverflow.com/a/25684249

http://stackoverflow.com/a/25697215
has body: You can work with the statement a bit. With DeMorgan's Law (!A || !B == !(A &amp;&amp;B)), you can turn it into !(i1 % 1 == 0 &amp;&amp; i1 % 2 == 0 ... &amp;&amp; i1 % 20 == 0) Now think about the statement a bit. A number mod another equaling zero means the first number is divisible by the second. That means the statement really reads: not (i1 is divisible by all the numbers 1-20). So find a number n that is divisible by all the numbers 1-20, and have the loop become while( !(i1 % n == 0) ), or just while(i1 % n != 0)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25697131

http://stackoverflow.com/comment/39966555
type: QuestionComment
score: 0
has text: `DisplayStudentInfo.activity` is this the **exact** name of the file?
comment on: http://stackoverflow.com/q/25587835
type: Comment

http://stackoverflow.com/comment/39921153
type: QuestionComment
comment on: http://stackoverflow.com/q/25563604
score: 4
has text: If I understand correctly, you are not sending any reference of the ArrayList to the function. Each time it creates a new list, resulting in losing previous values.
type: Comment

http://stackoverflow.com/q/25621055
has answer: http://stackoverflow.com/a/25621242
possible better answer: http://stackoverflow.com/a/25621242
downvote count: 1
has comment: http://stackoverflow.com/comment/40027117
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25621193
accepted answer: http://stackoverflow.com/a/25621193
tagged with: android-fragments
tagged with: android
tagged with: java
has title: NumberFormatException: Invalid int - String
score: -1
tagged with: android-activity
type: Question
upvote count: 0
has body: I have received the below exception while trying to retrieve number from the number column on Parse - NumberFormatException: Invalid int I want to retrieve number and then display the number in the TextView. I have been able to achieve this with strings, but is having difficulty with numbers. Below is logcat message: 09-02 10:00:27.881: E/AndroidRuntime(1267): FATAL EXCEPTION: main 09-02 10:00:27.881: E/AndroidRuntime(1267): Process: com.dooba.beta, PID: 1267 09-02 10:00:27.881: E/AndroidRuntime(1267): java.lang.NumberFormatException: Invalid int: "UserAge" 09-02 10:00:27.881: E/AndroidRuntime(1267): at java.lang.Integer.invalidInt(Integer.java:137) 09-02 10:00:27.881: E/AndroidRuntime(1267): at java.lang.Integer.parse(Integer.java:374) 09-02 10:00:27.881: E/AndroidRuntime(1267): at java.lang.Integer.parseInt(Integer.java:365) 09-02 10:00:27.881: E/AndroidRuntime(1267): at java.lang.Integer.parseInt(Integer.java:331) 09-02 10:00:27.881: E/AndroidRuntime(1267): at com.dooba.beta.Fragment1$6.done(Fragment1.java:371) 09-02 10:00:27.881: E/AndroidRuntime(1267): at com.parse.FindCallback.internalDone(FindCallback.java:45) 09-02 10:00:27.881: E/AndroidRuntime(1267): at com.parse.FindCallback.internalDone(FindCallback.java:31) 09-02 10:00:27.881: E/AndroidRuntime(1267): at com.parse.Parse$5$1.run(Parse.java:891) 09-02 10:00:27.881: E/AndroidRuntime(1267): at android.os.Handler.handleCallback(Handler.java:733) 09-02 10:00:27.881: E/AndroidRuntime(1267): at android.os.Handler.dispatchMessage(Handler.java:95) 09-02 10:00:27.881: E/AndroidRuntime(1267): at android.os.Looper.loop(Looper.java:136) 09-02 10:00:27.881: E/AndroidRuntime(1267): at android.app.ActivityThread.main(ActivityThread.java:5017) 09-02 10:00:27.881: E/AndroidRuntime(1267): at java.lang.reflect.Method.invokeNative(Native Method) 09-02 10:00:27.881: E/AndroidRuntime(1267): at java.lang.reflect.Method.invoke(Method.java:515) 09-02 10:00:27.881: E/AndroidRuntime(1267): at com.android.internal.os.ZygoteInit$Metho…
answer count: 2
tagged with: parse-platform

http://stackoverflow.com/q/25573124
tagged with: amqp
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25575260
tagged with: spring-rabbit
has body: I am using the Spring AMQP library .How do I configure connectionTimeouts and socketTimeouts in CachingConnectionFactory.I assume it must internally use http://www.rabbitmq.com/javadoc/com/rabbitmq/client/ConnectionFactory.html#setConnectionTimeout(int)
type: Question
tagged with: spring-amqp
tagged with: rabbitmq
has title: Set connectionTimeouts and socketTimeouts in Spring CachingConnectionFactory
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25575260
score: 0

http://stackoverflow.com/comment/40035570
has text: As I said, I've just read the doc to answer your question. So the best should for you to read it maybe. But I edited my answer to put what I think is good. You may put a good file path.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25624907
type: Comment

http://stackoverflow.com/q/25585020
downvote count: 0
has comment: http://stackoverflow.com/comment/39962086
upvote count: 1
tagged with: tomcat
tagged with: https
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39963976
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/12778012
has comment: http://stackoverflow.com/comment/39961573
tagged with: ssl
tagged with: pkix
has body: I'm pretty new to all this : but I'm trying to achieve the following: Create a 'Certificate Authority' (done : used openssl). Create a priv/pub key-pair for Tomcat (done : used keytool). Create a 'Certicate Signing Request' (done: used keytool). Carried out the 'Certificate Signing Request' (done: using openssl, signed with 'CA'). Installed the CA (self-signed of course) back into my (default JDK's) Tomcat's keystore. Installed the resultant CA-signed-certificate back in the (default JDK's) Tomcat's keystore (keytool used for step 5 and 6). So now my Tomcat (JDK default) keystore contains: My Private Key / Public Key Pair. The CA's public key/self-signed cert. My CA-Signed Certificate. But when I contact my host with openssl: only the original Self-Signed Cert is (see below for the test and output). How does Tomcat decide which cert-path to return in the SSL handshake ? Is it hardcoded to look for certs that have the subject 'tomcat' or something ? I'm using JDK 1.6, using the JSSE, not APR option for Tomcat. TEST showing only original self-signed cert is returned, not the cert-chain, including the CA. openssl s_client -connect myhost:443 -showcerts Gives: CONNECTED(00000003) depth=0 /C=ai/ST=all/L=virtualworldone/O=computers/OU=appserver/CN=tomcat verify error:num=18:self signed certificate verify return:1 depth=0 /C=ai/ST=all/L=virtualworldone/O=computers/OU=appserver/CN=tomcat verify return:1 --- Certificate chain 0 s:/C=ai/ST=all/L=virtualworldone/O=computers/OU=appserver/CN=tomcat i:/C=ai/ST=all/L=virtualworldone/O=computers/OU=appserver/CN=tomcat -----BEGIN CERTIFICATE----- [binary] -----END CERTIFICATE----- --- Server certificate subject=/C=ai/ST=all/L=virtualworldone/O=computers/OU=appserver/CN=tomcat issuer=/C=ai/ST=all/L=virtualworldone/O=computers/OU=appserver/CN=tomcat --- No client certificate CA names sent --- SSL handshake has read 1284 bytes and written 276 bytes --- New, TLSv1/SSLv3, Cipher is EDH-DSS-DES-CBC3-SHA Server public key is 1024 bit Compr…
linked to: http://stackoverflow.com/q/24974324
has title: Tomcat7 : how to deliver the correct certificate chain?
linked to: http://stackoverflow.com/q/12778012
has comment: http://stackoverflow.com/comment/39961750
has comment: http://stackoverflow.com/comment/39961799
has comment: http://stackoverflow.com/comment/39962924
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9299133

http://stackoverflow.com/comment/40042733
has text: i've done this in C# like this https://www.youtube.com/watch?v=_lPkc1YV2vQ&feature=youtu.be .can u please tell me to do this in Java :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25628821
type: AnswerComment

http://stackoverflow.com/q/25656885
tagged with: java
has body: I got this weird exception at the end of compilation java.lang.ClassCastException: javassist.bytecode.InterfaceMethodrefInfo cannot be cast to javassist.bytecode.MethodrefInfo at javassist.bytecode.ConstPool.getMethodrefNameAndType(ConstPool.java:417) at javassist.expr.MethodCall.getNameAndType(MethodCall.java:43) at javassist.expr.MethodCall.getMethodName(MethodCall.java:107) at javassist.expr.ExprEditor.loopBody(ExprEditor.java:217) at javassist.expr.ExprEditor.doit(ExprEditor.java:91) at javassist.CtBehavior.instrument(CtBehavior.java:712) at play.core.enhancers.PropertiesEnhancer.rewriteAccess(PropertiesEnhancer.java:156) at play.PlayCommands$$anonfun$PostCompile$1$$anonfun$9.apply(PlayCommands.scala:99) at play.PlayCommands$$anonfun$PostCompile$1$$anonfun$9.apply(PlayCommands.scala:99) at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:264) at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47) at scala.collection.TraversableLike$class.filter(TraversableLike.scala:263) at scala.collection.AbstractTraversable.filter(Traversable.scala:105) at play.PlayCommands$$anonfun$PostCompile$1.apply(PlayCommands.scala:99) at play.PlayCommands$$anonfun$PostCompile$1.apply(PlayCommands.scala:76) at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:35) at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:34) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42) at sbt.std.Transform$$anon$4.work(System.scala:64) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18) at sbt.Execute.work(Execute.scala:244) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237) at sbt.Execute$$anonfun$submit$1.apply(Execute.scal…
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/38765930
possible better answer: http://stackoverflow.com/a/38765930
has answer: http://stackoverflow.com/a/25694693
has comment: http://stackoverflow.com/comment/82915948
upvote count: 2
type: AnsweredQuestion
score: 2
has title: playframework 2.3.x (java) upgrade javassist
answer count: 2
downvote count: 0
tagged with: playframework
accepted answer: http://stackoverflow.com/a/25694693

http://stackoverflow.com/comment/40072330
has text: Highgui.imwrite(canvas, iframe); // probably won't even compile
comment on: http://stackoverflow.com/q/25641324
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25696273
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40164368
tagged with: user-interface
has body: I was wondering if I could get some help on my application. I can not find the right values without stuffing everything up. Its using GridBagConstraint, JPanel, JScrollPane (Doesn't Work on one of the panels), JButton, JTabbedPane and JTextArea. The relevant code that is stuffing the display up is down below. TabBar and FileViewer extends of JPanel and Window extends of JFrame; My init for the tabs and how I add tabs. (This isn't the JScrollPane stuffup part) private TabBarComponent() { super(new GridLayout(0, 1, 5, 0)); instance = this; tabbedPane = new JTabbedPane(); add(tabbedPane); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); } public void addBar(String text, JScrollPane s) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(s); tabbedPane.addTab(text, panel); } This is the JScrollPane stuff up one... right now it doesn't bother me but will eventually. I add to the panel by panel.add(button). public FileViewerComponent() { super(new GridLayout(0, 1, 5, 0)); instance = this; panel = new JPanel(); panel.setLayout(new GridLayout(0, 1, 5, 0)); scrollArea = new JScrollPane(panel); addButtons(); add(scrollArea); } Here is where I create the Window. This is where the help is required. I don't know what values I should set. I have looked at the documentation and how the classes work. private WindowComponent() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.exit(1); } setSize(new Dimension(1024, 900)); setLocationRelativeTo(null); setTitle("GridBagConstraints"); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); setJMenuBar(new MenuBarComponent()); c.gridx = 0; c.gridy = 0; c.weightx = 0.5; c.weighty = 1; c.anchor = GridBagConstraints.NORTHWEST; add(FileViewerComponent.getInstance(), c); c = new GridBagConstraints(); c.gridwidth = 2; c.gridx = 1; c.gridy = 0; c.weightx = 0.5; c.weighty = 1; c.anchor …
tagged with: layout-manager
favorite count: 0
type: Question
tagged with: gridbaglayout
has comment: http://stackoverflow.com/comment/40164339
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40164637
has title: Java - I cannot find values that would work
tagged with: swing
downvote count: 0
answer count: 0

http://stackoverflow.com/q/25644667
accepted answer: http://stackoverflow.com/a/25646887
upvote count: 0
has answer: http://stackoverflow.com/a/25646887
answer count: 1
has title: Disable the facility of WebView in android?
downvote count: 1
favorite count: 0
type: Question
type: AnsweredQuestion
tagged with: android-webview
tagged with: swipe
tagged with: android
tagged with: java
linked to: http://stackoverflow.com/q/3853794
score: -1
tagged with: epub
has body: In order to display Epub, I used WebView.There for , by this [WebView] I can select the Text by touching and holding and some facility appears like copy , find , share etc. After that, I used Swipe to change the page by right or left , but after using Swipe I can't select the text by touching and holding , what is the solution ? I didn't share the code because it is too long , but i can share it necessary .

http://stackoverflow.com/comment/39919677
comment on: http://stackoverflow.com/q/25562646
has text: Problem is clear from the log. Isn't it?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25690244
has comment: http://stackoverflow.com/comment/40152709
answers question: http://stackoverflow.com/q/25678242
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40199413
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40152653
has body: Typically, an editable cell will display the default text when in non-editing mode and an editing control (your DateTimePicker) when in editing mode. Your custom cell implementation needs to handle the transition between those as well as making sure the text and value for the editing control are properly updated if the cell's item is updated. So you should override updateItem(...) to update the value of the DateTimePicker if in editing mode (isEditing()) or the text if not. Override startEdit() to switch to show the DateTimePicker instead of the text, and cancelEdit() to switch back. You might not need to override commitEdit() at all. If your column is bound to a property, the default commitEdit() should update that property (or you can do this in an onEditCommit handler registered with the column). The tutorial has an example of a fully-implemented editable table cell: see listing 13.11 near the bottom. However, you will need to invoke commitEdit(...) at the appropriate time. The semantics of this are a bit tricky: you probably want to commit the edit if the user presses Enter when any of the individual controls inside your DateTimePicker have focus, and perhaps when the focus moves away from the DateTimePicker entirely. I would recommend creating an onAction property in your DateTimePicker class. This is pretty easy to do, you just have to call setEventHander(...) when the property changes. There's a nice example in Richard Bair's MoneyField (there's a lot of stuff in that link, just look at where he creates the onAction handler). You can then (internally to the DateTimePicker) check for action events (or perhaps Enter key presses) on the individual controls and call fireEvent(new ActionEvent(...)) when that happens. Then your table cell implementation can register an onAction with the DateTimePicker and call commitEdit(...). Committing the edit on focus loss shouldn't be much harder. Maybe expose a ReadOnlyBooleanProperty hasFocus() in DateTimePicker: private fin…
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25678242

http://stackoverflow.com/q/25552960
favorite count: 0
type: Question
has body: Hi all!! Sorry if this is a dumb question, but I'm new to Maven and have reached an impasse! I have a project which uses MyTest.properties, MoreMyTest.properties. I use the Maven Shade plugin to build this project into a .jar file, which is working fine! Unfortunately, the shade plugin is packaging MyTest.properties inside my jar file. Then, I get this error when I try to execute the jar. java.io.FileNotFoundException: Unable to locate: properties/MyTest.properties at file:\C:\Dev\test.jar!\properties\MyTest.properties at ... I'm wanting to access my properties both inside my IDE, and by running the jar from the command line when I deploy. I was thinking of having my properties files in a relative folder ../lib/ above the location of my jar file. Inside my program I want to access the properties like so: File testProperties = new File( ClassLoader.getSystemResource("properties/MyTest.properties").getFile() ); I tried adding this to my POM.xml *.properties ../*properties (Sorry the formatting got messed on the above code snippet!) But, it's not working. I'd really appreciate any help in this. I've not posted all code as the code is really big, but I hope you can get an idea of what I'm trying to achieve. Many thanks, Paul
has title: Maven Shade External Properties file relative to final Jar
has comment: http://stackoverflow.com/comment/39901677
has answer: http://stackoverflow.com/a/25553358
type: UnansweredQuestion
tagged with: maven
tagged with: maven-shade-plugin
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/64333152
score: 1
tagged with: java
answer count: 1

http://stackoverflow.com/a/37385165
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25581685
type: Answer
has body: You can use default account with same username and password If you use account in LDAP or DB you can config deployerConfigContext.xml file in path : cas\WEB-INF, example with LDAP : Step1: add library support ldap in pom.xml : org.jasig.cas cas-server-support-ldap 3.5.2 org.springframework.ldap spring-ldap-core 1.3.2.RELEASE Step 2: in deployerConfigContext.xml file find line : replace it with : Step 3: add 1 bean before tag to connect LDAP : ldap://10.0.0.11:2389 java.naming.security.authentication simple Select edit to see full, Hope it help you, cheer !

http://stackoverflow.com/q/25584032
has title: Is there a way to check if Android device supports openGL ES 3.0?
upvote count: 9
type: UnansweredQuestion
has body: I need to check dynamically if the used device supports openGL ES 3.0. How can I do that? I can't find anything in google or here...
downvote count: 0
has answer: http://stackoverflow.com/a/25584073
has comment: http://stackoverflow.com/comment/39959330
has answer: http://stackoverflow.com/a/47929465
has answer: http://stackoverflow.com/a/45475615
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25584264
tagged with: opengl-es-3.0
has comment: http://stackoverflow.com/comment/39959737
linked to: http://stackoverflow.com/q/9198293
answer count: 4
tagged with: opengl-es
favorite count: 0
type: Question
score: 9

http://stackoverflow.com/q/25630802
has answer: http://stackoverflow.com/a/25632114
has body: I'm writing a short program to prompt the user for numeric inputs, which I will then test to see if they are negative and report back which ones pass this test. I'm looking for a method that avoids duplicating logic for each expected input. Here's what I have so far: import java.util.Scanner; public class Negative { public static void main(String[] arg) { Scanner scan = new Scanner(System.in); System.out.println("Insert three integers, USER."); int x = scan.nextInt(); int y = scan.nextInt(); int z = scan.nextInt(); if (x &lt; 0 || y &lt; 0 || z &lt; 0) { System.out.println("A number is negative."); } } } I know I can do each of these individually but I'd like to condense the code somehow.
has comment: http://stackoverflow.com/comment/40045426
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25632018
has answer: http://stackoverflow.com/a/25631191
type: UnansweredQuestion
tagged with: java
has title: How can I test multiple inputs to detect negative numbers, simultaneously recording which input(s) were negative?
tagged with: integer
tagged with: int
has comment: http://stackoverflow.com/comment/40045365
has comment: http://stackoverflow.com/comment/40045546
answer count: 3
has comment: http://stackoverflow.com/comment/40045473
upvote count: 2
score: 0
downvote count: 2

http://stackoverflow.com/comment/40042374
type: QuestionComment
comment on: http://stackoverflow.com/q/25629258
has text: add a static reference of your MediaPlayer in your Activity or use a singleton class
score: 0
type: Comment

http://stackoverflow.com/comment/66483153
comment on: http://stackoverflow.com/a/31936782
type: Comment
has text: If you don't use Spring RestTemplate, you can check WireMock. However this will start a server in the background.
type: AnswerComment
score: 1

http://stackoverflow.com/comment/40165427
type: AnswerComment
comment on: http://stackoverflow.com/a/25696875
has text: how to get them with some key value.. like System.getProp("KEYNAME")
type: Comment
score: 0

http://stackoverflow.com/comment/40003355
has text: @sweetpoison: you may be assuming incorrectly. You may be using a Java 1.6 compiler but your setting looks to be 1.4. If you're using Eclipse then you have to change your Java compiler settings.
score: 0
comment on: http://stackoverflow.com/q/25607834
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25838608
answers question: http://stackoverflow.com/q/25701826
has body: First of all, make sure that you get instances Entity from the database, NOT EntityDetails. Try to create an isolated scenario, without the database. Just instantiate your Entity, fill it with something create the response and marshal it. See what happens. You'll isolate the problem - either you're getting wrong instances from the database or the marshalling does not work as expected. Both is a bit hard to diagnose without seeing your code. Try to reduce your problem to one of the two I mentioned above. Diclaimer: I'm the author of Hyperjaxb3.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41097653
has comment: http://stackoverflow.com/comment/41095220

http://stackoverflow.com/comment/40074004
type: Comment
score: 0
type: QuestionComment
has text: Which part of code you really need? Is just a paintComponent method with randoms()
comment on: http://stackoverflow.com/q/25646891

http://stackoverflow.com/q/25622906
tagged with: java
accepted answer: http://stackoverflow.com/a/25625649
type: Question
has title: How to import appContext.xml with Spring-Boot?
has body: I have an annotation-based spring-boot app and want to import the src/main/webapp/WEB-INF/appContext.xml. The following does not work: @Configuration @EnableAutoConfiguration @ImportResource("classpath*:appContext.xml") public class AppConfig { } But if I copy the appContext.xml to src/main/resources it works as expected. How can I make the WEB-INF folder work?
answer count: 1
has comment: http://stackoverflow.com/comment/40030372
tagged with: spring
has comment: http://stackoverflow.com/comment/40031631
has answer: http://stackoverflow.com/a/25625649
type: AnsweredQuestion
tagged with: spring-boot
score: 0
has comment: http://stackoverflow.com/comment/40034704
has comment: http://stackoverflow.com/comment/40031357

http://stackoverflow.com/q/25682890
answer count: 1
downvote count: 0
upvote count: 7
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25694527
accepted answer: http://stackoverflow.com/a/25694527
has body: I am not completely certain about the purpose for the auto-increment flag in the hazelcast xml config file. When I have that turned off, I see multiple exceptions in my server instance complaining about port not being open (already in use) for port 5701 (since hazelcast is no longer moving over to port 5702 etc). Why does Hazelcast need this property when I am using tcp enabled server setup? I see the following in my log statements after running the server and it seems to be be listening on port 5701 (default in config): Members [1] { Member [127.0.0.1]:5701 this } 2014-09-05 05:46:00,407 INFO c.h.c.LifecycleService [main] [127.0.0.1]:5701 [dev] [3.2.4] Address[127.0.0.1]:5701 is STARTED 2014-09-05 05:46:00,414 INFO c.a.c.n.SendServerEmail [main] hazelcast server email notification for server 192.168.110.154 WildMetrix Hazelcast server launched at 192.168.110.154 2014-09-05 05:46:01,336 INFO c.h.p.InternalPartitionService [hz._hzInstance_1_dev.cached.thread-1] [127.0.0.1]:5701 [dev] [3.2.4] Initializing cluster partition table first arrangement... 2014-09-05 05:46:01,521 INFO c.h.i.DefaultAddressPicker [main] null [dev] [3.2.4] Interfaces is disabled, trying to pick one address from TCP-IP config addresses: [127.0.0.1] 2014-09-05 05:46:01,522 INFO c.h.i.DefaultAddressPicker [main] null [dev] [3.2.4] Picked Address[127.0.0.1]:5702, using socket ServerSocket[addr=/0.0.0.0,localport=5702], bind any local is true 2014-09-05 05:46:01,602 INFO c.h.system [main] [127.0.0.1]:5702 [dev] [3.2.4] Hazelcast 3.2.4 (20140721) starting at Address[127.0.0.1]:5702 2014-09-05 05:46:01,602 INFO c.h.system [main] [127.0.0.1]:5702 [dev] [3.2.4] Copyright (C) 2008-2014 Hazelcast.com 2014-09-05 05:46:01,604 INFO c.h.i.Node [main] [127.0.0.1]:5702 [dev] [3.2.4] Creating TcpIpJoiner 2014-09-05 05:46:01,606 INFO c.h.c.LifecycleService [main] [127.0.0.1]:5702 [dev] [3.2.4] Address[127.0.0.1]:5702 is STARTING 2014-09-05 05:46:01,619 INFO c.h.c.TcpIpJoiner [main] [127.0.0.1]:5702 [dev] [3.2.4] …
tagged with: hazelcast
type: AnsweredQuestion
has title: purpose of auto increment flag in hazelcast config
score: 7
tagged with: java

http://stackoverflow.com/q/25614193
has comment: http://stackoverflow.com/comment/40014642
has answer: http://stackoverflow.com/a/25614253
has comment: http://stackoverflow.com/comment/40014687
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25614240
score: 0
has title: In a LinkedList, what is the difference between : list.add(...) and object.list.add(...)?
tagged with: linked-list
answer count: 3
has answer: http://stackoverflow.com/a/25614240
tagged with: java
possible better answer: http://stackoverflow.com/a/25614253
type: Question
has comment: http://stackoverflow.com/comment/40014676
has body: Im doing some assignments and in one exercise, we have to copy paste this : class Example { LinkedList&lt;String&gt; queue; //Some simple methods to add or remove from queue. public static void main(String[]args) { Example obj = new Example(); obj.queue = new LinkedList&lt;String&gt;(); //Basic instructions to add items to the queue } } But this confuses me, we were creating and filling Lists like this : LinkedList&lt;String&gt; queue = new LinkedList&lt;String&gt;(); queue.add("abc"); queue.add("bca"); And now we have to create it like Example obj = new Example(); obj.queue = new LinkedList&lt;String&gt;(); And i wonder if if there is any difference between : obj.queue.add("aab"); and queue.add("aab); I know this is really basic, but i lack some basic concepts and im pretty lost with this. Thank you.
has answer: http://stackoverflow.com/a/25616349
has comment: http://stackoverflow.com/comment/40014694

http://stackoverflow.com/a/25670619
has body: Store the object in session. Inside your servlet, just call this: User user = ... //use your UserManager or something else to get the user if (&lt;valid user&gt;) { //store the user object in session request.getSession().setAttribute("user", user); } //forward to the next view... Then you can retrieve the data in your view (JSP, Facelets) using Expression Language: &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;!-- tags... --&gt; &lt;div&gt; Welcome ${user.name} &lt;!-- ${user.name} will call session.getAttribute("user").getName() for you --&gt; &lt;/div&gt; &lt;/html&gt; More info: HttpSession How to avoid Java code in JSP files? Didn't provide an example using scriptlets because you should not use them. Explanation on link above. Don't forget to clear the session when performing a log out: request.getSession().invalidate();
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/25670581
upvote count: 4
answers question: http://stackoverflow.com/q/25670581
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25675751
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25675474
downvote count: 0
has body: Because JComboBox isn't an AbstractButton. Now it may have made sense to make both AbstractButton and JComboBox both some interface defined as ActionListenerAccepter or something like that, but that just wasn't the way the two classes were defined. Assuming you want a solution of having one method (if not use overloaded methods like suggested), I would just use instanceof in this case to keep your code simple (avoiding something like that Adapter you have). private void addActionListener(ActionListener listener, JComponent... possibleActionListenerComponents) { for(JComponent c : possibleActionListenerComponents) if (c instanceof AbstractButton) ((AbstractButton)c).addActionListener(listener); else if (c instanceof JComboBox) ((JComboBox)c).addActionListener(listener); }
has comment: http://stackoverflow.com/comment/40127640
type: Answer
has comment: http://stackoverflow.com/comment/40126508
accepted answer of: http://stackoverflow.com/q/25675474
score: 2
has comment: http://stackoverflow.com/comment/40126486
upvote count: 2

http://stackoverflow.com/comment/40002657
score: 0
type: AnswerComment
type: Comment
has text: hello, now I`m using your configuration and it works:) The problem was, I had several property files, and one overrides the other. So the configuraton was not read correctly:)
comment on: http://stackoverflow.com/a/25604957

http://stackoverflow.com/q/25689383
has comment: http://stackoverflow.com/comment/40152458
has answer: http://stackoverflow.com/a/25690364
has title: FileReader; select file extension
tagged with: java
has body: I just made a file reader in Java. I will use it for the game Hangman, now the user can chose which word-list/dictionary they want to use. It works great, but when the user has to select a file, he can chose all types of files. However, I want them to only open .txt files to assure the working of the program. What code do I have to use so that the user can only open text files? This is the file reader method I use: private static ArrayList readData(File someFile) { String data; ArrayList&lt;String&gt; aStringArrayList = new ArrayList&lt;String&gt;(); try // men is verplicht een try block te gebruiken. { FileReader filereader = new FileReader(someFile.getAbsolutePath()); JOptionPane.showMessageDialog(null, "Gekozen woordenlijst is: " + someFile.getAbsolutePath()); BufferedReader bufferedreader = new BufferedReader(filereader); while((data = bufferedreader.readLine()) != null) { System.out.println("\nIngelezen data is " + data); aStringArrayList.add(data); } filereader.close(); } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(null, "Got an FileNotFoundException: " + e.getMessage()); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Got an IOException: " + e.getMessage()); } return (aStringArrayList); }
tagged with: filefilter
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25690364
has comment: http://stackoverflow.com/comment/40150945
answer count: 1
tagged with: swing
type: Question

http://stackoverflow.com/comment/40186345
has text: @user3784463:- http://joda-time.sourceforge.net/apidocs/org/joda/time/Days.html
type: Comment
comment on: http://stackoverflow.com/a/25708559
type: AnswerComment
score: 1

http://stackoverflow.com/comment/39983274
score: 0
comment on: http://stackoverflow.com/a/25595359
type: Comment
type: AnswerComment
has text: I'm no longer using file system approach, instead using `getResourceAsStream` but still having issues, any ideas? updated question

http://stackoverflow.com/q/25629031
has answer: http://stackoverflow.com/a/25632922
tagged with: java
has comment: http://stackoverflow.com/comment/40042244
score: 9
type: Question
has body: I have a this sample protobuf message: message testMessage{ oneof oneOfTest{ string test2 = 2; int32 test3 = 3; } } But it is failing to compile, saying: [ERROR] protoc failed error: Expected "required", "optional", or "repeated". test.proto: Missing field number. Based on the line numbers, it is looking for that required/optional/repeated keyworkd before "oneof" and it is complaining of the missing field number after "oneOfTest". Is this not the correct way to use oneof? I am using the java compiler for Protobuf.
has comment: http://stackoverflow.com/comment/40044195
downvote count: 0
answer count: 1
has title: Protobuf "oneof" functionality not working
favorite count: 0
has comment: http://stackoverflow.com/comment/40042457
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25632922
tagged with: protocol-buffers
upvote count: 9

http://stackoverflow.com/q/25552499
type: UnansweredQuestion
score: -2
has title: Jar for different operating systems
has comment: http://stackoverflow.com/comment/39900202
has comment: http://stackoverflow.com/comment/39900469
has comment: http://stackoverflow.com/comment/39900313
tagged with: maven
has body: I created a project in java and made a jar. I did this using maven on a Linux OS. My problem is the jar compiles and works fine on Linux. But when it comes to running it on windows it doesnt work really well. As in a jframe will appear but functions wont work. I was looking at swtjar But i hasnt been much help. Do jars not run on different os. Can anyone point me in the right direction I have no idea why this is. Thanks edit I get a NoClassDefFoundError for my gui
has comment: http://stackoverflow.com/comment/39900485
has comment: http://stackoverflow.com/comment/39900549
upvote count: 0
downvote count: 2
tagged with: java
tagged with: executable-jar
tagged with: jar
has answer: http://stackoverflow.com/a/25552883
has answer: http://stackoverflow.com/a/25604302
has comment: http://stackoverflow.com/comment/39900145
has comment: http://stackoverflow.com/comment/39900098
has comment: http://stackoverflow.com/comment/39900291
favorite count: 0
type: Question
answer count: 2
tagged with: linux

http://stackoverflow.com/comment/40132479
type: QuestionComment
has text: it is an offtopic here. Use google to find answers to this question.
comment on: http://stackoverflow.com/q/25679274
score: 1
type: Comment

http://stackoverflow.com/a/25636678
type: Answer
answers question: http://stackoverflow.com/q/25635537
has body: If you're asking how your controller could respond with a dynamic redirect, the answer is either: (1) Have the controller return a "redirect:" result instead of view name. It must be followed with an absolute url, and behavior might depend on your spring version and configuration, but basically it looks like this: @RequestMapping(...) public String myMethod(){ String url=... // database lookup, e.g. "http://myUrl" return "redirect:"+url; } (2) Less elegant but sometimes useful: get direct access to the response. If your controller method has a parameter of type HttpServletResponse spring will automatically inject it. So: @RequestMapping(...) public String myMethod(HttpServletResponse resp){ ... response.sendRedirect(...) }
score: 0

http://stackoverflow.com/a/25718720
has comment: http://stackoverflow.com/comment/40221397
has body: EDIT I don't think there is a solution for this issue. Please look in Gigya documentation and examples: 1. Share. 2. Advance share. Answer bellow is incorrect. End EDIT It seems that you may be missing the 'type' in the mediaItems object. Please look in Gigya documentation. The output user action json should look like this: { 'title' : 'text', 'mediaItems' : [{ 'type' : 'image', 'src' : 'http://www.f2h.co.il/logo.jpg', } ], }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25711172
score: 0
has comment: http://stackoverflow.com/comment/40208470
answers question: http://stackoverflow.com/q/25711172
has comment: http://stackoverflow.com/comment/40240510
type: Answer
has comment: http://stackoverflow.com/comment/40220770

http://stackoverflow.com/q/25587719
has comment: http://stackoverflow.com/comment/39966096
favorite count: 0
has answer: http://stackoverflow.com/a/25587844
has answer: http://stackoverflow.com/a/25587771
type: Question
has answer: http://stackoverflow.com/a/25587786
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25587750
has comment: http://stackoverflow.com/comment/39975124
score: 4
upvote count: 4
has title: Error with Java's charAt()
has comment: http://stackoverflow.com/comment/39966088
tagged with: char
has answer: http://stackoverflow.com/a/25588682
has answer: http://stackoverflow.com/a/25587788
downvote count: 0
has body: I'm trying to create a program where the user enters a string, and the program echos it to the monitor with one character per line. However, I can't compile what I've written. An error pops up at this line: char c = word.charAt(i); Here is my code: import java.util.Scanner; public class charAt { public static void main(String[] args) { System.out.println("Give me a word, just one word:"); Scanner kb = new Scanner(System.in); String word = kb.nextLine(); for(int i=0; i&lt;word.length(); i++) char c = word.charAt(i); System.out.println(" " + c); } } Also, if you could explain your answer, that'd be greatly appreciated.
has answer: http://stackoverflow.com/a/25587774
tagged with: java
answer count: 7

http://stackoverflow.com/comment/39990892
has text: I could, but you'd definitely benefit more from doing it yourself. However, [here](http://www.vogella.com/tutorials/EclipseJFaceTable/article.html) is an excellent tutorial that should help you in the process.
comment on: http://stackoverflow.com/q/25599641
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25667245
answer count: 1
has body: I've created MCC Test account, and I got a developer token which still need to be approved. But this should be no problem as cited by google: ... You don't need to wait for your developer token to be approved before using it with a test account. So why I'm getting this exception : Exception in thread "main" AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server faultSubcode: faultString: [QuotaCheckError.ACCOUNT_INACTIVE @ ; trigger:'&amp;lt;null&amp;gt;'] faultActor: faultNode: faultDetail: {https://adwords.google.com/api/adwords/cm/v201406}ApiExceptionFault:&lt;message&gt;[QuotaCheckError.ACCOUNT_INACTIVE @ ; trigger:'&amp;lt;null&amp;gt;']&lt;/message&gt;&lt;ApplicationException.Type&gt;ApiException&lt;/ApplicationException.Type&gt;&lt;errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="QuotaCheckError"&gt;&lt;fieldPath/&gt;&lt;trigger&gt;&amp;lt;null&amp;gt;&lt;/trigger&gt;&lt;errorString&gt;QuotaCheckError.ACCOUNT_INACTIVE&lt;/errorString&gt;&lt;ApiError.Type&gt;QuotaCheckError&lt;/ApiError.Type&gt;&lt;reason&gt;ACCOUNT_INACTIVE&lt;/reason&gt;&lt;/errors&gt;
type: Question
has title: Google Ads API tells me Account inactive
tagged with: google-oauth-java-client
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25887468
tagged with: google-oauth
score: 0
tagged with: java
tagged with: oauth-2.0

http://stackoverflow.com/q/25562479
tagged with: steganography
tagged with: byte
has comment: http://stackoverflow.com/comment/39919346
tagged with: arrays
has title: I am reading an image and changing it. But the changes are not being saved
has comment: http://stackoverflow.com/comment/39919166
has answer: http://stackoverflow.com/a/25563160
accepted answer: http://stackoverflow.com/a/25563160
has comment: http://stackoverflow.com/comment/39919630
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39919370
upvote count: 3
downvote count: 2
answer count: 2
score: 1
has answer: http://stackoverflow.com/a/25562859
possible better answer: http://stackoverflow.com/a/25562859
tagged with: java
has body: I am trying to implement a steganography. I am reading an image "a.jpeg" and inserting a byte in it by changing its consecutive 7 bytes at the least significant bit starting from offset 50. This is done successfully as when I print the bytes the last bits are changed accordingly. Then I saved it as "ao.jpeg". But when I am reading the byte values from 50, they are not the same as the once i saved. here's my code public static void main(String[] args) throws IOException { BufferedImage inputImage = ImageIO.read(new File("a.jpeg")); int offset=50; byte data = 7; byte[] image = get_byte_data(inputImage);//function converts bufferedimage to byte array //add data at end of each byte starting from offset System.out.println("bytes altered are :"); for(int bit=7; bit&gt;=0; --bit, ++offset)//for each bit of data { int b = (data &gt;&gt;&gt; bit) &amp; 1; image[offset] = (byte)((image[offset] &amp; 0xFE) | b ); String s1 = String.format("%8s", Integer.toBinaryString(image[offset] &amp; 0xFF)).replace(' ', '0'); System.out.println(s1); } //write changed image to ao.jpeg BufferedImage outputImage = ImageIO.read(new ByteArrayInputStream(image)); File outputfile = new File("ao.jpeg"); ImageIO.write(outputImage,"jpeg",outputfile); //read data from ao.jpeg System.out.println("bytes from encoded image are :"); byte result=0; offset=50; BufferedImage oImage = ImageIO.read(new File("aoc.jpeg")); byte[] image1 = get_byte_data(oImage);//function converts bufferedimage to byte array for(int i=0; i&lt;8; i++, ++offset) { result = (byte)((result &lt;&lt; 1) | (image1[offset] &amp; 1)); String s1 = String.format("%8s", Integer.toBinaryString(image1[offset] &amp; 0xFF)).replace(' ', '0'); System.out.println(s1); } System.out.println("recovered data is :"); System.out.print(result); } output sample : data inserted is 7. If you notice the least significant bit of each byte it is forming 7. But when i read it again it is random bytes. bytes altered are : 00010100 00011100 00011010 00011110 000…
has comment: http://stackoverflow.com/comment/39920191
tagged with: bufferedimage
linked to: http://stackoverflow.com/q/17187880
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39919265
has comment: http://stackoverflow.com/comment/39919257

http://stackoverflow.com/a/25571757
score: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/25571520
upvote count: 2
has body: You have those fields declared as private. If that's really what you intend (as opposed to protected or package-protected), move those annotations to the getters. Having annotations on getters is defined as a hibernate best practice. See: Hibernate Annotation Placement Question An instance of SomeEntity doesn't actually have the field 'updatedAt' because that field is a private member of its super class. The persistence provider sees that the super class needs columns for those fields, but it also sees that the instantiated concrete class doesn't make use of those columns since the concrete class can't 'see' the field 'updateAt'.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25571520

http://stackoverflow.com/a/58548320
has body: int divB = B / K; int divA = A / K; if(A % K != 0) { divA++; } return (divB - divA) + 1; passed 100% in codelity
type: Answer
answers question: http://stackoverflow.com/q/25661519
score: 0

http://stackoverflow.com/comment/40053839
has text: Then go with @MadProgrammer's recommendation of using an observer pattern. For instance, you could create a non-GUI model class, that holds the data that is displayed in the main method. The other classes could be passed a reference to this object, and then could change its state. The main could then be notified of changes by registering a listener on to the model object.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25635428
score: 0

http://stackoverflow.com/comment/40190090
score: 0
comment on: http://stackoverflow.com/q/25705478
has text: and post new questions. dont update the same question with different issue
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25694261
has comment: http://stackoverflow.com/comment/40185489
tagged with: android-activity
has comment: http://stackoverflow.com/comment/40197252
has title: using @background over two activities
has comment: http://stackoverflow.com/comment/40176299
type: Question
answer count: 0
type: UnansweredQuestion
tagged with: android-annotations
tagged with: android
has comment: http://stackoverflow.com/comment/40162124
score: 0
has body: Is it possible to create a background thread using andriodannotations thats starts in one activity and finish in another activity. here is what i thought migh have worked ActivityA public static LoadingDialog LoadingScreen = new LoadingDialog(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //..... LoadingScreen.CreateDialog(context); } Background Class public class LoadingDialog { private Dialog loader_dialog; @Background public void CreateDialog(Context mContext) { loader_dialog = new Dialog(mContext,android.R.style.Theme_Black_NoTitleBar_Fullscreen); loader_dialog.setContentView(R.layout.loading_screen); loader_dialog.show(); } public void Remove() { loader_dialog.dismiss(); } } the dialog displays correctly but when I finish() activityA to start activityB the thread appears to be killed to and i get a black screen. Any help on this would be much appreciated.
has comment: http://stackoverflow.com/comment/40177204
tagged with: java

http://stackoverflow.com/comment/40034919
has text: I intended to force you into realizing yourself what you want to do. Showing example is easier, but the general description navigates your brain towards the *algorithm* :)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25620749

http://stackoverflow.com/q/25593391
has body: I'm making multiple quiz app with sqlite database. I randomly select 5 rows using "ORDER BY RANDOM()" in rawquery, but the same row sometimes comes up in a row. It shows 5 different rows in some case. Random choosing also works correctly as well, so my rawquery seems to work correctly. I just cannot find out in which case it shows the same question and choices in a row. Does anyone have the same problem as mine?? Here is my code. public class QuizActivity extends Activity implements OnClickListener { int Correct = 0; int Cnt = 1; String fieldinfo; String question; String answer; String choice1; String choice2; private MySQLHelper mDbHelper; private SQLiteDatabase db; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_quiz); onQuestion(); } public void onQuestion(){ mDbHelper = new MySQLHelper(this); db = mDbHelper.getWritableDatabase(); try{ Cursor c = db.rawQuery("SELECT field, question, choice1, choice2, answer FROM WineQuiz ORDER BY RANDOM() LIMIT 5", null); if(c.moveToFirst()); { while(c.moveToNext()){ fieldinfo = c.getString(c.getColumnIndex("field")); question = c.getString(c.getColumnIndex("question")); choice1 = c.getString(c.getColumnIndex("choice1")); choice2 = c.getString(c.getColumnIndex("choice2")); answer = c.getString(c.getColumnIndex("answer")); }; } }catch(Exception e){ System.out.println("");; }finally{ db.close(); } ImageView image3 = (ImageView) findViewById(R.id.imageChoice1); ImageView image4 = (ImageView) findViewById(R.id.imageChoice2); TextView textChoice1 = (TextView) findViewById(R.id.textChoice1); textChoice1.setText(choice1); TextView textChoice2 = (TextView) findViewById(R.id.textChoice2); textChoice2.setText(choice2); image3.setOnClickListener(this); image4.setOnClickListener(this); } public void onClick(View v){ switch(v.getId()){ case R.id.imageChoice1: if(answer.equals(choice1)){ Correct++; Toast.makeText(this, "Correct", Toast.LENGTH_SHORT ).show(); }else…
tagged with: java
tagged with: sqlite
accepted answer: http://stackoverflow.com/a/25593713
has title: Selecting rows from sqlite database sometimes shows a same row
type: Question
tagged with: slickquiz
answer count: 1
tagged with: database
has answer: http://stackoverflow.com/a/25593713
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39951006
has text: @J4v4 what should i do? I dont understand what you are saying to me. Every example i read use the getPart() method to get a file. After getting it, what should i do?
type: Comment
comment on: http://stackoverflow.com/q/25571343
type: QuestionComment
score: 0

http://stackoverflow.com/comment/77318576
comment on: http://stackoverflow.com/a/45080231
score: 0
type: Comment
has text: it's redundant in theory yes. But without the redundant declaration, it wasn't working on Weblogic 12C. Current answer still stands.
type: AnswerComment

http://stackoverflow.com/comment/40186710
has text: im not familar with AndroidStudio and setting the listener in the xml, but i guess AndroidStudio just offers you all possible functions, even those which are not accessible. You probably can only take those functions, which are in the activity, where you are inflating the xml
score: 0
comment on: http://stackoverflow.com/q/25708589
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40019739
comment on: http://stackoverflow.com/a/25616771
type: Comment
has text: Can you post the code? I can't tell the problem what it is without it. Since opening the browser doesn't throw any errors
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39996621
comment on: http://stackoverflow.com/a/25600494
has text: yes that directory is created to store save files and load them. When i changed the manifest apk package name i also renamed/refactored the hierarchy package with the equal name com.van.gba. So i don't think there should be a problem with that because the package name is not hardcoded anywhere else. Thanks for your help and time. I have been searching and trying to find a solution for like 8 hours now :P It's really strange and frustrating. the error accours on calling SDL_Android_Init with the message above. JNI warning : received null jclass..
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39941605
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25574261
score: 0
has text: You can pass the `Graphics2D` object around to other methods though.

http://stackoverflow.com/comment/40138513
type: AnswerComment
has text: Check my updated answer. I was confused by that composite-key but the one-Order-to-many-OrderLine association needs only a simple key (the Order.id).
comment on: http://stackoverflow.com/a/25674223
score: 0
type: Comment

http://stackoverflow.com/q/25696219
has comment: http://stackoverflow.com/comment/40164392
has answer: http://stackoverflow.com/a/25696262
has answer: http://stackoverflow.com/a/71947824
tagged with: println
has comment: http://stackoverflow.com/comment/40164261
has comment: http://stackoverflow.com/comment/40164374
answer count: 4
has answer: http://stackoverflow.com/a/71947844
accepted answer: http://stackoverflow.com/a/25696270
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25696270
tagged with: java
has comment: http://stackoverflow.com/comment/40164275
has body: I am trying to print out the numbers that user input but i got no idea (example: when user input 2 and 3, it should be show 2+3=5 instead of 5 alone ) also how to find the average of the number too. here is my code: public static void main(String[] args) { Scanner keyboard= new Scanner (System.in); System.out.print("Please enter your first number: "); int firstnumber= keyboard.nextInt(); System.out.print("Please enter the second number: "); int secondnumber= keyboard.nextInt(); int sum= firstnumber+secondnumber; System.out.println(sum); int minus= firstnumber-secondnumber; System.out.println(minus); int multiply= firstnumber*secondnumber; System.out.println(multiply); int divide= firstnumber/secondnumber; System.out.println(divide); int moddivide= firstnumber%secondnumber; System.out.println(moddivide); **int average= sum/2;** System.out.println(average); keyboard.close(); } } as you can see at (star)(star).....(star)(star) it shouldn't be /2 because it doesn't look like a professional at all...
has title: how to print out the user number input with the result instead of showing only result?
tagged with: user-input
type: Question
tagged with: java.util.scanner
possible better answer: http://stackoverflow.com/a/25696262

http://stackoverflow.com/comment/51072072
comment on: http://stackoverflow.com/a/25583493
type: AnswerComment
has text: When i use `@Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS)`, i getting the below error. `org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.reportBuilder': Scope 'session' 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: Can you suggest a solution to this problem?
score: 0
type: Comment

http://stackoverflow.com/a/25617531
score: 0
has comment: http://stackoverflow.com/comment/40021371
has body: I didn't really go into details, but this block looks weird: int[][] ge=children(v); for(int[] e:ge){ return 1+num(e); } System.out.print("this return should never execute"); return 0; You want to sum up all its children here, but you return too early. It should be something like this: int[][] ge=children(v); int totChild = 0; for(int[] e:ge){ totChild = totChild + num(e); } return totChild;
type: Answer
answers question: http://stackoverflow.com/q/25617389

http://stackoverflow.com/comment/39987995
has text: Consumption in heap space != serialized size, http://stackoverflow.com/questions/258120/what-is-the-memory-consumption-of-an-object-in-java
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25599655

http://stackoverflow.com/a/25787128
has comment: http://stackoverflow.com/comment/40336402
has body: It is possible to load data stored on all nodes but at the moment you'd have to do it manually. On each node: HCMapStore store = createMapDbStore(); HazelcastInstance hz = createHz( store ); // use store in MapStoreConfig as implementation IMap imap = hz.getMap("map"); Map diskMap = store.loadAll( store.loadAllKeys() ); // load all entries on disk imap.putAll( diskMap ); // put into distributed map But as mentioned in the mailing list MapStore is not really intended to be used this way. Also be aware that backups are not persisted to disk in this way. So if you restart your cluster and the disk on one node dies, those entries will be lost.
answers question: http://stackoverflow.com/q/25621860
score: 1
has comment: http://stackoverflow.com/comment/40332244
has comment: http://stackoverflow.com/comment/40333680
type: Answer
has comment: http://stackoverflow.com/comment/40331887
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/25632134
has comment: http://stackoverflow.com/comment/56816585
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/40053670
has comment: http://stackoverflow.com/comment/40076136
score: 13
has answer: http://stackoverflow.com/a/73721458
possible better answer: http://stackoverflow.com/a/73721458
has answer: http://stackoverflow.com/a/25652579
accepted answer: http://stackoverflow.com/a/25652579
favorite count: 0
type: Question
has title: "Some Kotlin libraries attached to this project have unsupported format.Please update the libraries or the plugin"
has body: I have installed the kotlin plugin into my android studio project.The code complies with out an issue. It also executes when I call it from a java class. It is giving me the warning "Some Kotlin libraries attached to this project have unsupported format.Please update the libraries or the plugin". The println() function is also not being recognized in the IDE. test.kt fun foo(){ println("ad") } public class iTar{ public fun printAll( vararg a: String ){ for(item in a)println(item) } } Build.Gradle buildscript { ext.kotlin_version = '0.8.679' repositories { mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { compileSdkVersion 20 buildToolsVersion "20.0.0" sourceSets { main.java.srcDirs += 'src/main/kotlin' } packagingOptions { exclude 'META-INF/LGPL2.1' exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' } defaultConfig { applicationId "xxxxx" minSdkVersion 14 targetSdkVersion 20 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'org.codehaus.jackson:jackson-mapper-lgpl:1.9.13' compile 'com.j256.ormlite:ormlite-android:4.48' compile 'org.mapsforge:svg-android:0.4.3' compile 'com.android.support:support-v4:20.+' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } repositories { mavenCentral() }
tagged with: kotlin
upvote count: 13
type: AnsweredQuestion
tagged with: android-studio
answer count: 2

xslt
tags question: http://stackoverflow.com/q/25668506
tags question: http://stackoverflow.com/q/25620207
tags question: http://stackoverflow.com/q/25581145
tags question: http://stackoverflow.com/q/25635748
tag name: xslt
tags question: http://stackoverflow.com/q/25629282
type: Tag
tags question: http://stackoverflow.com/q/25587048
tags question: http://stackoverflow.com/q/25564057
tags question: http://stackoverflow.com/q/25708992
tags question: http://stackoverflow.com/q/25698764

http://stackoverflow.com/comment/40395309
has text: Thanks @Pooja, but i want that it should check for alerts through whole process until driver is working
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25780779
type: AnswerComment

http://stackoverflow.com/comment/40190540
has text: @watery In my engine, all GameObjects have a Sprite, which contain a Frame[] field. Each Frame has a Hitbox field (potentially a Hitbox[] field later if I need multiple hitboxes per frame). Hitboxes contain methods for detecting if a point (x, y) is within the hitbox. This way, the implementation of collision detection is where it belongs (and additionally, where it can be overrided - say if I need a HitEllipse or a HitPolygon).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25710778

http://stackoverflow.com/comment/39930750
score: 0
has text: What is `position` and `lastCamera`? I bet you that the problem is that your algorithm for creating file names doesn't create unique names. Try using a random UUID instead.
comment on: http://stackoverflow.com/q/25568509
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/65178738
has text: http://stackoverflow.com/questions/29279859/intellij-14-1-is-too-slow-when-i-import-a-maven-project
type: Comment
comment on: http://stackoverflow.com/q/25700652
type: QuestionComment
score: 0

http://stackoverflow.com/a/25562079
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39935698
score: 2
accepted answer of: http://stackoverflow.com/q/25557538
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25557538
has body: You can find the element, using following xpath: driver.findElement(By.Xpath("//div[contains(@id, 'type-')][contains(@id, '-model')][@class='vehicle']"))
upvote count: 2

http://stackoverflow.com/q/25698764
linked to: http://stackoverflow.com/q/8412798
has answer: http://stackoverflow.com/a/25698765
tagged with: java
linked to: http://stackoverflow.com/q/7632422
linked to: http://stackoverflow.com/q/17471066
linked to: http://stackoverflow.com/q/10982740
tagged with: xsd
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
upvote count: 11
type: Question
accepted answer: http://stackoverflow.com/a/25698765
has body: Background Using JDK 6 to load XML files into DOM. The XML files must be validated against an XSD. The XSD file location differs depending on the running environment. Ensuring the XML can be validated against an XSD, regardless of directory structure, requires a catalog resolver. Once the XML is validated, it can then be transformed. My understanding is that a DocumentBuilderFactory can be used to configure such validation. This is achieved by using a DocumentBuilder with an XMLCatalogResolver to find the XSD file (and any included files) associated with an XML file. Questions about validating XML documents using a catalog-derived XSD, include: JAXP - debug XSD catalog look up Java XML Schema validator with custom resource resolver fails to resolve elements Can XMLCatalog be used for schema imports? How to load XMLCatalog from classpath resources (inside a jar), reliably? XMLSchema validation with Catalog.xml file for entity resolving Resolving type definitions from imported schema in XJC fails Find items that can be repeated in an xml schema using Java Java servlets: xml validation against xsd Most of these questions and answers reference a hard-coded XSD file path, or use SAX to perform the validation, or pertain to DTDs, or require JDOM dependencies, or have no transformation. Problem There is no canonical solution that describes how to employ an XML catalog for XSD validation using JAXP DOM, that is subsequently transformed via XSLT. There are a number of snippets, but no complete, standalone example that compiles and runs (under JDK 6). I posted an answer that seems to work, technically, but is overly verbose. Question What is the canonical way (using JDK 1.6 libraries) to validate and transform an XML document? Here is one possible algorithm: Create a catalog resolver. Create an XML parser. Associate the resolver with the parser. Parse an XML document containing an XSD reference. Terminate on validation errors. Transform the validated XML using an XSL template…
linked to: http://stackoverflow.com/q/22538071
has title: Validate XML using XSD, a Catalog Resolver, and JAXP DOM for XSLT
tagged with: validation
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/981382
score: 11
linked to: http://stackoverflow.com/q/18579837
linked to: http://stackoverflow.com/q/7364840
tagged with: xslt
type: AnsweredQuestion

http://stackoverflow.com/q/25670051
tagged with: android-fragments
tagged with: dialog
possible better answer: http://stackoverflow.com/a/25670126
tagged with: android
upvote count: 5
tagged with: java
accepted answer: http://stackoverflow.com/a/25670529
has answer: http://stackoverflow.com/a/25670126
has answer: http://stackoverflow.com/a/25670529
type: AnsweredQuestion
answer count: 2
has body: This is my codes that I commented what I need. I tries some codes but it seems not compatible with Fragment. public class main extends Fragment { ImageButton imagebutton; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.main, container, false); imagebutton = (ImageButton) rootView.findViewById(R.id.im); imagebutton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Open Yes/No Dialog //if Yes do something } }); } }
downvote count: 2
favorite count: 0
type: Question
score: 3
has title: How to create Yes/NO Alert Dialog in Fragment in Android

http://stackoverflow.com/comment/39963780
type: QuestionComment
comment on: http://stackoverflow.com/q/25585601
has text: Spring version? They're shading some of the bytecode manipulation now.
score: 0
type: Comment

http://stackoverflow.com/comment/39903343
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25552962
has text: try `http://localhost:8080/app/index.jsp` where there must be some index.jsp under the web-content folder

http://stackoverflow.com/comment/39942596
type: AnswerComment
type: Comment
has text: Thanks for the improvements, now it's a valid +1 answer in my book... still, I wasn't just picky - it's just that I did it exactly this way when I was a Java newbie (`repaint()`, EDT calling `paintComponent()`, which in turned generated/prepared and drawn the gfx, then wait/delay) - and it worked *terribly* - tearing, lags, absurdly low performance (10 FPS with a barely dozen of animated objects etc). That's exactly why I pointed out this is a so-so idea, even for beginners. Using a dedicated back buffer for drawing and just swapping the buffers is what Swing does behind the scenes anyway...
comment on: http://stackoverflow.com/a/25574468
score: 0

http://stackoverflow.com/q/25588201
downvote count: 0
favorite count: 0
type: Question
tagged with: datagram
tagged with: network-programming
upvote count: 2
accepted answer: http://stackoverflow.com/a/25588261
has answer: http://stackoverflow.com/a/25588261
type: AnsweredQuestion
score: 2
has body: I've read some conflicting things about how UDP/Java datagram channels operate. I need to know a few things: Does UDP have an inherit way to tell if the packet that is received whole, and in order, before .read(ByteBuffer b) is called? I've read in at least one article saying that UDP inherit'ly discards incomplete or out of order data. Does datagramchannel treat one send(buffer.. ) as one datagram packet? what if its a partial send? Can a .read(.. ) read more than one packet of data, resulting in data being discarded if the buffer being given as the commands argument was only designed to handle one packet of data?
has title: java datagramchannel data loss
tagged with: udp
tagged with: java
answer count: 1

http://stackoverflow.com/q/25610465
has comment: http://stackoverflow.com/comment/40007830
has answer: http://stackoverflow.com/a/25610845
upvote count: 2
tagged with: facebook
answer count: 1
has body: This question was asked a couple of times but, there is no clear answer for me. I am developing an app and I want to fetch check ins of user's friends. How do I do this with graph api or without it? Thanks for your answers :)
downvote count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: checkin
has title: Facebook: How to get friends' check ins with Graph Api?
tagged with: android
score: 1
tagged with: java
tagged with: facebook-graph-api
accepted answer: http://stackoverflow.com/a/25610845
type: Question

http://stackoverflow.com/q/25562123
type: Question
has body: I am new to ASM framework. I have been working around this ASM framework for a week. I saw tutorials in net regarding parsing a class and Generating a .class file from scratch. But am unable to follow how to modify a existing class in ASM. I am unable to follow the flow of execution between the ClassVisitor, ClassWriter and ClassReader. Kindly solve my issue by giving me a ASM example for the following code. public class ClassName { public void showOne() { System.out.println("Show One Method"); } public static void main(String[] args) { ClassName c = new ClassName(); c.showOne(); } } The above class should be modified as: public class ClassName { public void showOne() { System.out.println("Show One Method"); } public void showTwo() { // &lt;- Newly added method System.out.println("Show Two Method"); } public static void main(String[] args) { ClassName c = new ClassName(); c.showOne(); c.showTwo(); // &lt;- Newly inserted method call } } What should be the ASM code to modify it? I used the ASMifier tool to generate the code. But I don't know where to apply it.
tagged with: bytecode
downvote count: 0
has answer: http://stackoverflow.com/a/25568283
has comment: http://stackoverflow.com/comment/39921581
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25568283
has comment: http://stackoverflow.com/comment/39918458
tagged with: java
answer count: 1
tagged with: java-bytecode-asm
upvote count: 10
score: 10
has title: How to modify a Java bytecode using ASM 4.0
favorite count: 0

http://stackoverflow.com/q/25652659
tagged with: spring-boot
score: 0
tagged with: java
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25663951
type: UnansweredQuestion
has title: Integrating Resource Compressor like minify-maven-plugin into spring-boot-maven-plugin:run hot reloading
tagged with: spring
has body: I want to compress my css and js files into one single fat file for production deployment. solutions like minify-maven-plugin from com.samaxes.maven works fine. I do not want to change my code between production and develoment. Thats the reason why I want to use something like &lt;link href="/css/fat-styles-file.min.css" rel="stylesheet"/&gt; during develoment. I like the hot deployment form spring boot:run. If I run my app with spring-boot:run and change some css or js file, after a F5 refresh the results are there. With resource compression its a little bit difficult, because you need to compress before you can use it. Can I configure spring-boot:run in the way itcompresses every time again after refresh ing a website? Thanks.

http://stackoverflow.com/comment/40097622
has text: @BatScream no I am not able to view the index.jsp file.
score: 0
comment on: http://stackoverflow.com/q/25659719
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25667774
has title: Quartz Scheduler locks the database user
has comment: http://stackoverflow.com/comment/40270554
type: Question
type: UnansweredQuestion
tagged with: quartz-scheduler
has body: I am using quartz in combination with the database. When providing a wrong database password, the db user is then locked and I need then to unlock the user in the database. it seems that my program that uses quartz tries to login a few times in the background till the maximum attempts allowed by the database is reached which causes the locking. Does anyone knows how to avoid this? If the password is wrong, the program should then just report this and not try several times. My configuration: org.quartz.scheduler.skipUpdateCheck: true org.quartz.scheduler.instanceName = feed-scheduler org.quartz.threadPool.threadCount = 1 org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true org.quartz.threadPool.threadPriority = 5 org.quartz.jobStore.misfireThreshold = 60000 org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate org.quartz.jobStore.useProperties = false org.quartz.jobStore.tablePrefix = qrtz_ org.quartz.jobStore.isClustered = false org.quartz.jobStore.dataSource = myDS org.quartz.dataSource.myDS.driver = oracle.jdbc.driver.OracleDriver org.quartz.dataSource.myDS.URL = urlToDb org.quartz.dataSource.myDS.user = user org.quartz.dataSource.myDS.password = pwd org.quartz.dataSource.myDS.maxConnections = 1 org.quartz.dataSource.myDS.validationQuery=select 0 fro m dual
score: 0
has answer: http://stackoverflow.com/a/25784478
tagged with: java
answer count: 1

sha1
tags question: http://stackoverflow.com/q/25685342
tag name: sha1
type: Tag

http://stackoverflow.com/q/25578160
tagged with: this
has title: How would you characterize the term "this" in java?
answer count: 1
has comment: http://stackoverflow.com/comment/39949327
upvote count: 1
tagged with: variables
favorite count: 0
score: -1
type: Question
has comment: http://stackoverflow.com/comment/39949054
linked to: http://stackoverflow.com/q/13848176
downvote count: 2
has body: Simple question, I know what this does in Java but is this considered an instance variable belonging to the class?
has comment: http://stackoverflow.com/comment/39949042
accepted answer: http://stackoverflow.com/a/25578181
duplicate of: http://stackoverflow.com/q/13848176
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25578181
tagged with: instance
has comment: http://stackoverflow.com/comment/39949064
tagged with: java

http://stackoverflow.com/comment/40156555
type: AnswerComment
has text: This code comes from a production system and underwent extensive performance testing. Several variations were tested, and this one consistently yielded the best performance. Branching instructions tend to be expensive, while bit manipulation is cheap, so better to avoid conditionals.
comment on: http://stackoverflow.com/a/25691621
score: 0
type: Comment

http://stackoverflow.com/a/25604837
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25604692
upvote count: 2
downvote count: 0
has body: You are calling your method scoreCalc() without passing the parameters you defined. When you are calling it, it was defined as having 3 parameters. scoreCalc(7, 10, 3.0, 8.0); Also, when creating a class, start it with upper case, GradeCalc

http://stackoverflow.com/comment/40105304
score: 1
type: Comment
type: QuestionComment
has text: Send your codes, tell where to stuck.
comment on: http://stackoverflow.com/q/25664340

http://stackoverflow.com/comment/40109102
comment on: http://stackoverflow.com/a/25666275
score: 0
type: Comment
type: AnswerComment
has text: Thanks for your feedback. You've helped me to prove that the jar wasn't build with maven at least: no `META-INF/maven` folder inside it.

http://stackoverflow.com/q/25699417
has body: I have one bean class like this @XmlRootElement public class Node { String id; String value; // Composites, Node is having Node is having Node and so on ArrayList<Node> nodes = new ArrayList<Node>(); // and getter and setters for all these field. } I want to marshal this object using JAXB. By default it will create the element with name "node", or if we change the root annotation to something else(say @XmlRootElement(name="someotherName")), it create with that name. But I have thousands of Node object, and I want the generated element name should be as per "value" property of Object; e.g. Node node= new Node("myID", "myValue"); and after marshaling it, it should generate node like this myID Is it possible? I searched many places, but haven't found anything like this. Also I want the "id" property as attribute(@xmlAttribute) but conditionally, say if size of it's child nodes(ArrayList) is zero then I want this(id) property to be treated as attribute, otherwise not. Thanks -Dharmendra
answer count: 1
tagged with: jaxb
type: Question
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
has title: Generating node type at run time according to Object property in JAXB
score: 0
has answer: http://stackoverflow.com/a/25701459
tagged with: java

http://stackoverflow.com/a/25619511
has comment: http://stackoverflow.com/comment/40024677
answers question: http://stackoverflow.com/q/25619142
has body: You need to change it to following. $F{rate1} != null ? new DecimalFormat("##0.0000").format(new BigDecimal(""+$F{rate1})):"-" To explain, I have not checked in JasperReports and dont have a setup to test right away. But In C, zero is considered false, while a non zero value is considered true. Somewhere while the reports are being parsed and executed this might be happening, this might be the scenario happening. You better confirm with the community about this.
type: Answer
has comment: http://stackoverflow.com/comment/40024596
has comment: http://stackoverflow.com/comment/40030034
score: 0

http://stackoverflow.com/comment/40065245
has text: Passing a view works, passing the TextView I want to change works perfect, but what I want is to pass the activity so I can find the TextView in the GameConfiguration class and use the method in the 2 child class
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25642027
type: AnswerComment

http://stackoverflow.com/comment/40169263
type: AnswerComment
has text: While the first 3 lines are correct, the last line certainly is not, since the last number that is printed is 63, not 99. The loop alternates between incrementing `x` and multiplying `x` with 2.
comment on: http://stackoverflow.com/a/25697904
score: 0
type: Comment

http://stackoverflow.com/a/25645807
downvote count: 0
answers question: http://stackoverflow.com/q/25645550
upvote count: 1
has comment: http://stackoverflow.com/comment/40071799
accepted answer of: http://stackoverflow.com/q/25645550
has body: Change int plate[7][7] to int[][] plate or int plate[][]. Both are correct.
has comment: http://stackoverflow.com/comment/40072410
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/40072034
type: AcceptedAnswer

http://stackoverflow.com/q/25569236
score: 1
tagged with: java
answer count: 1
downvote count: 0
has body: I'm trying to consume the external web service, and I'm able to do it using soapUI with xml. And apparently I'm sending something else from my code, is there a way I can monitor all outgoing requests, inspect them and then forward them to the actual service? Update: The webservice is not on my machine, it sits somewhere on the internet. Update II: I downloaded wireshark, there are like milion things popping on my screen, I can't see what's what. Any better tools out there? I've used tcpMon before
upvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25569432
has comment: http://stackoverflow.com/comment/39931925
tagged with: soap
tagged with: web-services
has comment: http://stackoverflow.com/comment/39931868
has answer: http://stackoverflow.com/a/25569432
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39931801
has title: Debugging web service requests

http://stackoverflow.com/q/25557183
has answer: http://stackoverflow.com/a/25557241
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39909456
answer count: 2
score: 1
has body: I am an absolute beginner to Java. Recently i started to write a code in Java to sort the 5 elements of an array. The user will input the array elements. It complies the code and runs the program. but as soon as i finish inputting the array elemts, the program crashes! Here is my code: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int[] arr; arr = new int[5]; System.out.println("Enter the 5 elemnts in the array"); for(int i=0; i&lt;5; i++) arr[i] = in.nextInt(); int temp; for(int i=0; i&lt;5; i++) { temp = arr[i+1]; for(int j=i+1; j&gt;=0; j--) { if(arr[i] &gt; temp) { arr[j] = temp; arr[i] = arr[j]; } } } } } it throws an error which is something like: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at Main.main(Main.java:16) i just cannot read and understand the error!
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/25557241
type: Question
tagged with: exception
has comment: http://stackoverflow.com/comment/39909340
tagged with: java
has title: java.lang.ArrayIndexOutOfBoundsException while sorting an array
accepted answer: http://stackoverflow.com/a/25557232
has answer: http://stackoverflow.com/a/25557232
has comment: http://stackoverflow.com/comment/39909300

http://stackoverflow.com/q/25573332
has answer: http://stackoverflow.com/a/25576043
has comment: http://stackoverflow.com/comment/39939911
upvote count: 0
tagged with: save
has comment: http://stackoverflow.com/comment/39940087
has title: can't save my ArrayList on a Button's click
downvote count: 1
answer count: 1
favorite count: 0
tagged with: arraylist
type: Question
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39943273
tagged with: sharedpreferences
type: UnansweredQuestion
has body: this is a simple app who needs to get locations,add/remove them from an arraylist and save the list on a click button,using Sharedpreferences and not other storing methods. for some reason it just won't save anything. here's my code: package com.example.pearls1; import java.util.ArrayList; import android.app.ListActivity; import android.content.Context; import android.content.SharedPreferences; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.util.Log; import android.util.SparseBooleanArray; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends ListActivity { ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); ArrayAdapter&lt;String&gt; adapter; SharedPreferences sharedPreferences; public int ItemCounter = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LocationManager locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationListener locListener = new MyLocationListener(); locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locListener); Button buttonAdd = (Button) findViewById(R.id.buttonAdd); Button buttonDelete = (Button) findViewById(R.id.buttonDelete); Button buttonSave = (Button) findViewById(R.id.buttonSave); adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, list); // Opening the sharedPreferences object sharedPreferences = getSharedPreferences("SaveListItem", 0); SharedPreferences mypreferences = getSharedPreferences( "myPrefs", Context.MODE_PRIVATE); for (int Counter=0; Counter&lt; sharedPreferences.getInt("Count"…
score: -1

http://stackoverflow.com/comment/39969787
comment on: http://stackoverflow.com/q/25589521
has text: I would also log (print) the number of line where the exception raises to ease the search of the root of the possible problems. Now we understand that there's a line in your file that doesn't contain the desired number.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25679685
type: Answer
has body: Detailed explanation here Add the required jar files to your path OR May be the added jar files path mismatched. Configure project buildPath by RighClick on Project &gt; BuildPath &gt; Configure BuildPath
answers question: http://stackoverflow.com/q/25679639
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25679639
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40019401
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25616838
has text: Don't spend as this time and energy coming up with a long explanation; instead, show us your code!
score: 0

highcharts
tags question: http://stackoverflow.com/q/25666619
tags question: http://stackoverflow.com/q/25656710
tags question: http://stackoverflow.com/q/25572564
tags question: http://stackoverflow.com/q/25701426
type: Tag
tags question: http://stackoverflow.com/q/25686323
tags question: http://stackoverflow.com/q/25628800
tag name: highcharts

http://stackoverflow.com/q/25662657
downvote count: 0
favorite count: 0
type: Question
has title: Wrong Day Of Week from java time api
tagged with: time
type: UnansweredQuestion
tagged with: java
tagged with: datetime
has answer: http://stackoverflow.com/a/25663122
score: 2
has answer: http://stackoverflow.com/a/39008881
answer count: 2
has body: I am using java 8 time API to convert time in milliseconds to date and I am getting wrong day of week from that date. here is my code - long millis = 1406865600000L; LocalDate localDate = LocalDate.ofEpochDay(millis/1000); DayOfWeek dow = localDate.getDayOfWeek(); System.out.println(dow); it prints out THURSDAY, while this is date Friday 1 AUG. Please help.
upvote count: 2

http://stackoverflow.com/a/25595213
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39987088
has comment: http://stackoverflow.com/comment/39989650
answers question: http://stackoverflow.com/q/25595192
has comment: http://stackoverflow.com/comment/39990169
has body: You miss the httpclient.jar in your classpath. Download it and add it to your classpath.
type: Answer
score: 1

http://stackoverflow.com/comment/39973781
type: AnswerComment
comment on: http://stackoverflow.com/a/25588608
has text: can somebody please tell me how i can create my spinner in a base class and implement it in all my other activities?
type: Comment
score: 0

http://stackoverflow.com/comment/40121406
comment on: http://stackoverflow.com/a/25660121
score: 0
type: AnswerComment
has text: Adding \G at the beginning of the regex makes find() to fail.
type: Comment

executorservice
type: Tag
tags question: http://stackoverflow.com/q/25653702
tag name: executorservice
tags question: http://stackoverflow.com/q/25553551
tags question: http://stackoverflow.com/q/25587793

http://stackoverflow.com/comment/40152458
has text: @ControlAltDel I have to say - if that comment of yours is not the answer, then I don't understand the question.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25689383

http://stackoverflow.com/q/25593219
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39976291
has answer: http://stackoverflow.com/a/25593264
tagged with: random
has answer: http://stackoverflow.com/a/25593363
has body: I want to have a Map in the form: 0 -&gt; 1 2 -&gt; 0 1 -&gt; 2 Or 0 -&gt; 4 1 -&gt; 0 2 -&gt; 2 3 -&gt; 3 4 -&gt; 1 Every int is supposed to be mapped exactly to a distinct int in the range. I want to pass the function an int the size of the Map and get back a Map object. What's a good way to implement this functionality?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39976439
downvote count: 0
has comment: http://stackoverflow.com/comment/39976376
upvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25593270
has comment: http://stackoverflow.com/comment/39976368
has title: Create a Map in Java that takes maps ints randomly
has comment: http://stackoverflow.com/comment/39976431
has answer: http://stackoverflow.com/a/25593393
tagged with: dictionary
accepted answer: http://stackoverflow.com/a/25593270
answer count: 4
possible better answer: http://stackoverflow.com/a/25593264

http://stackoverflow.com/a/25562619
has comment: http://stackoverflow.com/comment/39921341
answers question: http://stackoverflow.com/q/25561307
has comment: http://stackoverflow.com/comment/39921044
has comment: http://stackoverflow.com/comment/39919493
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39920774
has body: Line is an Activity you haven't declare it inside manifest. Thats why you get ActivityNotFoundException. Edit : <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sample.activity" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
has comment: http://stackoverflow.com/comment/39921374
has comment: http://stackoverflow.com/comment/39920705
has comment: http://stackoverflow.com/comment/39920037
score: 0
has comment: http://stackoverflow.com/comment/39919456
type: Answer
accepted answer of: http://stackoverflow.com/q/25561307

http://stackoverflow.com/comment/40080183
score: 0
type: Comment
type: QuestionComment
has text: I've looked into constraint composition and this is much more suitable, thanks for the pointer.
comment on: http://stackoverflow.com/q/25593796

http://stackoverflow.com/comment/40157375
comment on: http://stackoverflow.com/q/25692520
type: Comment
type: QuestionComment
score: 0
has text: @ripudam I saw the edit, and i used the edited code. it works perfectly now. thank you!

http://stackoverflow.com/a/25626956
has comment: http://stackoverflow.com/comment/40069170
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40072545
downvote count: 0
has comment: http://stackoverflow.com/comment/40081432
has comment: http://stackoverflow.com/comment/40070822
accepted answer of: http://stackoverflow.com/q/25610245
upvote count: 5
has body: Edit your project.properties file and add the line: manifestmerger.enabled=true See full instructions here: http://altbeacon.github.io/android-beacon-library/configure.html The problem has nothing to do with the beacon type you are trying to recognize. Without the manifest merging enabled, you AndroidManifest.xml file doesn't have the service definition inherited from the library to start up the BeaconService, so no beacons of any kind are ever detected. Using Eclipse, you can tell if manifest merging is working properly by doing a build, then looking at your generated manifest in bin/AndroidManifest.xml. This manifest should include the entries below. If all else fails, you may copy these entries into your project manifest manually: <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <action android:name="android.intent.action.BOOT_COMPLETED"/> <action android:name="android.intent.action.ACTION_POWER_CONNECTED"/> <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
type: Answer
has comment: http://stackoverflow.com/comment/40080461
answers question: http://stackoverflow.com/q/25610245

http://stackoverflow.com/comment/40126705
has text: if i try this on one computer, so convert into byte array (with fileinputstream) and write to a copy file (with fileoutputstream) it works. But is this system independet actually?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25675715

http://stackoverflow.com/q/25598077
type: Question
has title: Where "classpath*" is declared in Spring MVC Project?
has answer: http://stackoverflow.com/a/25598208
tagged with: spring
possible better answer: http://stackoverflow.com/a/25598208
type: AnsweredQuestion
has body: I am reallty curious about this. Where is this "classpath*" declaration? Follow is normaly descripted in web.xml. action org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath*:egovframework/springmvc/context-*.xml 1 I thought this framwork read web.xml first. However how can it knows this keyword "classpath*:" ? Thanks for your anwer in advance:D
answer count: 2
upvote count: 2
score: 2
accepted answer: http://stackoverflow.com/a/25598095
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25598095
tagged with: keyword
tagged with: classpath
favorite count: 0

http://stackoverflow.com/comment/40028589
score: 0
comment on: http://stackoverflow.com/a/25619651
has text: @Alexy In example: "The Object class 'Elements' provides more than one ways. In this case ..." and so far.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25591657
answers question: http://stackoverflow.com/q/25591476
upvote count: 5
downvote count: 0
type: Answer
has body: c.addActionListener(actionlistener1); c.addActionListener(actionlistener2); It is useful if you need to do several actions that are not necessarily correlated. For example, changing the background color of a button vs appending the action in a Logger vs informing the controller that the button have been pressed, etc... This allows to be modular: each actionListener can handle a very specific task for a group of components. For example, you can write a default actionListener for all your buttons, and a specific one for a group of buttons that have the same behaviour. Finally, some objects already have listeners when you instantiate them (JButton have a default FocusListener, JScrollPane a default MouseWheelListener, etc). This allow you to add other behaviours to your components, without overriding previous ones.
score: 5

http://stackoverflow.com/comment/40001690
score: 0
has text: I would first explore if it was possible to this in shaders or have the variant buffers ready in memory first :)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25593545

http://stackoverflow.com/comment/40003286
comment on: http://stackoverflow.com/q/25606833
score: 0
type: QuestionComment
has text: "Parsing an integer from the front is awkward if you don't know the length of it": quite to the contrary! Start with an accumulator set to 0, then for each next digit multiply the accumulator by 10 and add the value of that digit. At a non-digit stash away the value of the accumulator and reset it to 0. (But your question stipulates there is only one integer per line.)
type: Comment

http://stackoverflow.com/comment/40173009
comment on: http://stackoverflow.com/a/25701302
type: Comment
score: 0
type: AnswerComment
has text: Well, I need the outer class to perform an action based on the values found in T. Specifically, the outer class needs to construct a hibernate criteria object which has restrictions which depend on the type of t

http://stackoverflow.com/comment/62836826
has text: It might be a bit too late, but let me use my crystal ball... hm... yes... I see. You're calling `post(yourRunnable)` from `doInBackground()`. This in fact executes operation on the main thread.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25571156

http://stackoverflow.com/q/25642720
has comment: http://stackoverflow.com/comment/40065995
has comment: http://stackoverflow.com/comment/40067231
has comment: http://stackoverflow.com/comment/40066250
has body: Can someone explain me how to refactor the below code. Basically i have a timer functionality which i am using repeatedly. So i want to put that timer into a generic function. import java.util.Timer; import java.util.TimerTask; public class App { private volatile boolean a = false; private volatile boolean b = false; private volatile boolean c = false; public static void main(String[] args) { App app = new App(); app.m1(); } private void m1() { // m2() should not take more than specified time in timer Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { if(a){ System.out.println("m1 Do nothing"); } else{ System.out.println("m1 Timeout exception"); } } }, 2*60*1000); a=m2(); System.out.println("Blah"); } private boolean m2() { // Killing some time with sleep try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } //m3() should not take more than specified time in timer Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { if(b){ System.out.println("m2 Do nothing"); } else{ System.out.println("m2 Timeout exception"); } } }, 1*60*1000); b = m3(); System.out.println("Blah Blah"); return true; } private boolean m3() { //m4() should not take more than specified time in timer Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { if(c){ System.out.println("m3 Do nothing"); } else{ System.out.println("m3 Timeout exception"); } } }, 20000); c=m4(); System.out.println("Blah Blah Blah"); return true; } private boolean m4() { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } return true; } } Thank you for your help. I am not looking for code help. Want to know your thoughts on minimizing the code.
tagged with: java
has comment: http://stackoverflow.com/comment/40066352
has title: Refactoring Java code
has comment: http://stackoverflow.com/comment/40066683
has comment: http://stackoverflow.com/comment/40066175
has comment: http://stackoverflow.com/comment/40066191
answer count: 0
downvote count: 0
upvote count: 1
type: UnansweredQuestion
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/39955696
has text: "*according to java specification `e--` should be evaluated before `++e`*" => do you have a reference? Expressions are generally evaluated left to right...
score: 5
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25581905

http://stackoverflow.com/a/25679670
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40135076
has body: You seem to be switching things around. You are opening a file outputstream to \home\user1\input\TejasSDH_PM_AU_09_07_2014_09_00.csv and you seem to be on windows so it won't work. You have the local path where the ftp path should go and the other way around. Please read your errors more carefully, I'm willing to bet that line 255 in FTPDataExtract.java is: fos = new FileOutputStream(downloadFile); Which should alert you to the fact that it's not actually an ftp problem.
accepted answer of: http://stackoverflow.com/q/25678147
type: Answer
answers question: http://stackoverflow.com/q/25678147
score: 0

http://stackoverflow.com/comment/39992699
comment on: http://stackoverflow.com/q/25602188
has text: What makes you think that `URLEncoder.encode(value, "iso 9809-1")` is system dependent?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25652000
answer count: 1
accepted answer: http://stackoverflow.com/a/25652702
downvote count: 1
favorite count: 0
type: Question
upvote count: 2
tagged with: streaming
tagged with: apache-camel
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25652702
has body: According to the Camel Stream docs, it is possible to route message to/from various data streams. However, in my case, I want the data (byte[]) in a ByteArrayInputStream to get sent off to a Camel route. The problem is that the only InputStream that component seems to support is FileInputStream like so: from("stream:file?fileName=/server/logs/server.log&amp;scanStream=true&amp;scanStreamDelay=1000").to("bean:logService?method=parseLogLine"); But it looks like the only way to specify a ByteArrayInputStream is to use the stream:header URI like so: ByteArrayInputStream byteStream = new ByteArrayInputStream(someData); from("direct:a").setHeader("stream", constant(byteStream)).to("stream:header"); But if you have to specify the custom stream as a header, I don't see how you could accomplish such a thing inside the from() clause. Any ideas how to do this?
has title: Camel routing from a ByteArrayInputStream
score: 1
tagged with: java
tagged with: bytearrayinputstream

http://stackoverflow.com/a/25624404
answers question: http://stackoverflow.com/q/25623875
has body: You can start separate threads from tomcat as needed. It does not matter what frontend you have for this. But what's important is to access the vaadin UI components the correct way when you wish to update them from another thread. For vaadin 7 this has been greatly enhanced, to allow server push out of the box. In vaadin 6 you had to use some work arrounds for this. https://vaadin.com/book/-/page/advanced.push.html#advanced.push.running We use this concept a lot for export and report generation. - Use click on Export/Report - On the server we start a (low priority) thread which builds the report/export - During this, we update a progressbar on the client via server push - Once the thread has generated the export/report we send it to the webbrowser If you wish to have a core running always and accepting "jobs" then perhaps you are better served with a job sheduler like quartz or similar.
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/40057609
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25634147
has text: Anyways. The text you quoted is also present in the reference guide for java 1.7 and confirms my suspicions and therefore answers my question. I remembered reading it somewhere, but couldn't find it.

http://stackoverflow.com/comment/40169703
comment on: http://stackoverflow.com/a/25699248
has text: And just changing `[a-zA-Z]` to `\w` doesn't mean your regex wasn't borrowed from mine below.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/25654292
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/40090495
has title: Hybrid application not showing scroll bar
tagged with: scrollbar
type: Question
tagged with: ibm-mobilefirst
has comment: http://stackoverflow.com/comment/40114687
has answer: http://stackoverflow.com/a/25678497
downvote count: 0
upvote count: 1
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/40119130
tagged with: java
answer count: 1
has body: My WL6.1.0.1 hybrid application have an overflow (with css set to -webkit-overflow-scrolling: touch) which scrolls just fine, but I don't see the scroll bar, neither the android feedback when I hit the bottom of the scroll (that glowing light that android have). Curiously enough if I access the same application via "Common Resources" using the chrome browser on my android device, both the scroll bar and the feedback shows up. I added the following code to my main java class on the native side (the one that extends WLDroidGap and have the app name) public void onWLInitCompleted(Bundle savedInstanceState){ super.loadUrl(getWebMainFilePath()); // Add custom initialization code after this line this.appView.setVerticalScrollBarEnabled(true); this.appView.setVerticalScrollbarOverlay(true); } But it still doesn't work, any ideas?

http://stackoverflow.com/q/25571553
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25571682
has body: There is an application that I'm basically writing with Swing, JDBC and MySQL. In DB there are tables like Article, Company, Order, Transaction, Client etc. So also there are java classes which describes them. User can create, update, delete information about them. I give an example of my problem. The article characterizes with id, name, price, company, unit. And when user wants to save new article he chooses the company for this article from the list of all companies. This list in perspective could be really big. Now I could think of two ways to solve this. When application starts, it connects to the DB and load all the data with which then I will work. public final class AllInformationController { public static final Collection&lt;Company&gt; COMPANIES= new HashSet&lt;&gt;(1_000_000); public static final Collection&lt;Article&gt; ARTICLES= new HashSet&lt;&gt;(1_000_000); public static final Collection&lt;Order&gt; ORDERS= new HashSet&lt;&gt;(1_000_000); public static final Collection&lt;Transaction&gt; transactionsHistory= new HashSet&lt;&gt;(10_000_000); //etc... private AllInformationController() {} } Then if user wants for example to change some Company data (like address or telephone etc.), after doing it the program should update the DB info for that company. The second approach is basically to connect to the database every time user queries or changes some information. So then I will mostly work with ResultSet's. I prefer the second way, but just not sure if it's the best one. Think there should be more productive ways to work with data that could be less expensive.
has title: How properly work with big data using Swing - performance tips
answer count: 2
score: 1
has answer: http://stackoverflow.com/a/25571682
tagged with: java
has comment: http://stackoverflow.com/comment/39936743
possible better answer: http://stackoverflow.com/a/25572183
downvote count: 0
tagged with: mysql
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/25572183
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39952487

http://stackoverflow.com/comment/40126070
score: 0
has text: good for you! Don't forget to accept your answer if it solves the problem ;)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25675471

http://stackoverflow.com/comment/39976019
comment on: http://stackoverflow.com/q/25593074
has text: possible duplicate of [Converting int to char in java](http://stackoverflow.com/questions/833709/converting-int-to-char-in-java)
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/40026840
comment on: http://stackoverflow.com/a/25620848
score: 0
type: AnswerComment
has text: No need to create an array if you have 3 different buttons... I said the click must be on the same button. Anyway yes, this is the array approach.
type: Comment

http://stackoverflow.com/q/25564627
answer count: 1
tagged with: string
type: Question
has answer: http://stackoverflow.com/a/25564702
accepted answer: http://stackoverflow.com/a/25564702
has body: I am creating a shadow of createTriangle() in the method createPathingTriangle(). createTriangle worked just fine, but when I created the identically-dimensioned createPathingTriangle that used String instead of int, the new triangle started throwing NPE's. The line that's throwing it is- pathingTriangle[y][x] = new String("00" + String.valueOf(x)); i.e. the first line that populates it. I looked it up and have liberally sprinkled "new" around the code in createPathingTriangle, but it didn't seem to solve the problem.. I am assuming that it has something to do with the fact that int is a primitive but String is not, but hours of fiddling and nothing gives. private int[][] createTriangle() { triangle = new int[triangleSize][]; for (int y = 0; y &lt; triangle.length; y++){ int [] xAxis = new int[triangle.length - y]; for (int x = 0; x &lt; xAxis.length; x++){ xAxis[x] = (int) (Math.random() * 100); } triangle[y] = xAxis; } printTriangle(triangle); return triangle; } private String[][] createPathingTriangle() { pathingTriangle = new String[triangleSize][]; for (int y = 0; y &lt; pathingTriangle.length; y++){ for (int x = 0; x &lt; pathingTriangle.length - y; x++){ if (x &lt; 10){ pathingTriangle[y][x] = new String("00" + String.valueOf(x)); } else if (x &lt; 100){ pathingTriangle[y][x] = new String("0" + String.valueOf(x)); } else{ pathingTriangle[y][x] = new String(String.valueOf(x)); } } } return pathingTriangle; }
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/39922942
has comment: http://stackoverflow.com/comment/39922971
has comment: http://stackoverflow.com/comment/39922961
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39922935
has title: Null Pointer Exception in an Array of Strings
tagged with: java

http://stackoverflow.com/q/25684169
has answer: http://stackoverflow.com/a/25684520
has answer: http://stackoverflow.com/a/25684202
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/42857791
possible better answer: http://stackoverflow.com/a/25684202
has comment: http://stackoverflow.com/comment/40141105
has comment: http://stackoverflow.com/comment/40141008
has body: Hi I have a situation where I have to store a single key value pair to my Hashmap . The map size is always constant. i.e., 1 . But default size of hash map is 16 bits . Here am almost wasting nearly 15 bits. Is there any way to limit the size of the hashmap. Thanks in Advance for your valuable suggestions .
linked to: http://stackoverflow.com/q/381244
type: AnsweredQuestion
score: 0
answer count: 2
has title: Java hashmap default size
upvote count: 2
has comment: http://stackoverflow.com/comment/40143334
tagged with: java
accepted answer: http://stackoverflow.com/a/25684520
downvote count: 2

http://stackoverflow.com/a/25555677
downvote count: 0
has body: The JVM would handle the interface just like you want, there will be only one SystemServices created. But the approach you describe is indeed considered 'ugly'. The best way I think would be to use a dependency injection framework like Spring. It is very good at just what you need- having global objects that other classes can access. It also makes testing much easier, and also enables you to quickly change what global objects should be used.
type: Answer
answers question: http://stackoverflow.com/q/25555540
score: 1
upvote count: 1

http://stackoverflow.com/q/25633121
tagged with: struts2
has body: How do I inject the implementation class of a action in struts.xml from struts2.xml? Suppose struts.xml looks like the following: viewengines.jsp Then I wanted to achieve: when struts2.xml exists(or is not blank), then the class-mappings in struts2.xml overrides those in struts.xml. So if I have the following definition, at runtime EnginesList is mapped to example.EnginesListAction2 instead of example.EnginesListAction. // struts.xml: viewengines.jsp <include file="struts2.xml" /> // struts2.xml viewengines.jsp This seems not working due to name conflict. So what's the best way of achieving my end goal? Background added: Team-A develops and maintains struts.xml. My team(team-B) uses the codebase of team-A and deploys it in a separate data center. Team-B needs to have some actions be mapped to different classes. However we cannot directly modify it in struts.xml since it will change the behavior of Team-A's service. So what I wanted is to have a separate file(struts2.xml) whose class-mappings can override those in struts.xml. No changes in action package name. No changes in JSP code. This struts2.xml will be deployed ONLY in team-B's data center.
has comment: http://stackoverflow.com/comment/40061114
score: 3
has comment: http://stackoverflow.com/comment/40080733
upvote count: 3
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40080571
has comment: http://stackoverflow.com/comment/40080229
has title: How to re-map Action implementation class in struts.xml?
has comment: http://stackoverflow.com/comment/40073979
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40077531
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25634081

http://stackoverflow.com/q/25706741
tagged with: java
has answer: http://stackoverflow.com/a/25706776
has title: Parallel Arrays and reading from a file
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40183702
has comment: http://stackoverflow.com/comment/40183726
type: UnansweredQuestion
has body: I need help making a parallel array I need to read in from a textfile of strings and create a array of strings that adds each name once and increments repeated strings in an array of ints..... any ideas of how i can fix this code to do that? Scanner sc=new Scanner(new File("Cat.txt")); String category=sc.nextLine(); int total=sc.nextInt(); int[]totcat=new int[total]; String[]names=new String[total]; while(sc.hasNextLine()) { String x=sc.nextLine(); boolean b=false; int size=0; for(int i=0;i&lt;names.length;i++) { if(x.equals(names[i])) { b=true; totcat[i]++; } } if(!b) { names[size]=x; totcat[p]++; size; } }
has comment: http://stackoverflow.com/comment/40183583
has comment: http://stackoverflow.com/comment/40200007
has answer: http://stackoverflow.com/a/25706979

http://stackoverflow.com/comment/40188562
has text: Forgive the code indentation since i am on mobile device.
comment on: http://stackoverflow.com/a/25709767
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40101315
type: AnswerComment
comment on: http://stackoverflow.com/a/25661144
type: Comment
score: 0
has text: Thanks, I was looking in all the wrong places apparently.

http://stackoverflow.com/comment/40009324
type: AnswerComment
has text: oo.. not "now jar file appeared.." NO jar file appeared.. thats the point :D
score: 0
comment on: http://stackoverflow.com/a/25572311
type: Comment

http://stackoverflow.com/a/25648241
answers question: http://stackoverflow.com/q/25641964
has body: As zeroflagL stated in their comment, JSP resources are (by default) served by the Servlet container's JSP Servlet which performs the compilation and rendering. The Servlet container maps this JSP Servlet to *.jsp. If you override that mapping with your mvcDispatcher, you are losing all that functionality and making the DispatcherServlet handles the corresponding requests. But your DispatcherServlet does not know how to handle these. Get rid of those *.jsp mappings.
type: Answer
has comment: http://stackoverflow.com/comment/40082572
has comment: http://stackoverflow.com/comment/40082688
score: 0

http://stackoverflow.com/q/25643000
has comment: http://stackoverflow.com/comment/40067620
has comment: http://stackoverflow.com/comment/40068067
answer count: 2
tagged with: sql
has answer: http://stackoverflow.com/a/25643363
tagged with: jpa
downvote count: 0
upvote count: 1
has title: Best way to check duplicate records in database | Hibernate
has answer: http://stackoverflow.com/a/25643562
has body: I need to create gift card entity in DB where gift card codes are being generated by an algorithm and chances of their collision are quite low. Still before inserting gift card entities in DB , we need to check the possibilities of duplicate gift card entities. Also need to take care following points Need to generate same number of gift card entities as required by admin In order for point 1 to follow, we need to find which gift card code already exists in DB and need to generate code again. I am using Hibernate for DB operations and I have following options. First option Create list of gift card codes start creating entity for each gift card code and try to insert them in DB. If we found any exception for pre existing gift card entity, store that code in discarded code list. Again repeat process for discarded list Second Option Generate list of gift card codes. Check for duplicate codes in DB before creating gift card entities. For discarded list , again create gift card code and follow point 2. For final list create entities and insert in to DB I am a little confused about which approach should be preferable ?
tagged with: jpa-2.0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40067421
has comment: http://stackoverflow.com/comment/40067014
has comment: http://stackoverflow.com/comment/40068421
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/25659100
has title: How to changeJTable as editable and not in different selection?
upvote count: 1
favorite count: 0
type: Question
has body: i just enter some details in JTable. and store those details in my database with specific id. But if i retrieve those details in my JTable based on id, on that time the JTable should not allow edit operation in it. it just for view purpose. How can i set whether Jtable is editable or not based on user selection. (Insert, Search)
tagged with: swing
has answer: http://stackoverflow.com/a/25659169
possible better answer: http://stackoverflow.com/a/25659169
type: AnsweredQuestion
tagged with: jtable
answer count: 2
has answer: http://stackoverflow.com/a/25659174
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25659174
downvote count: 0

http://stackoverflow.com/q/25696524
answer count: 5
has comment: http://stackoverflow.com/comment/40164954
tagged with: java
has comment: http://stackoverflow.com/comment/40164941
has body: I have to process 450 unique strings about 500 million times. Each string has unique integer identifier. There are two options for me to use. I can append the identifier with the string and on arrival of the string I can split the string to get the identifier and use it. I can store the 450 strings in HashMap&lt;String, Integer&gt; and on arrival of the string, I can query HashMap to get the identifier. Can someone suggest which option will be more efficient in terms of processing?
has comment: http://stackoverflow.com/comment/40183390
has comment: http://stackoverflow.com/comment/40165370
type: Question
has title: Performance of HashMap
has comment: http://stackoverflow.com/comment/40164869
has answer: http://stackoverflow.com/a/25696697
has answer: http://stackoverflow.com/a/25696771
has answer: http://stackoverflow.com/a/25696773
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40183364
downvote count: 0
upvote count: 1
score: 1
has answer: http://stackoverflow.com/a/25696843
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/25696552
has comment: http://stackoverflow.com/comment/40164866
tagged with: hashmap

http://stackoverflow.com/a/25710534
has comment: http://stackoverflow.com/comment/40190959
score: 1
has comment: http://stackoverflow.com/comment/40197791
has comment: http://stackoverflow.com/comment/40190997
has comment: http://stackoverflow.com/comment/40191029
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40190632
type: Answer
has body: Okay finally i got trough it and so I'm answering my own question. Ntsh's idea of using ScriptEngine (see question's comments) was nice and worked nice in java, but since it's not part of android by default, I had to import the jar. Even that the code compiles, it just doesn't seem to work on some devices (i got it working only in my 4.2 Genymotion VM). So I searched for another approach and decided to use webview to run javascrip. This seems to be a bad solution, but it works: First I made a php file on server, that takes js file, adds some html and javascript code around it, to make it valid html and to make json out of this js array and prints it. On android I just open this url in hidden webview and once page is loaded, I take it's source and extract relevant data, to parse it from json to java. This post was very helpful for that. However, this approach has some disadvantages: it cannot be run in background (using backgound services and broadcast recievers for example), since webview is a gui element it has a security whole, because ANY js file that gets loaded into webview can call the function (now called only when page is loaded) at ANY time. This is how it can inject some other text and so on... So if anyone has a better solution please let me know.
answers question: http://stackoverflow.com/q/25704694

http://stackoverflow.com/q/25555315
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25555342
accepted answer: http://stackoverflow.com/a/25555342
has comment: http://stackoverflow.com/comment/39905470
tagged with: regex
has title: java equivalent for regex to replace all characters up to a specific character in a string
score: 0
tagged with: java
has body: I am trying to find the java equivalent of doing the following string manipulation (vb.net): linkUrl = Regex.Replace(linkUrl, ".*url=", "") Basically strip all characters up to and including the one provided. Also are there any known examples anyone can provide for similar regular expressions used in java.
answer count: 1
tagged with: string

http://stackoverflow.com/a/25708690
has body: Your method has correct logic implemented!I am unsure why are you printing the array values if the user-entered element doesn't match array element...There is no need! Also,to print NOT FOUND,you need to have a variable set for that purpose,say flag variable of type boolean in my code! Also,what you're missing is end-braces to close the loop,main() and the class. We always have a corresponding closing brace for each respective opening brace! try this :- import java.util.Scanner; /** * @author Waseem */ public class Sear { public static void main(String[] args) { int index[] = {12, 13, 14, 15, 16}; boolean flag = false; Scanner a = new Scanner(System.in); System.out.println("enter the number"); int b = a.nextInt(); for (int i : index) { if (flag = b == i) { break; } else { System.out.println(i); // No need for this,but,even then this is fine! } } // to close for-loop if (flag) { System.out.println("Number Found"); } else { System.out.println("Number not Found!!!"); } } // to close main() method } /// to close class Sear
has comment: http://stackoverflow.com/comment/40186880
type: Answer
answers question: http://stackoverflow.com/q/25708613
upvote count: 2
score: 1
downvote count: 1

http://stackoverflow.com/a/25704581
upvote count: 2
has comment: http://stackoverflow.com/comment/40200208
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25704291
has comment: http://stackoverflow.com/comment/40183446
has body: First off all you need to declare a field in a class to track current saying(quotes). Integer current; also you have to move following statement from onClick and declare it as a field in a class. Integer resId = 0; Then modify your onCreate method to have code shown below @Override protected void onCreate(Bundle savedInstanceState) { //After buttons being declared current = 0; btnBack.setEnabled(false); btnNext.setEnabled(true); String randomSaying = (sayings[current]); sayingsTextView.setText('"' + randomSaying + '"'); resId = sayingsResIds.get(randomSaying); sayingsTextView.startAnimation(anim); //Rest of your code } Now you can modify your onClick code as follows @Override public void onClick(View v) { //your code switch (v.getId()) { case R.id.random_button: current = new Random().nextInt(sayings.length); String randomSaying = (sayings[current]); sayingsTextView.setText('"' + randomSaying + '"'); resId = sayingsResIds.get(randomSaying); sayingsTextView.startAnimation(anim); if(current == 0){ btnBack.setEnabled(false); btnNext.setEnabled(true); } else if(current == sayings.length - 1){ btnBack.setEnabled(true); btnNext.setEnabled(false); } else { btnBack.setEnabled(true); btnNext.setEnabled(true); } break; case R.id.next_button: // Click Next to find next saying in the array if(current == 0){ btnBack.setEnabled(true); } current++; String randomSaying = (sayings[current]); sayingsTextView.setText('"' + randomSaying + '"'); resId = sayingsResIds.get(randomSaying); sayingsTextView.startAnimation(anim); if(current == sayings.length - 1){ btnNext.setEnabled(false); } break; case R.id.back_button: // Click Next to find next saying in the array if(current == sayings.length - 1){ btnNext.setEnabled(true); } current--; String randomSaying = (sayings[current]); sayingsTextView.setText('"' + randomSaying + '"'); resId = sayingsResIds.get(randomSaying); sayingsTextView.startAnimation(anim); if(current == 0){ btnBack.setEnabled(false); } break; } // your code } Let me know if…
accepted answer of: http://stackoverflow.com/q/25704291
type: Answer
has comment: http://stackoverflow.com/comment/40180622
score: 2
has comment: http://stackoverflow.com/comment/40197234

http://stackoverflow.com/q/25676365
downvote count: 0
upvote count: 1
has body: I'm trying to run the kafka producer example as described on the kafka docs (found here). However, when I try to run the producer I get a class not found exception: Exception in thread "main" java.lang.NoClassDefFoundError: kafka/producer/ProducerConfig at com.t4g.app.RandomProducer.main(TestProducer.java:20) Caused by: java.lang.ClassNotFoundException: kafka.producer.ProducerConfig Here is my dependency file: org.apache.kafka kafka_2.9.2 0.8.1.1 compile jmxri com.sun.jmx jms javax.jms jmxtools com.sun.jdmk
has answer: http://stackoverflow.com/a/66511694
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25682625
tagged with: apache-kafka
has title: kafka producer example - class not found exception
answer count: 2
type: UnansweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/40195487
has text: So where should I declare model?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25712830

http://stackoverflow.com/comment/39984840
type: Comment
type: QuestionComment
has text: `PrintWriter` is buffered, but default it does not flush automatically. You could use [`PrintWriter(OutputStream, boolean)`](http://docs.oracle.com/javase/7/docs/api/java/io/PrintWriter.html#PrintWriter(java.io.OutputStream,%20boolean)) to setup auto flushing or call `flush` manually.
comment on: http://stackoverflow.com/q/25597839
score: 1

http://stackoverflow.com/a/25643596
has comment: http://stackoverflow.com/comment/40115517
score: 3
type: Answer
answers question: http://stackoverflow.com/q/25620303
has body: I ended up overriding OpenSessionInViewFilter with custom implementation: 1: web.xml: openSessionInViewFilter com.mycompany.AutoFlushOpenSessionInViewFilter openSessionInViewFilter /* org.springframework.web.context.ContextLoaderListener ContextLoaderListener is required for Spring to work. AutoFlushOpenSessionInViewFilter is applied to intercept requests from the /* url pattern 2: AutoFlushOpenSessionInViewFilter: import org.hibernate.FlushMode; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.dao.DataAccessResourceFailureException; import org.springframework.orm.hibernate4.support.OpenSessionInViewFilter; public class AutoFlushOpenSessionInViewFilter extends OpenSessionInViewFilter { protected Session openSession(SessionFactory sessionFactory) throws DataAccessResourceFailureException { try { Session session = sessionFactory.openSession(); session.setFlushMode(FlushMode.AUTO); // This line changes the default behavior return session; } catch (HibernateException ex) { throw new DataAccessResourceFailureException("Could not open Hibernate Session", ex); } } } OpenSessionInViewFilter is the default way to intercept hibernate sessions (http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.html) The openSession method opens a hibernate session. Hibernate would use this session instead of creating a new one hibernate3.support.OpenSessionInViewFilter allows you to provide a FlushMode, hibernate4.support.OpenSessionInViewFilter hard codes the value, so I override it with my own implementation Make sure your sessionFactory bean name is sessionFactory. Otherwise you need to set the sessionFactoryBeanName as a filter init-param in web.xml 3: All the Spring beans need to be registered within the Web application context (web.xml): contextConfigLocation classpath:appContext.xml ... 4: Make sure you get your spring beans only fr…
upvote count: 3
has comment: http://stackoverflow.com/comment/40068088
downvote count: 0

http://stackoverflow.com/a/25557756
has body: If you want to remove the textbox of the editable then you simply use this attribute to style the editbox android:background="@android:color/transparent" If you want to edit a textview you can use the following attribute android:editable="true" In actual code a TextView and an EditText is actually the same. An Edit text is simply a textView with things added on.
has comment: http://stackoverflow.com/comment/39913215
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25557499
accepted answer of: http://stackoverflow.com/q/25557499
score: 1

http://stackoverflow.com/a/25622217
has body: Using unlimited number of threads is a terrible idea indeed, You can use ThreadPoolExecutor and a BlockingQueue instead. ThreadPoolExecutor has a constructor that takes a BlockingQueue. Since you mentioned refactoring, try to remove mutability from the code that is gonna be used by threads. Try to make all your types madly immutable, if this is not possible hide mutability. This will give thread safety for free
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25621814
type: Answer

http://stackoverflow.com/q/25654463
has comment: http://stackoverflow.com/comment/40096901
answer count: 4
has comment: http://stackoverflow.com/comment/40096798
linked to: http://stackoverflow.com/q/21940642
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40096579
has answer: http://stackoverflow.com/a/25656585
has title: Join tables in Hibernate
has answer: http://stackoverflow.com/a/25720959
has body: I have two tables in my PostgreSQL database: CREATE TABLE tableOne (id int, name varchar(10), address varchar(20)) CREATE TABLE tableTwo (id int, info text, addresses varchar(20)[]) now I want to create a join as follows: SELECT * FROM tableOne JOIN tableTwo ON address = ANY(addresses) I tried to achieve this using Hibernate - class TableOne: @Entity @Table(name = "tableOne") class TableOne { private int id; private TableTwo tableTwo; private String address; @Id @Column(name = "id") public getId() { return id; } @ManyToOne @JoinFormula(value = "address = any(tableTwo.addresses)", referencedColumnName = "addresses") public TableTwo getTableTwo(){ return tableTwo; } // Setters follow here } But Hibernate keeps generating queries with non-sense JOIN clauses, like: ... JOIN tableTwo ON _this.address = any(tableTwo.addresses) = tableTwo.addresses How do I tell Hibernate using annotations to format my join query correctly? Unfortunately, our project must be restricted only to the Criteria API. EDIT: After suggestion from ashokhein in the comments below, I annotated the method getTableTwo() with just @ManyToOne - and now I would like to do the join using Criteria API, presumably with createAlias(associationPath,alias,joinType,withClause) method where withClause would be my ON clause in the join. But Im not sure what to put as associationPath and alias parameters. Any hints?
tagged with: postgresql
has answer: http://stackoverflow.com/a/25842170
accepted answer: http://stackoverflow.com/a/25853544
has comment: http://stackoverflow.com/comment/40394388
tagged with: join
score: 2
type: AnsweredQuestion
tagged with: sql
has answer: http://stackoverflow.com/a/25853544
tagged with: java
possible better answer: http://stackoverflow.com/a/25720959
tagged with: hibernate
downvote count: 0
has comment: http://stackoverflow.com/comment/40427742
has comment: http://stackoverflow.com/comment/40096751
has comment: http://stackoverflow.com/comment/40096771
favorite count: 0

http://stackoverflow.com/q/25637739
tagged with: jaxb
tagged with: marshalling
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25640847
upvote count: 2
type: UnansweredQuestion
has body: Lets suppose that we have XML consnensual with Schema and Java class with some common fields: &lt;objectFromSchema1&gt; &lt;element1/&gt; &lt;commonElement1/&gt; &lt;commonElement2/&gt; &lt;element2/&gt; &lt;/objectFromSchema1&gt; public class X { private String element1; private String commonElement1; private String commonElement2; private String element2; } Is a nice way to unmarschall such kind of XML to Java object ? It means: convert all consensual fields and set null on rest.
has comment: http://stackoverflow.com/comment/40057522
answer count: 2
tagged with: schema
score: 2
tagged with: java
has title: Two different schemas and JAXB Marshaller
downvote count: 0
has answer: http://stackoverflow.com/a/25637821

http://stackoverflow.com/comment/40101007
comment on: http://stackoverflow.com/q/25661449
type: Comment
has text: Did you look at the link I posted?
type: QuestionComment
score: 1

http://stackoverflow.com/comment/40113945
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25668934
has text: Have you noticed that my rep is less than 50 and I can't comment?
score: 0

http://stackoverflow.com/q/25693106
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/xml
tagged with: android-studio
type: AnsweredQuestion
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/24863616
accepted answer: http://stackoverflow.com/a/25693394
tagged with: navigation-drawer
type: Question
has answer: http://stackoverflow.com/a/25693394
has title: ImageView not appearing below ListView in Navigation Drawer
has body: I have a 400 x 206 image that I'm trying to show below my menu in my navigation drawer, but it isn't showing when I open the navigation drawer. Oddly enough in the AS design preview it looks like the image is getting converted into a line. I also now find my open drawer has an extra strip of transparent space on the far right roughly half an inch wide. I'm thinking the two are related, but my current priority is figuring out how to get the image to show below the menu items. Android Studio design preview of activity_main.xml. The top blue outline that goes all the way to the right is left_drawer, the object that's in it that doesn't go quite as to the right is left_drawer_listview, and the line below is drawer_buttom_image: And for the record I've looked at Background image and image view in Navigation Drawer which is much more complex, so I might have made a mistake in simplifying the solution for my needs. activity_main.xml: &lt;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"&gt; &lt;!-- As the main content view, the view below consumes the entire space available using match_parent in both dimensions. --&gt; &lt;FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;!-- android:layout_gravity="start" tells DrawerLayout to treat this as a sliding drawer on the left side for left-to-right languages and on the right side for right-to-left languages. The drawer is given a fixed width in dp and extends the full height of the container. --&gt; &lt;LinearLayout android:id="@+id/left_drawer" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="start" android:orientation="vertical"&gt; &lt;ListView android:id="@+id/left_drawer_listview" android:layout_width="240dp" android:layout_height="match_parent" andro…

http://stackoverflow.com/q/25699073
downvote count: 0
accepted answer: http://stackoverflow.com/a/25699099
has answer: http://stackoverflow.com/a/25699307
tagged with: arraylist
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25699099
has body: I have an input like this in an ArrayList&lt;String&gt;: cat eats mouse mouse eats cheese cheese is tasty (blank lines should be ignored since I will be reading this input from a file) and I want to convert it into a 2-d array of String which will have dimensions [no. of elements in ArrayList][3]. The no. 3 is fixed i.e. each sentence will have 3 words. like this: "cat" "eats" "mouse" "mouse" "eats" "cheese" "cheese" "is" "tasty" here's what I have tried: public static int processData(ArrayList&lt;String&gt; array) { String str[]=new String[array.size()]; array.toArray(str); String str1[][]=new String[str.length][5]; for(int i=0;i&lt;str.length;i++) { str1[i][]=str.split("\\s+"); //i want to do something like this, but this is showing errors. } return 0; //this is temporary, I will be modifying it } Tell me if I am not clear.
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/25699201
has title: how to split an arraylist of String whenever a space is encountered in java?
has answer: http://stackoverflow.com/a/25699188
answer count: 4
favorite count: 0
type: Question
tagged with: split
score: 5
possible better answer: http://stackoverflow.com/a/25699188

http://stackoverflow.com/comment/39916748
has text: Updated my question. I did as you said and now the buttons are responsive. However, I added a textview to see what I read from the file but it doesn't show anything. When I click the button, the textview updates from the default text to nothing. Did I do something wrong?
score: 0
comment on: http://stackoverflow.com/a/25560938
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25601238
downvote count: 0
answers question: http://stackoverflow.com/q/25601034
upvote count: 1
score: 1
has body: Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S). In the left-hand pane of the dialog, select Modules. In the pane to the right, select the module of interest. In the right-hand part of the dialog, on the Module page, select the Dependencies tab. On the Dependencies tab, click add and select Jars or directories. In the dialog that opens, select the necessary files and folders. These may be individual .class, .java, .jar and .zip files, and the directories containing such files. Click OK. If necessary, select the Export option and change the dependency scope. 8.Click OK in the Project Structure dialog. Source
type: Answer

http://stackoverflow.com/comment/112000584
score: 0
type: Comment
has text: Adding `-Djava.rmi.server.hostname=<ip-address>` to the Java process resolved the issue.
type: AnswerComment
comment on: http://stackoverflow.com/a/54741822

http://stackoverflow.com/a/25646969
upvote count: 1
downvote count: 1
score: 0
has body: Here is a code that draws V. Look at it, you will understand why it works.... void drowV(int hight){ int rowLen = (hight-1)*2; for(int i=0; i&lt;hight; i++){ int start = i; int end = rowLen-i; for(int j=0;j&lt;=rowLen; j++){ if(j==end){ System.out.println("*"); break; } else if(j==start){ System.out.print("*"); } else{ System.out.print(" "); } } } }
answers question: http://stackoverflow.com/q/25645337
type: Answer

http://stackoverflow.com/a/25701271
type: Answer
has body: I like @Jean Logeart's approach, but I would use a for loop instead: int[] values = new int[6]; for (int i = 0; i &lt; values.length &amp;&amp; scanner.hasNextInt(); ++i) { values[i] = scanner.nextInt(); } For the sake of completeness, you can then assign the array values to your a, b, c variables to keep the rest of the code working: int a = values[0]; int b = values[1]; int c = values[2]; int d = values[3]; int e = values[4]; int f = values[5]; Note that this will work even if the scanner found less than 6 values, because array values are initialized to 0. Finally a tip: to test the implementation, you can create a Scanner from a string, for example: Scanner scanner = new Scanner("3 4 5 6 7 8 9 10 11");
score: 0
answers question: http://stackoverflow.com/q/25701232

http://stackoverflow.com/comment/40102455
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25662046
type: QuestionComment
has text: First of all, there's no reason why you would not be able to use the same SQL through the DAO as you do directly. Secondly - you seem to already be using Hibernate (in the form of your `em`) and certainly JDBC. Thirdly - without JDBC you'll need to write your own network communication system for the DB, so you best either find out what technology you DO use for DBs, or go grab a MySQL low-level protocol specification sheet

http://stackoverflow.com/a/25710240
accepted answer of: http://stackoverflow.com/q/25710097
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25710097
score: 2
has body: Let's examine the code: int size = connection.getContentLength() + 1024; byte[] bytes = new byte[size]; why do you add 1024 bytes to the size? What's the point? The buffer size should be something large enough to avoid too many reads, but small enough to avoid consuming too much memory. Set it at 4096, for example. InputStream input = new ByteArrayInputStream(bytes); FileOutputStream out = new FileOutputStream(file); input = connection.getInputStream(); Why do you create a ByteArrayInputStream, and then forget about it completely? You don't need a ByteArrayInputStream, since you don't read from a byte array, but from the connection's input stream. int data = input.read(bytes); This reads bytes from the input. The max number of bytes read is the length of the byte array. The actual number of bytes read is returned and stored in data. while (data != -1) { out.write(bytes); data = input.read(bytes); } So you have read data bytes, but you don't write only the first data bytes of the array. You write the whole array of bytes. That is wrong. Suppose your array if of size 4096 and data is 400, instead of writing the 400 bytes that have been read, you write the 400 bytes + the remaining 3696 bytes of the array, which could be 0, or could have values coming from a previous read. It should be out.write(bytes, 0, data); Finally: out.close(); input.close(); If any exception occurs before, those two streams will never be closed. Do that a few times, and your whold OS won't have file descriptos available anymore. Use the try-with-resources statement to be sure your streams are closed, no matter what happens.
type: Answer

http://stackoverflow.com/comment/39906615
type: Comment
score: 0
type: AnswerComment
has text: Same problem. I *think* it might be trying to run the jstl when the page loads. I want it to run after I post form info, run the query based on the info (in the jsp), and return the xml string. I thought wrapping the jstl in a javascript function then using jquery to call the function after posting the form data would work, but no dice.
comment on: http://stackoverflow.com/a/25554517

oauth-2.0
type: Tag
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/25710797
tags question: http://stackoverflow.com/q/25667245
tags question: http://stackoverflow.com/q/25642847
tags question: http://stackoverflow.com/q/25627275

http://stackoverflow.com/comment/40072238
type: Comment
comment on: http://stackoverflow.com/a/25635534
has text: I've updated the code in the original post to show the entire class.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40130160
score: 6
type: Comment
has text: .................no.
type: QuestionComment
comment on: http://stackoverflow.com/q/25677950

printing
tags question: http://stackoverflow.com/q/25651451
tags question: http://stackoverflow.com/q/25687113
tags question: http://stackoverflow.com/q/25587675
tags question: http://stackoverflow.com/q/25578549
tags question: http://stackoverflow.com/q/25653748
type: Tag
tag name: printing
tags question: http://stackoverflow.com/q/25578660

http://stackoverflow.com/comment/40085899
score: 0
has text: Thanks a lot but I still don't get how RestFB will be able to communicate with the browser to get an authorization token to publish (it also needs to get the user's facebook id from the browser)?
type: Comment
comment on: http://stackoverflow.com/a/25653108
type: AnswerComment

http://stackoverflow.com/comment/40018640
has text: how to show the log from the device?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25615499
score: 0

http://stackoverflow.com/q/25663348
type: Question
has body: after going through some links for spring security I got to know about how it works. Still I am confused about which username and password I should give in spring-security.xml, because I'm working with the JSON. All my data is stored on the server. If i am logging in the page,it will check in the server whether that data exists, and if does,then it should proceed.how can i do this with spring security and authentication..?any help for this..? this is my spring-security.xml &lt;http use-expressions="true"&gt; &lt;intercept-url pattern="/signin*" access="isAnonymous()" /&gt; &lt;intercept-url pattern="/**" access="isAuthenticated()"/&gt; &lt;form-login login-page='/signin' default-target-url="/home" authentication-failure-url="/signin?error=true" login-processing-url="/security/j_spring_security_check" /&gt; &lt;logout logout-success-url="/signin" /&gt; &lt;/http&gt; and may be i have to add some ref in the authentication manager so that it will check the username and password which are present in the remote server.. &lt;authentication-manager alias="authenticationManager"&gt; &lt;authentication-provider user-service-ref="user" /&gt; &lt;/authentication-manager&gt; if some links are there or some info..then please help me for this
tagged with: spring
tagged with: spring-security
has answer: http://stackoverflow.com/a/25663738
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
has title: spring security where data is stored on server
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
accepted answer: http://stackoverflow.com/a/25663738

http://stackoverflow.com/q/25560241
has body: I'm trying to read data from a JSON file with the following code: FileReader reader = new FileReader(file); JSONParser jsonParser = new JSONParser(); JSONObject jsonObject = (JSONObject) jsonParser.parse(reader); JSONArray dataName = (JSONArray)jsonObject.get("results"); Iterator it = dataName.iterator(); while (it.hasNext()) { JSONObject out = (JSONObject) it.next(); System.out.printf("Game name: " + out.get("name") + " in plataforms:"); JSONArray data_plat = (JSONArray) out.get("platforms"); if (!data_plat.isEmpty()) { Iterator it2 = data_plat.iterator(); while (it2.hasNext()) { System.out.printf("I AM HERE"); JSONObject out_plat = (JSONObject) it2.next(); System.out.printf("\n- " + out_plat.get("name")); } } } And this code is throwing a NullPointerException in this piece: if (!dataPlat.isEmpty()); I've analyzed my output and the JSON file and this happens because the part i'm reading contains a null value. How can I avoid this? EDIT: Here's a part of my JSON: { "name":"FIFA Manager 08", "platforms":[ { "api_detail_url":"http:\/\/www.giantbomb.com\/api\/platform\/3045-94\/", "id":94, "name":"PC", "site_detail_url":"http:\/\/www.giantbomb.com\/pc\/3045-94\/", "abbreviation":"PC" } ], "resource_type":"game" }, { "name":"FIFA Online 2", "platforms":null, "resource_type":"game" }, The error is occurring at the bottom in "platforms":null
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39914956
has comment: http://stackoverflow.com/comment/39915388
tagged with: arrays
has title: Iterator throwing NullPointerException inside JSONArray null value
score: 0
has comment: http://stackoverflow.com/comment/39915103
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39914954
has comment: http://stackoverflow.com/comment/39915148
has comment: http://stackoverflow.com/comment/39915721
type: Question

http://stackoverflow.com/comment/39975527
score: 0
has text: @AJMansfield, I am sorry. I am a high school student, not an expert programmer. I do not understand all of this. All I want is help with the issue stated above.
type: QuestionComment
comment on: http://stackoverflow.com/q/25592312
type: Comment

http://stackoverflow.com/q/25579762
has comment: http://stackoverflow.com/comment/39952883
score: 0
tagged with: java
has body: public int count(Vertex T, int start, int end, int count) { if (T == null) { return -1; } count(T.left,start,end,count); int test=T.key; if(test &gt;=start &amp;&amp; testKey&lt;end){ count++; } System.out.print(T.key+"#"+count+"# "); count(T.right,start,end,count); return count; } I am trying to get a count of numbers in a self-written, balancing search tree that is greater than or equal to my Start number and less than my End number. So far my balancing search tree is correct, the only issue I have now is to correctly return the count. I have checked with the code above that it is counting correctly for numbers that matches my range however the issue I am having now is that I am unable to return the count I needed as it will return to 0 because of the nature of the recursive function call. It would be helpful if I could get suggestions to return the desired count.
answer count: 1
type: Question
tagged with: recursion
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25579795
has title: Recursion Getting count of numbers that reside in AVL Tree

machine-learning
type: Tag
tags question: http://stackoverflow.com/q/25707546
tags question: http://stackoverflow.com/q/25581445
tag name: machine-learning

http://stackoverflow.com/q/25596471
tagged with: scala
linked to: http://stackoverflow.com/q/15137360
has answer: http://stackoverflow.com/a/25597190
accepted answer: http://stackoverflow.com/a/25597231
has comment: http://stackoverflow.com/comment/39982543
has body: I ran into some performance discrepancy between, almost identical, implementations of Scala and Java versions. I am seeing Java version that is 68% faster than Scala version. Any idea as to why this happens? Java version: public class Util { public static Set &lt; String &gt; toBigramsJava(String s1) { Set &lt;String&gt; nx = new HashSet &lt;String&gt; (); for (int i = 0; i &lt; s1.length() - 1; i++) { char x1 = s1.charAt(i); char x2 = s1.charAt(i + 1); String tmp = "" + x1 + x2; nx.add(tmp); } return nx; } } Scala version: object Util { def toBigramsScala(str: String): scala.collection.mutable.Set[String] = { val hash: scala.collection.mutable.Set[String] = scala.collection.mutable.HashSet[String]() for (i &lt;-0 to str.length - 2) { val x1 = str.charAt(i) val x2 = str.charAt(i + 1) val tmp = "" + x1 + x2 hash.add(tmp) } return hash } } Test Results: scala&gt; Util.time(for(i&lt;-1 to 1000000) {Util.toBigramsScala("test test abc de")}) 17:00:05.034 [info] Something took: 1985ms Util.time(for(i&lt;-1 to 1000000) {Util.toBigramsJava("test test abc de")}) 17:01:51.597 [info] Something took: 623ms System: I ran this on Ubuntu 14.04, with 4 cores and 8Gig RAM. Java version 1.7.0_45, Scala version 2.10.2. There is some more info on my blog.
has comment: http://stackoverflow.com/comment/39982350
has answer: http://stackoverflow.com/a/25597231
answer count: 4
has comment: http://stackoverflow.com/comment/39983144
has comment: http://stackoverflow.com/comment/39982502
type: AnsweredQuestion
score: 12
tagged with: performance
has title: Scala vs Java performance (HashSet and bigram generation)
tagged with: java
has comment: http://stackoverflow.com/comment/39982215
has comment: http://stackoverflow.com/comment/39982897
downvote count: 0
has comment: http://stackoverflow.com/comment/39982262
has comment: http://stackoverflow.com/comment/39983208
favorite count: 0
possible better answer: http://stackoverflow.com/a/25597342
type: Question
has answer: http://stackoverflow.com/a/26812021
has answer: http://stackoverflow.com/a/25597342
upvote count: 12

http://stackoverflow.com/comment/40021990
has text: Yes I got it solved. I took new session and transaction before every query and closed both after executing of each query.
comment on: http://stackoverflow.com/q/25617578
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25664444
has body: I have a problem with MP2 audio files and JAVA. Audio seems to be a pain in JAVA anyway. I tried using JavaLayer and Xuggler to decode and transcode the MP2 file to WAV. Both of which failed. And development of those seems to be not active. Although many are still using these. JMF or FMJ I haven't tried yet. I was wishing for more native approach. I ended up forking JavaLayer to my project. And with a small code change I managed to seemingly get it to read all the frames from the MP2. But trying to convert it to WAV resulted in a file playable only in VLC and well, it was recognizable but distorted. Anyway, a broad question, I apologize. I guess I'm asking that is there any JAVA + JavaLayer + MP2 gurus out there who can help me? Original MP2: https://dl.dropboxusercontent.com/u/90134918/horng014.mp2 Failed WAV conversion: https://dl.dropboxusercontent.com/u/90134918/horng014_fail.wav I have a public GitHub account for this project, but I haven't posted this broken code there yet.
tagged with: mpeg-2
has answer: http://stackoverflow.com/a/29865687
answer count: 3
has answer: http://stackoverflow.com/a/27685849
accepted answer: http://stackoverflow.com/a/29865687
type: Question
tagged with: audio
type: AnsweredQuestion
has title: JAVA MP2 playback (native)
score: 0
possible better answer: http://stackoverflow.com/a/25671457
tagged with: java
has answer: http://stackoverflow.com/a/25671457

http://stackoverflow.com/a/25676411
score: 3
type: Answer
answers question: http://stackoverflow.com/q/25675832
upvote count: 3
downvote count: 0
has body: Thanks for your answers. I am going to go with a NavigableMap as the floorKey function is exactly what I need.

http://stackoverflow.com/comment/39960400
has text: Did you consider placing a timer to allow you to read new labels?? (followed by refreshing the frame)
score: 0
comment on: http://stackoverflow.com/q/25584562
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40172723
type: AnswerComment
has text: Please explain how this improves matters? It does not avoid the use of a `Map<String,AuthorPublication>`. Basically, the `Map.Entry<String,Set<String>>` is what you propose, so what?
score: 0
comment on: http://stackoverflow.com/a/25701159
type: Comment

http://stackoverflow.com/q/25562443
tagged with: initialization
has title: java class initialize order, how it works?
has answer: http://stackoverflow.com/a/25562525
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25562523
linked to: http://stackoverflow.com/q/24927401
has comment: http://stackoverflow.com/comment/39919017
has body: package ali; public class test { public static int n = 99; public static test t1 = new test("t1"); public static test t2 = new test("t2"); public static int i = 0; public static int j = i; { System.out.println("construct block"); } static { System.out.println("static construct block"); } public test(String str){ System.out.println((++j) + ":" + " i="+ i + " n="+n+str); n++;i++; } public static void main(String [] args){ test test1 = new test("initl"); } } after running: construct block 1: i=0 n=99t1 construct block 2: i=1 n=100t2 static construct block construct block 1: i=0 n=101initl Who can tell me how it works? why there is no "static construct block" when t1 and t2 ware created? why i and j changed to the default ,but n still unchanged?
possible better answer: http://stackoverflow.com/a/25562525
accepted answer: http://stackoverflow.com/a/25562523
tagged with: class
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/39930231
score: 1
type: Comment
type: QuestionComment
has text: I have tried with String[] = new String[] items = new String[]{"bla", "bla", "bla"}; It's working. I want to convert ArrayList<HashMap<String, String>> items; to String[] items;
comment on: http://stackoverflow.com/q/25568492

http://stackoverflow.com/comment/40021096
comment on: http://stackoverflow.com/a/25617618
type: AnswerComment
has text: Yes - That's exactly what I said?
type: Comment
score: 0

http://stackoverflow.com/q/25632733
downvote count: 6
type: Question
has comment: http://stackoverflow.com/comment/40049016
linked to: http://stackoverflow.com/q/18834552
accepted answer: http://stackoverflow.com/a/25633223
has comment: http://stackoverflow.com/comment/40048959
has comment: http://stackoverflow.com/comment/40049053
has comment: http://stackoverflow.com/comment/40049105
answer count: 2
has comment: http://stackoverflow.com/comment/40049514
has comment: http://stackoverflow.com/comment/40048992
upvote count: 2
has title: Why does math.sqrt return a float to one decimal point and not just the value wo the decimal point?
has answer: http://stackoverflow.com/a/25632939
score: -4
has comment: http://stackoverflow.com/comment/40049611
has body: I'm not sure if this question has been answered(couldn't find it when I did a google search). I saw http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html that the math class square root method returns a double. I experimented with it in eclipse with some ints that have whole square roots - 4, 9 and found that the square root with those always returned a floating point value with one decimal - 4.0, 9.0. I was curious as to why it even returned that extra decimal? I thought that ints could be considered as double values too. To me returning just 1 makes more sense cause you conserve more memory(i guess more memory is needed to store that extra decimal point) I even tested it out public static double control(){ return 1; } and saw it was valid to just return 1.
has comment: http://stackoverflow.com/comment/40048983
has comment: http://stackoverflow.com/comment/40049134
favorite count: 0
has comment: http://stackoverflow.com/comment/40049300
has comment: http://stackoverflow.com/comment/40049042
has comment: http://stackoverflow.com/comment/40049228
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40049132
possible better answer: http://stackoverflow.com/a/25632939
has answer: http://stackoverflow.com/a/25633223
tagged with: double
tagged with: square-root
tagged with: java
has comment: http://stackoverflow.com/comment/40049370

http://stackoverflow.com/comment/40128453
score: 0
comment on: http://stackoverflow.com/a/25666214
type: Comment
type: AnswerComment
has text: Oh hold on, I think I get it. The function will take anything that is itself or a supertype of itself. It will take a `Goal`, for example, but it will also take a `PlanItem`. It then turns it into the `DEST` object, or a sublass of `DEST`, before adding it to the `List<DEST>`. Am I right?

http://stackoverflow.com/a/25661344
downvote count: 0
type: Answer
has body: I would go for option 1: passing the ExamType in the constructor of Result. The reason is mainly testability: with Result only depending on objects explicitly passed to it, it's easy to test its functionality in isolation. The other possible reason is serialization: if you just want to serialize a Result object, having it as an inner class of Exam will force Exam to be serialized with it. More often than not this isn't what you want. Whether Result is a top-level class or a static nested class is up to you, that decision is a matter of readability. If your Result class is relatively simple and Exam isn't very complicated either, use a static nested class, otherwise use a separate top-level class.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40100780
answers question: http://stackoverflow.com/q/25661230
has comment: http://stackoverflow.com/comment/40103520

http://stackoverflow.com/comment/40097998
score: 0
has text: can u tell me how can i show my all file bcz i m new user in stackoverflow
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25659811

http://stackoverflow.com/a/25626787
upvote count: 1
has body: The problem was the Company Proxy, so I've appended: System.setProperty("https.proxySet", "true"); System.setProperty("https.proxyHost", this.getConfiguracionProxy().getUrlProxy()); System.setProperty("https.proxyPort", this.getConfiguracionProxy().getPuertoProxy()); To: System.setProperty("http.proxySet", "true"); System.setProperty("http.proxyHost", this.getConfiguracionProxy().getUrlProxy()); System.setProperty("http.proxyPort", this.getConfiguracionProxy().getPuertoProxy()); I've found the solution looking at Wireshark. When I was getting the file on SoapUI or on a web browser, the IP was other than the IP used by our application (the true IP). Then I realized that I was behind a proxy. I've never used Wireshark... I've learned a lot, which is a good thing. This sets as a System property the stored proxy configuration. Thanks everybody.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25620622
downvote count: 0

http://stackoverflow.com/a/25601606
has comment: http://stackoverflow.com/comment/39992111
downvote count: 0
has comment: http://stackoverflow.com/comment/39991718
upvote count: 7
answers question: http://stackoverflow.com/q/25601312
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39992231
has body: Thomas' answer is right in that Object's default toString() method will be called which produces different Strings for different objects. One thing to note here. Object.toString() returns: return getClass().getName() + "@" + Integer.toHexString(hashCode()); It includes Object.hashCode(). The Javadoc of hashCode() states: ...the hashCode method defined by class Object does return distinct integers for distinct objects... The key is that hashCode() will be different for distinct objects. Since your code does not store the created Runnables, once the Threads are done, they will be garbage collected. Once an object is removed from memory, another Object may take its place in memory and it is possible that a new Runnable will provide the same hashcode that was returned by a previous Runnable which is now ceased to exist. So theoretically it is possible that you will see the same String printed indeterministically (although the chances are very slim).
has comment: http://stackoverflow.com/comment/39992703
accepted answer of: http://stackoverflow.com/q/25601312
score: 7
type: Answer
has comment: http://stackoverflow.com/comment/39991603

http://stackoverflow.com/a/25624860
accepted answer of: http://stackoverflow.com/q/25623460
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40034087
answers question: http://stackoverflow.com/q/25623460
type: Answer
has body: Scrapbook Page(.jpage) doesn't reside inside your package and it only evaluates expressions The imports must be done using Set the Import Declarations for the Running Code button next to Terminate button menu ->Add Packages->Select your Package Person p = new Person(); p Select all 2 lines and Inspect to see the result in expression view
has comment: http://stackoverflow.com/comment/40034259
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/comment/40066765
score: 0
comment on: http://stackoverflow.com/a/25640505
has text: Yes,I had search for that.But,It shows the above specified jar file only.But,it doesn't contain ActionFactory class.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25666930
type: Answer
score: 0
has body: See how to create timestamp Java Timestamp - How can I create a Timestamp with the date 23/09/2007? And you can simply do this clone.add(timestamp.toString() + event.getMessage());
answers question: http://stackoverflow.com/q/25666394

http://stackoverflow.com/a/25705969
has comment: http://stackoverflow.com/comment/40181797
upvote count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/40182021
score: 1
answers question: http://stackoverflow.com/q/25705950
has comment: http://stackoverflow.com/comment/40181705
has comment: http://stackoverflow.com/comment/40181786
type: Answer
has body: Java compiler doesn't know handleException() always throws the exception anyway. It just thinks you handle the exception, and not rethrow it. Java compiler doesn't follow the code that deep. However, you're doing it wrong. You should never silence your exceptions. Please do it this way: public String method_A() throws Exception { try { // do something here return "result"; } catch(Exception e) { handleException(e); throw e; } } private void handleException(Exception e) { log.error("", e); } Or just this unless you use handleException in other places: public String method_A() throws Exception { try { // do something here return "result"; } catch(Exception e) { log.error("", e); throw e; } }

http://stackoverflow.com/comment/40196269
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25709024
has text: if you remove the jsp, it does not change the situation, the errors are the same. struts speaks what cannot load configuration. but if you remove type="json", it starts without errors and even displays a page with an empty grid.

http://stackoverflow.com/comment/39993592
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25601540
type: QuestionComment
has text: I have created the coloumns of the table but i am not able to add the data into it using content provider and label so please help me to do.The code to create the coloumn header is as follows in the qustion above

http://stackoverflow.com/comment/39993312
comment on: http://stackoverflow.com/q/25601812
type: Comment
has text: Barely. Do you want to convert it to `short[]` instead? If it is, then maybe [this question](http://stackoverflow.com/questions/5625573/byte-array-to-short-array-and-back-again-in-java) could help. But take note that `String` doesn't have constructor with `short[]` parameter.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40068417
type: QuestionComment
has text: please add all the constructors that you have in your `ApplicationDetails` class to your question.
comment on: http://stackoverflow.com/q/25643456
score: 0
type: Comment

http://stackoverflow.com/comment/39931181
type: Comment
score: 0
type: AnswerComment
has text: And consider this: If somebody wants that String so badly that he is reverse engineering your APK, then he is going to find it, no level of obfuscation is going to stop him. The biggest defence against reverse engineering is the effort it takes and the expertise needed to do it.
comment on: http://stackoverflow.com/a/25567865

android-fragments
tags question: http://stackoverflow.com/q/25632452
tags question: http://stackoverflow.com/q/25577344
tags question: http://stackoverflow.com/q/25580887
tags question: http://stackoverflow.com/q/25558692
tags question: http://stackoverflow.com/q/25613087
tags question: http://stackoverflow.com/q/25578887
tags question: http://stackoverflow.com/q/25621055
tags question: http://stackoverflow.com/q/25616820
tags question: http://stackoverflow.com/q/25631095
tags question: http://stackoverflow.com/q/25684285
tags question: http://stackoverflow.com/q/25593689
tags question: http://stackoverflow.com/q/25554592
tags question: http://stackoverflow.com/q/25639279
tags question: http://stackoverflow.com/q/25670051
tags question: http://stackoverflow.com/q/25652899
type: Tag
tags question: http://stackoverflow.com/q/25613748
tags question: http://stackoverflow.com/q/25624424
tags question: http://stackoverflow.com/q/25697362
tags question: http://stackoverflow.com/q/25637462
tags question: http://stackoverflow.com/q/25666712
tags question: http://stackoverflow.com/q/25704155
tags question: http://stackoverflow.com/q/25571921
tags question: http://stackoverflow.com/q/25676631
tags question: http://stackoverflow.com/q/25604797
tags question: http://stackoverflow.com/q/25558311
tags question: http://stackoverflow.com/q/25571428
tags question: http://stackoverflow.com/q/25581382
tags question: http://stackoverflow.com/q/25567470
tag name: android-fragments
tags question: http://stackoverflow.com/q/25698810
tags question: http://stackoverflow.com/q/25708825
tags question: http://stackoverflow.com/q/25712595
tags question: http://stackoverflow.com/q/25579204
tags question: http://stackoverflow.com/q/25554239

http://stackoverflow.com/q/25634481
type: UnansweredQuestion
score: 1
tagged with: java
downvote count: 0
upvote count: 1
tagged with: jax-rs
has answer: http://stackoverflow.com/a/25636611
favorite count: 0
type: Question
tagged with: rest
tagged with: jersey
tagged with: http-redirect
has body: I am using Jerysey's implementation of JAX-RS to write a REST API. My POJO that handles the get requests eventually forwards it to a JSP. Everything is working fine, the problem is that the forwarding causes the URL in the browser's address bar to change to the URL that the request was forwarded to. How do I do a redirect WITHOUT this URL changing in the address bar? Current, I have tried 4 different ways: return Response.seeOther(uri).build(), return Response.temporaryRedirect(uri), //thrown exception: throw new WebApplicationException(response), return Response.status(303).location(uri).build();
has answer: http://stackoverflow.com/a/25644505
has answer: http://stackoverflow.com/a/25644630
answer count: 3
has title: Jersey: How to redirect/forward WITHOUT URL changing in address bar

http://stackoverflow.com/q/25579760
tagged with: swing
has comment: http://stackoverflow.com/comment/39953372
has comment: http://stackoverflow.com/comment/39953367
has body: I add listselectionlistener when i clicked on a tab table1 = new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { action(e); } }; ListSelectionModel SM = table1A.getSelectionModel(); SM.addListSelectionListener(table1); SM = table1B.getSelectionModel(); SM.addListSelectionListener(table1); When i clicked on the row of the table, the action(e) function fired many times. private void action(ListSelectionEvent e) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.getValueIsAdjusting()) { // nothing } else { // my action here } } The action(e) should fired twice, once is when mouse clicked, once is when mouse release. I had use the getValueIsAdjusting() to counter the mouse click, so my action should be run once. But, my action run many times. i can see this because i need to put a busy dialog inside my action.
favorite count: 0
has title: List Selection Listener valuechanged fired more than 2 times
tagged with: jtable
tagged with: listselectionlistener
tagged with: java
has answer: http://stackoverflow.com/a/25598421
has comment: http://stackoverflow.com/comment/39952214
type: Question
upvote count: 2
score: 2
downvote count: 0
type: UnansweredQuestion
answer count: 1

http://stackoverflow.com/q/25671856
answer count: 3
has answer: http://stackoverflow.com/a/25672473
has title: How to use Java to calculate average from input?
tagged with: if-statement
possible better answer: http://stackoverflow.com/a/25671898
tagged with: java
has answer: http://stackoverflow.com/a/25671898
accepted answer: http://stackoverflow.com/a/25672038
type: Question
score: 0
upvote count: 1
downvote count: 1
favorite count: 0
type: AnsweredQuestion
has body: I need a program that should add x numbers. The numbers should come from user input so I need some sort of loop. I have gotten as far as shown below, but I'm stuck since I have no idea how to add a new number without deleting the previous? System.out.println("How many numbers to use?"); int number = keyboard.nextInt(); for (int i = 0; i&lt;number ; i++) { System.out.println("whats the number"); double first = keyboard.nextDouble(); }
has answer: http://stackoverflow.com/a/25672038

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/25692037

http://stackoverflow.com/a/25677444
type: Answer
answers question: http://stackoverflow.com/q/25677384
upvote count: 3
score: 3
has body: Is this a problem with the scanner class? Nope. I just tested your code. The answer is pretty funny actually - I assume you are running this code in an IDE such as Eclipse. System.out.println() prints to the "Console". The console has a maximum number of lines it shows, and as your file is very long, it doesn't show the start. It IS looping through all the lines. To prove this, make it increment a digit whenever it prints a line such as: int counter = 0; while (reader.hasNextLine()) { String line = reader.nextLine(); System.out.println(line); counter++; } You will see that counter is exactly the number of lines in the document.
accepted answer of: http://stackoverflow.com/q/25677384
downvote count: 0
has comment: http://stackoverflow.com/comment/40129278
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40129302

http://stackoverflow.com/q/25622650
answer count: 0
type: UnansweredQuestion
has title: How to get past "java-lang-runtime exception an-error-occured-while-executing-doinbackground " error?
score: 0
tagged with: retrofit
has comment: http://stackoverflow.com/comment/40029914
tagged with: android
tagged with: java
has body: Hi I'm trying to create an android app to interact with Github Api. I am using Retrofit library to do that, when i tried a simple example with ASyncTask i get AsyncTask Fatal Exception error,i think I'm doing things properly here can't understand what's missing or wrong can't understand why, please help ! Code Sample: private class Process extends AsyncTask&lt;String,String,String&gt; { @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub RestAdapter restAdapter; String url= params[0]; restAdapter = new RestAdapter.Builder() .setEndpoint(url) .build(); // Create an instance of our GitHub API interface. GitHub github = restAdapter.create(GitHub.class); // Fetch and print a list of the contributors to this library. List&lt;Contributor&gt; contributors = github.contributors("square", "retrofit"); return contributors.toString(); } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub text.setText(result); } } Here is the Error Log: 09-02 07:32:55.132: E/AndroidRuntime(2830): FATAL EXCEPTION: AsyncTask #1 09-02 07:32:55.132: E/AndroidRuntime(2830): Process: com.example.codemymobile, PID: 2830 09-02 07:32:55.132: E/AndroidRuntime(2830): java.lang.RuntimeException: An error occured while executing doInBackground() 09-02 07:32:55.132: E/AndroidRuntime(2830): at android.os.AsyncTask$3.done(AsyncTask.java:300) 09-02 07:32:55.132: E/AndroidRuntime(2830): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) 09-02 07:32:55.132: E/AndroidRuntime(2830): at java.util.concurrent.FutureTask.setException(FutureTask.java:222) 09-02 07:32:55.132: E/AndroidRuntime(2830): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 09-02 07:32:55.132: E/AndroidRuntime(2830): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 09-02 07:32:55.132: E/AndroidRuntime(2830): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 09-02 07:32:55.132: E/Andro…
has comment: http://stackoverflow.com/comment/40029672
has comment: http://stackoverflow.com/comment/40030002
tagged with: android-asynctask
type: Question
has comment: http://stackoverflow.com/comment/40030239
tagged with: github-api
has comment: http://stackoverflow.com/comment/40029727
has comment: http://stackoverflow.com/comment/40029769

http://stackoverflow.com/q/25685416
has body: My application contains an implementation of the "Service Locator" pattern. The ServiceLocator is a central component which performs (JNDI) lookups for Remote EJBs and is used by several of our applications/components (r6-core, Java-API, etc.). The ServiceLocator has several configuration options and its main goal is to enable flexible (machine independent/application independent) deployments scenarios. Another goal is to shield JNDI/EJB lookup boilerplate from business logic (code). If a specific EJB is configured to be called only via local calls, the ServiceLocator implementation first instantiates an empty InitialContext and performs a JNDI lookup: InitialContext ic = new InitialContext(); ic.lookup(jndiName); The currently unexpected behavior is that we get the following exception upon executing this code: lookup for jndi-name 'java:global/.../ar-common-impl/ArPropertiesDaoBean' failed: 'Communication exception for SerialContext[myEnv= {java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.corba.orb=com.sun.corba.ee.impl.orb.ORBImpl@4f92338d, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming, com.sun.appserv.ee.iiop.endpointslist=corbaloc:iiop:1.2@sprprd01:23700} This exception shows that a remote call is tried! Due to the fact that these (local only) EJBs are not configured to be remote beans (and thus not serializable) an exception is thrown. The question is: Where does the endpointslist come from, even though we have not provided any of these parameters?
tagged with: glassfish
has answer: http://stackoverflow.com/a/25791312
has title: Communication exception for SerialContext[myEnv= Exception in Glassfish 3.1.2.2
type: Question
upvote count: 2
score: 2
downvote count: 0
type: UnansweredQuestion
answer count: 1
favorite count: 0
tagged with: jakarta-ee
tagged with: jndi
tagged with: java

http://stackoverflow.com/q/25689845
has comment: http://stackoverflow.com/comment/40155694
type: Question
linked to: http://stackoverflow.com/q/19342259
accepted answer: http://stackoverflow.com/a/25693263
has title: How do I set up a JavaFX Control to be imported into Scene Builder?
answer count: 1
has comment: http://stackoverflow.com/comment/40156653
linked to: http://stackoverflow.com/q/16673407
has body: I have a JavaFX control that is basically an amalgamation of several other JavaFX controls. I want it such that the .jar file can be imported into Scene Builder so that it can be used like any other control. The closest analogy I can think of is when you make a custom control in C# and use it several times throughout several projects. When I try to import the FXML file, it doesn't work. The control isn't treated as a single entity, and instead is basically just all of it's parts strung out in the FXML file. What do I need to do with the FXML file, or the controller.java file so that the Scene Builder will be able to import the .jar, see the control(s), and allow me to import and use each custom control as a single entity? I've looked several places and even asked on Stack Overflow once before (though the answer I got was not the one for which I was looking, and have received no responses since), but nothing I've seen comes close to handling my issue. The closest I've come has to do with this line in the FXML file: &lt;?scenebuilder-classpath-element /path/to/something?&gt; but I don't know what goes in /path/to/something I know I can, in the initialization, simply add the control to the scene, but that is sub-optimal and something which I am desperately trying to avoid.
type: AnsweredQuestion
score: 0
tagged with: custom-controls
tagged with: javafx-8
tagged with: java
tagged with: scenebuilder
has answer: http://stackoverflow.com/a/25693263
has comment: http://stackoverflow.com/comment/40154897

http://stackoverflow.com/q/25703593
tagged with: bash
score: 1
has comment: http://stackoverflow.com/comment/40177182
has body: i got a problem. I have a jar file, that should execute a Linux command which starts another jar file. But it always tells me this if i run my jar: java.io.IOException: Cannot run program "bash java -jar -Xmx2048M -Xms2G -XX:MaxPermSize=128M spigot.jar nogui" (in directory "/home/RusticGamesNetwork/MinecraftServers/MainLobby"): error=2, File or Directory not found at java.lang.ProcessBuilder.start(Unknown Source) at de.Cammeritz.RootServer.Servers.lobby(Servers.java:13) at de.Cammeritz.RootServer.Main.main(Main.java:11) Caused by: java.io.IOException: error=2, File or Directory not found at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.&lt;init&gt;(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 3 more This are my 2 classes: package de.Cammeritz.RootServer; public class Main { public static void main(String args[]) { Servers s = new Servers(); System.out.println("Server werden gestartet!"); s.lobby(); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("In 10 sec. schließt sich das Programm selber!"); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Das Programm wird geschlossen!"); System.exit(0); return; } } and this one: package de.Cammeritz.RootServer; import java.io.File; import java.io.IOException; public class Servers { public void lobby() { ProcessBuilder pb = new ProcessBuilder("bash java -jar -Xmx2048M -Xms2G -XX:MaxPermSize=128M spigot.jar nogui"); pb.directory(new File("/home/RusticGamesNetwork/MinecraftServers/MainLobby/")); try { pb.start(); } catch (IOException e) { e.printStackTrace(); } } } Thank you guys for help :)
downvote count: 0
answer count: 1
upvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25703659
has title: Linux run other jars
has comment: http://stackoverflow.com/comment/40177160
tagged with: linux
tagged with: execute
tagged with: processbuilder
has answer: http://stackoverflow.com/a/25703659
tagged with: java
type: AnsweredQuestion

jetty-9
tag name: jetty-9
tags question: http://stackoverflow.com/q/25596030
tags question: http://stackoverflow.com/q/25656150
type: Tag
tags question: http://stackoverflow.com/q/25615649

http://stackoverflow.com/a/25645514
accepted answer of: http://stackoverflow.com/q/25645351
has body: Your CashCard shouldn't contain an ArrayList of CashCard objects. You can remove that and keep your ArrayList in your main class. So you could do this in your main: ArrayList&lt;CashCard&gt; myCashCards = new ArrayList&lt;CashCard&gt;(); //Scanner input here. CashCard cashCard = new CashCard(yourname, youramount, youramountcardisused); myCashCards.add(cashCard);
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25645351

http://stackoverflow.com/comment/89096240
comment on: http://stackoverflow.com/a/38117587
type: Comment
type: AnswerComment
has text: This helped me solve building a JAR without packaging source classes under `BOOT-INF`: BOOT-INF is what you want for a _runnable_ JAR, but NOT what you want for a _source/dependency_ JAR.
score: 0

http://stackoverflow.com/q/25597670
has body: I am in chalange with my friend to make a better program, he decided to make a pain tool, while i decided to make a web browser. I am currently trying to implement the fields. if i add an address bar and a button everything works as told, but when i put a JEditorPane then the display does not show what it is told to show. CODE with no JEditorPane(everything works): import java.awt.*; import javax.swing.*; public class browserPannel { public static void main(String[] arg) { JFrame browser = new JFrame("A Nun In A Weelchair"); browser.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); browser.setLocationRelativeTo(null); browser.setSize(1000,700); browser.setVisible(true); browser.setResizable(false); JTextField url = new JTextField(); url.setSize(890,30); url.setVisible(true); url.setLocation(15,15); JPanel holder = new JPanel(); holder.setBackground(Color.lightGray); holder.setSize(1000,700); JButton send = new JButton("Send"); send.setSize(75,30); send.setVisible(true); send.setLocation(906,15); //JEditorPane htmlc = new JEditorPane(); //htmlc.setBackground(Color.red); //htmlc.setEditable(true); //htmlc.setContentType("text/html"); //htmlc.setSize(500,500); //htmlc.setVisible(true); //htmlc.setLocation(15,50); holder.add(url); holder.add(send); //holder.add(htmlc); browser.getContentPane().add(holder); } } IMAGE With no JEditorPanehttp, everything works as told: https://i.sstatic.net/hONs3.png CODE With JEditorPane (everything does not work as told): import java.awt.*; import javax.swing.*; public class browserPannel { public static void main(String[] arg) { JFrame browser = new JFrame("A Nun In A Weelchair"); browser.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); browser.setLocationRelativeTo(null); browser.setSize(1000,700); browser.setVisible(true); browser.setResizable(false); JTextField url = new JTextField(); url.setSize(890,30); url.setVisible(true); url.setLocation(15,15); JPanel holder = new JPanel(); holder.setBackground(Color.lightGray); holder.setSize(100…
tagged with: jeditorpane
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
score: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25597830
has answer: http://stackoverflow.com/a/25597830
has comment: http://stackoverflow.com/comment/39984635
has title: JEditorPane does not work properly, if i implement it, then everything goes wrong
type: AnsweredQuestion
tagged with: browser

http://stackoverflow.com/a/25652759
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25648083
score: 1
downvote count: 0
has body: Note: All code UNTESTED // this is drawing one line from center of screen // to (top of screen - frequency) // returned from a specific "slot"in fft via fft.getBand(i) line(i/2+width/2, height/2, i/2+width/2, height/2 - fft.getBand(i)*4); // note that fft.getBand(i) is multiplied by 4. this is your range, // increase that number and lines will be bigger // the next line does the same but towards the bottom of screen // note th '+' instead of '-'' // so if you want to keep them with the same range you gotta change here as well // better, make a range var.. line(i/2+width/2, height/2, i/2+width/2, height/2 + fft.getBand(i)*4); You have a loop that gets every band from fft and draws one line for each one (actually two, one up and one down). The order of the frequency visualisation is given by the order that you go trough fft. Now you are going from 0 until the length of fft list. Go backwards and the draw will be flipped: // from end to begin... for (int i = fft.specSize()-1 ; i &gt; 0; i-=10) { //TOP - RIGHT line(i/2+width/2, height/2, i/2+width/2, height/2 - fft.getBand(i)*4); //Bottom - LEFT line(i/2+width/2, height/2, i/2+width/2, height/2 + fft.getBand(i)*4); } Alternatively yo can use scale(-1, 0) to flip horizontally your screen… Then you can further control transformations with push/popMatrix() HTH

http://stackoverflow.com/a/25573868
has comment: http://stackoverflow.com/comment/39941139
has comment: http://stackoverflow.com/comment/39941121
score: 5
accepted answer of: http://stackoverflow.com/q/25573830
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/39941351
answers question: http://stackoverflow.com/q/25573830
type: AcceptedAnswer
downvote count: 0
has body: Use a ternary statement? ([condition] ? [value-if-true] : [value-if-false]) For instance, if you wanted this to become "Yes"/"No": (text.matches("(?i)^.*\\bhello\\b.*\\bgoodbye\\b.*$") ? "Yes" : "No")

http://stackoverflow.com/comment/39958579
type: QuestionComment
has text: Why do you recreate this sequene on every user input? It could be faster if you cache the latest sequence and extend it if you need a longer one.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25583339

http://stackoverflow.com/a/25599908
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25599739
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/25599739
has body: Alternative patterns can be concatenated with the | operator: "\\bName\\sServer:\\s*\\w+\\d*\\.*\\w*\\-*\\w*(\\.\\w+)+|alternative pattern|alternative Pattern" (If this isn't what you need, then your question should be reformulated.)
type: AcceptedAnswer

http://stackoverflow.com/q/25618382
tagged with: java
tagged with: ssl
has body: I'm implementing a protocol that specifies TLS1.2 as transport layer and requires client-side server authentication to verify the server's hostname by comparing the hostname value of the connecting client socket to the value indicated by the server in its certificate, namely subjectAltName extension of type dNSName. I've created a test, put this value in the server's certificate and it seemed to get ignored by the client completely, but I'd like to be sure. Do I have to code this check in an implementation of X509ExtendedTrustManager.checkServerTrusted(X509Certificate[], String, Socket) or can I enable it through some obscure property? The reference guide appears silent on this matter. The protocol specification (the one I'm implementing) also mentions that wildcards may be used as a prefix of the value in the certificate. A "*" wildcard character MAY be used as the leftmost name component in the certificate. For example, *.example.com would match a.example.com, foo.example.com, etc., but would not match example.com. However, when I tried to create such an extension value with keytool, it refused to do so. What's going on? "C:\Program Files\Java\jdk1.7.0_51\bin\keytool.exe" -genkeypair -alias server -keyalg RSA -validity 365 -ext san=dns:*.example.com -keystore mykeystore ... keytool error: java.lang.RuntimeException: java.io.IOException: DNSName components must begin with a letter
possible better answer: http://stackoverflow.com/a/25634147
linked to: http://stackoverflow.com/q/24971552
accepted answer: http://stackoverflow.com/a/25639568
tagged with: endpoint
tagged with: hostname
type: Question
has answer: http://stackoverflow.com/a/25634147
has answer: http://stackoverflow.com/a/25639568
answer count: 2
has title: Does Java1.7 TLS1.2 implementation take dNSName (SAN extension) into account when connecting?
tagged with: verification
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/25645920
answer count: 1
tagged with: eclipse
tagged with: deployment
has body: I'm developing a Java application on tomcat with Eclipse. The problem is that when I have to deploy it on my remote server I have to upload the .war file, that contains also all the libraries, so the upload is slow even if is changed only a little portion of my code. Is there is a way to upload and deploy only the source code of an application?
type: Question
has title: Upload only source code on Tomcat remote deploy
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25648130
has comment: http://stackoverflow.com/comment/40074864
tagged with: tomcat
linked to: http://stackoverflow.com/q/4257647
score: 0
tagged with: java

http://stackoverflow.com/a/25564702
has body: You never initialize the second dimension of the array pathingTriangle = new String[triangleSize][]; which is done in the first funnction here int [] xAxis = new int[triangle.length - y];
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25564627
has comment: http://stackoverflow.com/comment/39923347
accepted answer of: http://stackoverflow.com/q/25564627
score: 3
upvote count: 3

http://stackoverflow.com/q/25587822
tagged with: spinner
has answer: http://stackoverflow.com/a/25588608
has answer: http://stackoverflow.com/a/25588619
favorite count: 0
type: Question
upvote count: 0
answer count: 2
type: UnansweredQuestion
has body: my question is the following: I have a spinner which acts as a menu in my mainactivity, i also want to use the same spinner in my other activities, so i can save some code lines. how can i achieve that? i will post the code, or is there a better solution to do this? @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Spinner spinner = (Spinner) findViewById(R.id.comboCasino); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.comboCasino, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); // this will be called when you select any item in this spinner spinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View arg1, int position, long arg3) { // get the text at that position String Text = spinner.getSelectedItem().toString(); if(Text.equals("Wien Simmering")) { Intent NewPost = new Intent(StartingPoint.this,Simmering.class); startActivity(NewPost); } if(Text.equals("Wien Lugner City")) { Intent NewPost = new Intent(StartingPoint.this, LugnerCity.class); startActivity(NewPost); } if(Text.equals("Gmunden")) { Intent NewPost = new Intent(StartingPoint.this, Gmunden.class); startActivity(NewPost); } if(Text.equals("Salzburg")) { Intent NewPost = new Intent(StartingPoint.this, Salzburg.class); startActivity(NewPost); } if(Text.equals("Linz")) { Intent NewPost = new Intent(StartingPoint.this, Linz.class); startActivity(NewPost); } if(Text.equals("Saalbach")) { Intent NewPost = new Intent(StartingPoint.this, Saalbach.class); startActivity(NewPost); } if(Text.equals("Innsbruck")) { Intent NewPost = new Intent(StartingPoint.this, Innsbruck.class); startActivity(NewPost); } if(Text.equals("Reutte")) { Intent NewPost = new Intent(StartingPoint.this, Reutte.class); startActivity(NewPost); } if(Text.e…
tagged with: android
tagged with: java
has title: Use spinner as a menu in multiple activities
downvote count: 1
score: -1

http://stackoverflow.com/comment/39988459
score: 0
comment on: http://stackoverflow.com/q/25599720
has text: May be problem on client-side. Please, add code with ajax call
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25611528
tagged with: java
tagged with: sonarqube
tagged with: eclipse
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25620058
has title: Error while trying to analyse Java project code
has body: I configured the Eclipse Sonar Plugin to point to my SonarQube server, and it was ok. My Sonar Qube Server version is 3.7.4. I followed this page I'm getting this error below while trying to run Sonar analysis via Sonar Eclipse Plugin. Can anyone help me? I have the tag configured properly in my pom.xml file: scm:svn:https://svnjiracloud.cit.com.br/repos/svn/PAPS/trunk/Fontes/PortalRAM/faturamento-auditorias-batch scm:svn:https://svnjiracloud.cit.com.br/repos/svn/PAPS/trunk/Fontes/PortalRAM/faturamento-auditorias-batch https://svnjiracloud.cit.com.br/repos/svn/PAPS/trunk/Fontes/PortalRAM/faturamento-auditorias-batch Error: 15:36:05.138 INFO - Execute PMD 4.3 done: 3865 ms 15:36:05.161 INFO - Sensor PmdSensor done: 3893 ms 15:36:05.161 INFO - Sensor org.sonar.plugins.scmstats.ScmStatsSensor@526018e0... Exception in thread "main" org.sonar.runner.impl.RunnerException: Unable to execute Sonar at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91) at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) at java.security.AccessController.doPrivileged(Native Method) at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) at org.sonar.runner.impl.BatchLauncherMain.execute(BatchLauncherMain.java:41) at org.sonar.runner.impl.BatchLauncherMain.main(BatchLauncherMain.java:59) Caused by: org.sonar.api.utils.SonarException: SCM URL must not be blank. Please check the parameter SCM URL or the section of Maven pom. at org.sonar.plugins.scmstats.UrlChecker.failure(UrlChecker.java:56) at org.sonar.plugins.scmstats.UrlChecker.check(UrlChecker.java:36) at org.sonar.plugins.scmstats.ScmStatsSensor.analyse(ScmStatsSensor.java:53) at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:72) at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:114) at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:142) at or…
tagged with: maven
tagged with: eclipse-plugin
type: Question
has answer: http://stackoverflow.com/a/25654254
type: UnansweredQuestion

http://stackoverflow.com/comment/40135252
type: Comment
score: 0
type: AnswerComment
has text: Now it Works!!! I have combined the response of mbw of these. I have the code posted above
comment on: http://stackoverflow.com/a/25659060

http://stackoverflow.com/comment/40084416
score: 0
type: AnswerComment
has text: I will have to try this out. The reason I haven't done so before is that when I look at a list of Metal's L&F properties for Label using [link](http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/) I do not see "opaque" listed.
comment on: http://stackoverflow.com/a/25651040
type: Comment

http://stackoverflow.com/comment/40161076
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/60730/discussion-between-ariel-and-david-eisenstat).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25677385
type: AnswerComment

jasper-reports
tags question: http://stackoverflow.com/q/25640812
tag name: jasper-reports
tags question: http://stackoverflow.com/q/25628295
tags question: http://stackoverflow.com/q/25611106
tags question: http://stackoverflow.com/q/25619142
type: Tag
tags question: http://stackoverflow.com/q/25699808
tags question: http://stackoverflow.com/q/25617664
tags question: http://stackoverflow.com/q/25651451
tags question: http://stackoverflow.com/q/25584408
tags question: http://stackoverflow.com/q/25604202
tags question: http://stackoverflow.com/q/25688558
tags question: http://stackoverflow.com/q/25617117
tags question: http://stackoverflow.com/q/25679787
tags question: http://stackoverflow.com/q/25626750

http://stackoverflow.com/comment/40190717
has text: Off the top of my head, this is how the tutorial went... ActionListener listener = new ActionListener(){ public void actionPerformed(actionEvent event){ System.out.println("hello"); } }; Timer timer = new Timer(4000, listener); timer.start(); The thing is, I realy do not know where this goes within my code I already have, neither do I understand timers enough to modify it for my panel exchange purpose. I know this code is correct because evert tutorial is very similar. Thats good to know, thanks, knowing not where the code goes is half my problem.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25710812

http://stackoverflow.com/comment/40019242
score: 0
has text: serialize a class with a field of type enum using jackson 1.9.13. If there is no enum field, serializing is ok.
type: Comment
comment on: http://stackoverflow.com/q/25616528
type: QuestionComment

http://stackoverflow.com/comment/40190665
has text: I would recommend working through a Java tutorial, like the one provided by Oracle: [Lesson: Classes and Objects](http://docs.oracle.com/javase/tutorial/java/javaOO/index.html)
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25711011

http://stackoverflow.com/comment/40133007
type: Comment
score: 0
type: AnswerComment
has text: I don't know - this is what VFS2 is telling, but maybe smb is not in the defaults.. http://commons.apache.org/proper/commons-vfs/api.html
comment on: http://stackoverflow.com/a/25665052

http://stackoverflow.com/a/25638836
downvote count: 0
answers question: http://stackoverflow.com/q/25638639
score: 3
type: Answer
has body: Try this: int i = bigDecimal .minus(new BigDecimal(bigDecimal.intValue()) .multiply(new BigDecimal(100)) .intValue();
upvote count: 3

http://stackoverflow.com/comment/39923514
type: AnswerComment
comment on: http://stackoverflow.com/a/25564537
has text: If he's worried about quickest execution time then `StringBuilder` is faster but lacks thread safety.
type: Comment
score: 0

http://stackoverflow.com/comment/40075649
comment on: http://stackoverflow.com/q/25646891
has text: @Frakcool I can understand what he is saying my this is 3 classes code its not so hard to understand what i am saying... And i got my answer without posting any code. how this people got it?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25664237
tagged with: jpa-2.0
tagged with: recursion
tagged with: java
linked to: http://stackoverflow.com/q/5818373
has title: JPA mapping with relationship on same entity (category, child categories and parent category)
type: Question
has comment: http://stackoverflow.com/comment/40106174
score: 0
has answer: http://stackoverflow.com/a/25667872
has body: I am trying to solve a problem regarding category with child categories and parent category on same entity. My database is already set and I can't change it. So, I have mapped my entity this way: public class Category implements Serializable { private static final long serialVersionUID = -3432724244623524272L; @Id @Column(name = "id") private Long id; @Column(name = "key", nullable = false) private String key; @Column(name = "category_name", nullable = false) private String name; @Column(name = "description") private String description; @ManyToOne(targetEntity = Category.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "parent_key", referencedColumnName = "key") private Category parentCategory; @OneToMany(mappedBy = "parentCategory", cascade = CascadeType.ALL, fetch = FetchType.EAGER) private List&lt;Category&gt; childCategories; //getters and setters ommited } Note, that the child categories and parent category is not mapped using the ID attribute, but the "key" attribute. This "key" is not a FK. When JPA is trying to get the data, my application crash. But this crash is look like an infinite loop. No exception is thrown. What am I doing wrong?
type: UnansweredQuestion
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/40105450

http://stackoverflow.com/a/25700175
has body: An ArgumentCaptor probably is the best way to do what you want. However, it seems that you don’t actually care about the order of the files in the List. Therefore, have you considered changing ClassB so that it takes an unordered collection (like a Set) instead?
downvote count: 0
answers question: http://stackoverflow.com/q/25700059
score: 9
upvote count: 9
type: Answer
has comment: http://stackoverflow.com/comment/40170917
has comment: http://stackoverflow.com/comment/45065963

http://stackoverflow.com/comment/40068236
comment on: http://stackoverflow.com/q/25642153
type: QuestionComment
has text: I think you should remove this line: TimerService timerService = sessionContext.getTimerService(); you get the timerservice from resource injection already
score: 0
type: Comment

http://stackoverflow.com/a/25608862
answers question: http://stackoverflow.com/q/25608827
score: 0
type: Answer
has body: Method 1: Iterate through the array and put each element to arrayList on every iteration. Method 2: Use asList() method Example1: Using asList() method String[] urStringArray = { "http://www.ebuy.al/Images/dsc/17470_500_400.jpg", "http://www.ebuy.al/Images/dsc/17471_500_400.jpg"} List&lt;String&gt; newList = Arrays.asList(urStringArray); Example2 Using simple iteration List&lt;String&gt; newList = new ArrayList&lt;String&gt;(); for(String aString:urStringArray){ newList.add(aString); }

http://stackoverflow.com/comment/40090703
type: QuestionComment
comment on: http://stackoverflow.com/q/25655218
type: Comment
has text: You have a couple methods called on `camera`, but then you set the batch's projection matrix with `world.getCamera`. Are these the same camera?
score: 0

http://stackoverflow.com/comment/42738715
score: 0
has text: were you able to solve this issue?
comment on: http://stackoverflow.com/q/25591466
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25608863
has comment: http://stackoverflow.com/comment/40007151
has comment: http://stackoverflow.com/comment/40006985
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/40006719
has comment: http://stackoverflow.com/comment/40006110
has comment: http://stackoverflow.com/comment/40006546
has body: Use Arrays#asList String[] stringArray = { "http://www.ebuy.al/Images/dsc/17470_500_400.jpg", "http://www.ebuy.al/Images/dsc/17471_500_400.jpg"} List&lt;String&gt; stringList = Arrays.asList(stringArray); In case your string contains braces [] and double quotes "", then you should parse the string manually first. String yourString = "[\"http://www.ebuy.al/Images/dsc/17470_500_400.jpg\", \"http://www.ebuy.al/Images/dsc/17471_500_400.jpg\"]"; String[] stringArray = yourString .substring(1, yourString.length() - 2) .replace('"', '\0') .split(",\\s+"); List&lt;String&gt; stringList = Arrays.asList(stringArray); Try the above if and only if you will always receive your String in this format. Otherwise, use a proper JSON parser library like Jackson.
answers question: http://stackoverflow.com/q/25608827
has comment: http://stackoverflow.com/comment/40007010
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40007112

http://stackoverflow.com/comment/40007347
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25609165
has text: That is what the OP need to do right as it appears like a json array
type: Comment

http://stackoverflow.com/a/25685733
upvote count: 1
has body: Yes, but this would be a CSS selector: driver.FindElements(By.CssSelector("class2 &gt; class1")); By.className accepts a single class name, as identified by the method name.
accepted answer of: http://stackoverflow.com/q/25684910
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25684910
type: Answer

http://stackoverflow.com/comment/40308410
type: AnswerComment
score: 0
has text: I ended up switching to Wildfly, and then I added the filter class as a filter in the web.xml file and it worked. Thanks for your pointers!
type: Comment
comment on: http://stackoverflow.com/a/25713814

http://stackoverflow.com/q/25553250
has body: My GUI application allows users to type into a JTextField object stating the name of a file to open and display its contents onto a JTextArea object. If the entered information consists of the file name then it shall retrieve its contents otherwise, in other case, it shall be a directory then it shall display the files and folders. Right now, I'm stuck as in the setText() of my JTextArea does not display contents correctly. It only display once which means to say there's some problem with my while loop. Could you guys help me out here please? Please note the code below has been altered to the correct working version provided all the helpful contributors below. Main class: import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; import java.io.*; class MyFileLister extends JPanel implements ActionListener { private JLabel prompt = null; private JTextField userInput = null; private JTextArea textArea = null; public MyFileLister() { prompt = new JLabel("Enter filename: "); prompt.setOpaque(true); this.add(prompt); userInput = new JTextField(28); userInput.addActionListener(this); this.add(userInput); textArea = new JTextArea(10, 30); textArea.setOpaque(true); JScrollPane scrollpane = new JScrollPane(textArea); this.add(textArea, BorderLayout.SOUTH); } Scanner s = null; File af = null; String[] paths; public void actionPerformed(ActionEvent f) { try { s = new Scanner(new File(userInput.getText())); while(s.hasNextLine()) { String as = s.nextLine(); textArea.append(as + "\n"); textArea.setLineWrap(truea); } } catch(FileNotFoundException e) { af = new File(userInput.getText()); paths = af.list(); System.out.println(Arrays.toString(paths)); String tempPath = ""; for(String path: paths) { tempPath += path + "\n"; } textArea.setText(tempPath); } } } Driver class: import java.util.*; import java.awt.*; import javax.swing.*; class TestMyFileLister { public static void main(String [] args) { MyFileLister thePanel = new MyFileLister(); JFrame firstFr…
has comment: http://stackoverflow.com/comment/39905391
tagged with: java
has comment: http://stackoverflow.com/comment/39901960
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/39902147
has comment: http://stackoverflow.com/comment/39902224
type: Question
has title: Why my JTextArea is not displaying properly from the while loop?
has comment: http://stackoverflow.com/comment/39907543
has answer: http://stackoverflow.com/a/25556274
possible better answer: http://stackoverflow.com/a/25556274
tagged with: jtextarea
has answer: http://stackoverflow.com/a/25565468
accepted answer: http://stackoverflow.com/a/25565468
tagged with: swing
type: AnsweredQuestion
score: 0
answer count: 2
tagged with: while-loop

http://stackoverflow.com/q/25563131
score: 0
has comment: http://stackoverflow.com/comment/39921501
tagged with: distinct
tagged with: java
answer count: 1
type: Question
has body: Does any one have a clue why DISTINCT keyword is removed from the query when using DataNucleus (that's the software the company I work for uses)? I was able to debug the code and verified that the keyword is actually with the query. But by the time this function is called within JPAEntityManager createQuery(CriteriaQuery&lt;T&gt; criteriaQuery) the DISTINCT keyword is removed. Debugging showed me it has something to do with criteria.getCompilation(ec.getMetaDataManager(), ec.getClassLoaderResolver()); function call. Somehow createQuery() function works fine with SELECT COUNT(DISTINCT DN_THIS) but not with SELECT DISTINCT FROM. I hope some of you have at least a slight idea where the problem is since I'm fairly new with JPA and SQL queries in general that I can't find a quick solution on my own. The query I'm trying to perform is as follows: SELECT DISTINCT DN_THIS FROM Hop DN_THIS JOIN DN_THIS.tags t WHERE ((DN_THIS.entityStatus &lt;&gt; 'DELETED') AND ((t.name = :DN_PARAM_4) OR (t.name = :DN_PARAM_5))) ORDER BY DN_THIS.name ASC Thank you!
has title: DISTINCT keyword gets removed from the query
has answer: http://stackoverflow.com/a/25574024
tagged with: datanucleus
has comment: http://stackoverflow.com/comment/39921114
type: UnansweredQuestion
tagged with: jpa
has comment: http://stackoverflow.com/comment/39920248

http://stackoverflow.com/a/25566474
type: Answer
has body: I simplified your code to this one. This might help. String str = "WOMAN"; List&lt;String&gt; tempArr = new ArrayList&lt;String&gt;(); for (int i = 1; i &lt; str.length(); i++) { for (int j = i; j &lt;= str.length(); j++) { tempArr.add(str.substring(i - 1, j)); } } String[] res = tempArr.toArray(new String[tempArr.size()]);
score: -1
upvote count: 0
downvote count: 1
answers question: http://stackoverflow.com/q/25566232
has comment: http://stackoverflow.com/comment/48624843

http://stackoverflow.com/comment/40037289
comment on: http://stackoverflow.com/q/25626532
has text: try [this](http://stackoverflow.com/questions/17871825/a-good-way-to-debug-nullpointerexception) if you are on eclipse
score: 0
type: Comment
type: QuestionComment

swixml
type: Tag
tags question: http://stackoverflow.com/q/25592901
tag name: swixml

http://stackoverflow.com/comment/39979712
has text: No offense, but this looks like taken straight from a code obfuscation contest. Is this coding style really considered superior by renowned Java experts?
comment on: http://stackoverflow.com/a/25595057
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/comment/119865874
type: AnswerComment
comment on: http://stackoverflow.com/a/59480404
has text: Redundant answer. It just repeats things said by earlier answers.
type: Comment
score: 0

http://stackoverflow.com/comment/40169435
type: QuestionComment
comment on: http://stackoverflow.com/q/25699316
score: 0
type: Comment
has text: do you get any exceptions? post the full stack trace of the exceptions you get.

xslt-2.0
tags question: http://stackoverflow.com/q/25642536
type: Tag
tag name: xslt-2.0
tags question: http://stackoverflow.com/q/25581145

http://stackoverflow.com/comment/40008819
has text: The problem is that you are configuring too much. Spring Boot already configures the template engine as well as the view resolver for you. Also calling `setTemplateResolver` twice with different resolvers will not do much but override the previous one. I suggest removing everything but the email configuration and the `emailTemplateResolver` everything else will be handled by Spring Boot.
type: Comment
comment on: http://stackoverflow.com/q/25610281
score: 0
type: QuestionComment

http://stackoverflow.com/q/25662354
has answer: http://stackoverflow.com/a/25662731
tagged with: sql-server
score: 0
has body: Could someone help for connecting to SQLserver in Java (Vaadin) Hello Folks .. I am very much new to Java ,, I do not know how to connect to SQLsever, I have written a code but it's stating that resources not available. HorizontalLayout hor = new HorizontalLayout(); //hor.setSizeFull(); HorizontalLayout hor2 = new HorizontalLayout(); //hor.setSizeFull(); try { JDBCConnectionPool pool = new SimpleJDBCConnectionPool("org.hsqldb.jdbc.JDBCDriver", "SERVEUR", "SA", ""); } catch (SQLException ex) { content.addComponent(new Label("test")); Logger.getLogger(MyVaadinUI.class.getName()).log(Level.SEVERE, null, ex); } Regards
tagged with: java
answer count: 1
type: Question
type: AnsweredQuestion
has title: Could someone help for connecting to sql server in Java (vaadin)
tagged with: vaadin
accepted answer: http://stackoverflow.com/a/25662731
tagged with: sts-springsourcetoolsuite

http://stackoverflow.com/comment/40173287
score: 0
type: Comment
type: AnswerComment
has text: that doesnt solve anything : http://stackoverflow.com/questions/66540/when-does-system-gc-do-anything
comment on: http://stackoverflow.com/a/25701317

http://stackoverflow.com/comment/40182487
score: 1
type: Comment
type: QuestionComment
has text: this shouldn't even compile... you need to escape the double quotes then wrap the whole string in double quotes.
comment on: http://stackoverflow.com/q/25706385

http://stackoverflow.com/comment/49810140
comment on: http://stackoverflow.com/a/25604448
type: AnswerComment
score: 0
has text: @JeeBee Great to hear!
type: Comment

http://stackoverflow.com/q/25591971
upvote count: 1
score: 1
tagged with: java
answer count: 1
tagged with: unused-variables
favorite count: 0
type: Question
tagged with: serialization
has answer: http://stackoverflow.com/a/25633939
accepted answer: http://stackoverflow.com/a/25633939
tagged with: intellij-idea
has title: Java IntelliJ IDEA Serialization UnusedDeclaration inspection error
tagged with: code-inspection
type: AnsweredQuestion
has body: I am fixing and cleaning up my school project and we are supposed to use the "InspectCode" feature in IntelliJ IDEA. We are to fix all warnings before returning the project. I got some warnings under a category "Declaration redundancy/unused declaration. This is the warning category definition: "This inspection reports classes, methods or fields in the specified inspection scope that are not used or not reachable from entry points." I don't understand why. I have a total of four warnings that are connected to my serialization code ( see code below). The project works fine and I get no errors. I am asking for help to understand and hopefully be able to remove these four warnings. private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException { // default de-serialization is.defaultReadObject(); quests = new ArrayList&lt;&gt;(); QuestManager qm = (QuestManager) is.readObject(); for (String name : qm.questNames) { quests.add(QuestBank.getQuest(name)); } for (Quest q : quests) { System.out.println("Quest name: " + q.name); } } This is one of the classes that raises the error: "Method is never used" Both methods raises that warning. As I said before everything works. I know these two methods are being called because I have tested to remove them and also att System.out.println(anytexthere) and that is called. I wonder if I am supposed to mark them or call them seperately or something else. Thanks in advance.
downvote count: 0

http://stackoverflow.com/a/28519936
upvote count: 49
has body: I encountered this same exception when the URL started with http:/ instead of http://. e.g. http:/www.example.com This was in the org.springframework.web.client.RestTemplate.exchange() method, so it's not quite the same context, but maybe a similar issue.
score: 49
type: Answer
has comment: http://stackoverflow.com/comment/115518474
has comment: http://stackoverflow.com/comment/104730291
answers question: http://stackoverflow.com/q/25642104
downvote count: 0

http://stackoverflow.com/comment/40129788
type: QuestionComment
has text: change this `ListActivity` to `Activity ` if you already have the listView in your layout then no need to extend it with `ListActivity`
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25677652

http://stackoverflow.com/comment/40173541
comment on: http://stackoverflow.com/a/25701565
type: Comment
type: AnswerComment
has text: I will try to change my design. I'm still baffled at why I'd have this problem though. Recursion or no, the GC documentation says it will run and reclaim all memory of any objects set to null before throwing outofmemory. So why would recursion make the difference? Thanks for the feedback. I'll give your suggestion a go.
score: 0

http://stackoverflow.com/q/25646047
score: 0
tagged with: reflection
answer count: 0
tagged with: java
has title: Mongodb driver cannot determine the spring version
type: Question
tagged with: mongodb
has comment: http://stackoverflow.com/comment/40072272
has body: Forgive my ignorance, I am a newbie to Spring, MongoDB and reflections. I recently started working on a project, where I started facing this issue. Please help. In package org.springframework.data.mongodb.core.convert; There is a code snippet :- public class DefaultDbRefResolver implements DbRefResolver { private static final boolean IS_SPRING_4_OR_BETTER = SpringVersion.getVersion().startsWith("4"); .............. .................... .......... } As per http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/core/SpringVersion.html "Class that exposes the Spring version. Fetches the "Implementation-Version" manifest attribute from the jar file. Note that some ClassLoaders do not expose the package metadata, hence this class might not be able to determine the Spring version in all environments. Consider using a reflection-based check instead: For example, checking for the presence of a specific Spring 2.0 method that you intend to call." In my case MongoDB is unable to get Spring Version from SpringVersion.getVersion() call. Is there any fix available for this issue ? If not can someone please help me in referring to some class/functionality which is only present in RELEASE 4.0.5 so that I can find out version using reflection. Thanks, Ankit
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40072399
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/comment/40030860
type: AnswerComment
comment on: http://stackoverflow.com/a/25623070
type: Comment
has text: Same to you :) Add that to your answer, and it's worth leaving up.
score: 0

http://stackoverflow.com/a/25597921
type: Answer
has body: FileOutputStream outputStream = new FileOutputStream("path\\log.txt", true); PrintWriter logput = new PrintWriter(outputStream, true); for (String symb : symbolList) { System.out.println(symb); logput.println(symb); } logput.close(); Will it work ?
downvote count: 0
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25597839

http://stackoverflow.com/q/25653512
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10876079
tagged with: android
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/25657132
has answer: http://stackoverflow.com/a/25657132
tagged with: eclipse
has body: I have a Android app about Public Transportation, and I have a PHP script that connects to mySQL database. This is the main.java package com.chera.trans; import com.chera.trans.R; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; public class Main extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case R.id.traseu2: Intent traseu2 = new Intent(this, Traseu2.class); this.startActivity(traseu2); break; case R.id.traseu401: Intent traseu401 = new Intent(this, Traseu401.class); this.startActivity(traseu401); break; default: return super.onOptionsItemSelected(item); } return true; } } And this is the code for Traseu2.java package com.chera.trans; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.chera.trans.R; import android.os.AsyncTask; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.To…
has title: Error org.json.JSONException: Value Error of type java.lang.String cannot be converted to JSONObject
has comment: http://stackoverflow.com/comment/40086400
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/comment/40150596
type: Comment
type: QuestionComment
score: 0
has text: Why? What's the point? What's the *"...[specific programming problem](http://stackoverflow.com/help/on-topic)..."* you're running into where you need to do this?
comment on: http://stackoverflow.com/q/25689192

http://stackoverflow.com/comment/40026983
type: Comment
comment on: http://stackoverflow.com/a/25620865
score: 0
type: AnswerComment
has text: See? It wasn't hard to understand. Simple and working, thanks sir.

http://stackoverflow.com/comment/39909792
has text: @It_Does_Not_Matter Go to `Window > Preferences > Java > Code Style > Formatter > Edit > Comments > Line Wrapping > Maximum line width` and increase that value.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25556532
score: 0

data-structures
tags question: http://stackoverflow.com/q/25678639
tag name: data-structures
tags question: http://stackoverflow.com/q/25651929
tags question: http://stackoverflow.com/q/25583733
tags question: http://stackoverflow.com/q/25704615
type: Tag
tags question: http://stackoverflow.com/q/25669865
tags question: http://stackoverflow.com/q/25566729
tags question: http://stackoverflow.com/q/25675832
tags question: http://stackoverflow.com/q/25675080

http://stackoverflow.com/q/25671458
has comment: http://stackoverflow.com/comment/40120462
type: Question
accepted answer: http://stackoverflow.com/a/25671767
upvote count: 1
has title: InvalidProtocolBufferException: Protocol message end-group tag did not match expected tag
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40122851
favorite count: 0
has answer: http://stackoverflow.com/a/25671767
type: AnsweredQuestion
tagged with: protocol-buffers
score: 1
tagged with: java
has body: I'm trying to write a file and then read it again. My write code: ObjectOutputStream oos = null; FileOutputStream fout = null; try { Object myObject; fout = new FileOutputStream(new File("C:\\Foo","Bar.log")); oos = new ObjectOutputStream(fout); oos.writeObject(myObject); } catch (Exception ex) { ex.printStackTrace(); } finally { try { oos.close(); fout.close(); } catch (IOException e) { e.printStackTrace(); } } My reader: FileInputStream input; try { input = new FileInputStream(new File("C:\\Foo\\Bar.log")); MyFile parsedObject = MyFileFormat.MyFile.parseFrom(input); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } But I'm getting this exception on the parser: com.google.protobuf.InvalidProtocolBufferException: Protocol message end-group tag did not match expected tag. at com.google.protobuf.InvalidProtocolBufferException.invalidEndTag(InvalidProtocolBufferException.java:94) Can anyone help?

http://stackoverflow.com/q/25635868
score: 1
upvote count: 1
tagged with: java
favorite count: 0
type: Question
tagged with: object
has body: How to call a class from another in th same package shows an error how to fix it? i have three classes FirstPack.java SecondPack.java Main.java Here is my FirstPack.java //FirstPack.java package mypack.in; public class FirstPack { public void fun() { try { System.out.println("First Package"); } catch(Exception ae) { } } } Here is my SecondPack.java //SecondPack.java package mypack.in; public class SecondPack { public void fun() { FirstPack f=new FirstPack(); f.fun(); try { System.out.println("Second Package"); } catch(Exception ae) { } } } Here is my Main.java //Main.java import java.lang.*; import mypack.in.*; class Main { public static void main(String args[]) { try { //FirstPack obj_fp=new FirstPack(); //obj_fp.fun(); SecondPack obj_sp=new SecondPack(); obj_sp.fun(); } catch(Exception ae) { } } } On compiling Firstpack.java ie javac FirstPack.java - no problem On compiling SecondPack.java ie javac SecondPack.java- Error .... C:\JAVASAMPLE\Package\Three\mypack\in&gt;javac SecondPack.java SecondPack.java:7: cannot find symbol symbol : class FirstPack location: class mypack.in.SecondPack FirstPack f=new FirstPack(); ^ SecondPack.java:7: cannot find symbol symbol : class FirstPack location: class mypack.in.SecondPack FirstPack f=new FirstPack(); ^ 2 errors And, on compiling Main.java ie javac Main.java - no problem Package - mypack.in FirstPack.java and SecondPack.java Outside mypack.in Main.java Sir if without package yes it workinf but with pakage it didnt working I am not using any IDEs
has comment: http://stackoverflow.com/comment/40054404
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25636005
tagged with: package
has comment: http://stackoverflow.com/comment/40054384
tagged with: compilation
has comment: http://stackoverflow.com/comment/40054421
tagged with: class
has title: How to call a class from another in th same package shows an error how to fix it in java?
answer count: 2
has answer: http://stackoverflow.com/a/25636286
downvote count: 0
has comment: http://stackoverflow.com/comment/40054424

http://stackoverflow.com/q/25615202
tagged with: mapping
downvote count: 0
tagged with: java-stream
answer count: 1
has title: Java 8 stream map reusing assigned variable
tagged with: java-8
has comment: http://stackoverflow.com/comment/40016555
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40016511
tagged with: filter
tagged with: java
has comment: http://stackoverflow.com/comment/40016502
has comment: http://stackoverflow.com/comment/40016451
favorite count: 0
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/25615237
has body: I'm aware that title may be a little confusing but I couldn't come up with a better one so let me explain what I mean... I have this piece of code: int spacing = Integer.MAX_VALUE; for (Edge edge : edges) { if (!union.connected(edge.getStart(), edge.getEnd())) { spacing = Math.min(spacing, edge.getWeight()); } } Is there a way to turn this code into java 8 code? Of course, first step is filtering which is simple, but then it becomes tricker because I would have to reuse computed variable spacing in Stream::map method and I have no idea is that possible.
accepted answer: http://stackoverflow.com/a/25615237

http://stackoverflow.com/comment/40152709
type: AnswerComment
score: 0
type: Comment
has text: Set the text to null as well as the graphic when the cell is empty.
comment on: http://stackoverflow.com/a/25690244

http://stackoverflow.com/comment/39906522
type: Comment
type: QuestionComment
has text: Try double quotes. Your expression language call isn't being interpreted.
score: 0
comment on: http://stackoverflow.com/q/25555512

checkin
tag name: checkin
tags question: http://stackoverflow.com/q/25610465
type: Tag

http://stackoverflow.com/comment/39977509
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25593888
type: QuestionComment
has text: If i do "Project -> Clean" the redlines under the classnames disappear for 2-3 seconds, but the they are back again.

http://stackoverflow.com/a/25634601
upvote count: 6
has comment: http://stackoverflow.com/comment/136928820
downvote count: 0
answers question: http://stackoverflow.com/q/25634542
score: 6
has comment: http://stackoverflow.com/comment/111158313
type: Answer
has body: A non-static inner class cannot be instantiated without an instance of its parent class. new NewTest().new one() The call above will successfully instantiate a one. Your two is being instantiated without an outer instance, because of the static modifier. It is a static nested class. See the difference between static nested classes and inner classes: http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html

http://stackoverflow.com/a/73397495
type: Answer
has body: My 100% score solution with one line code in python: def solution(A, B, K): # write your code in Python 3.6 return int(B/K) - int(A/K) + (A%K==0) pass
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25661519
score: 1

http://stackoverflow.com/a/25682779
has body: The way to tackle this is to define the transformation rules in XSLT. You need one rule that copies things unchanged, by default: &lt;xsl:template match="*|@*"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="*|@*"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; and then you need further rules to define the changes you want to make: &lt;xsl:template match="@OrderNo"&gt; &lt;xsl:attribute name="OrderName"&gt;&lt;xsl:value-of select="."/&gt;&lt;/xsl:attribute&gt; &lt;/xsl:template&gt; and similarly for the other renaming rules, plus &lt;xsl:template match="OrderLines"&gt; &lt;OrderLines MaxOrderLines="{count(*)}"&gt; &lt;xsl:apply-templates select="*|@*"/&gt; &lt;/OrderLines&gt; &lt;/xsl:template&gt; Then, having assembled these rules into a stylesheet, you can run the transformation from your Java code, using code very similar to what you have already done: TransformerFactory tf = TransformerFactory.newInstance(); Templates t = tf.newTemplates(new StreamSource(new File("stylesheet.xsl"))); StringWriter writer = new StringWriter(); t.newTransformer().transform( new StreamSource(new File("input.xml")), new StreamResult(writer));
score: 2
has comment: http://stackoverflow.com/comment/41224872
answers question: http://stackoverflow.com/q/25678815
has comment: http://stackoverflow.com/comment/40160018
upvote count: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40141643
has comment: http://stackoverflow.com/comment/40160068

http://stackoverflow.com/a/25878911
has comment: http://stackoverflow.com/comment/40500480
type: Answer
score: 0
has body: On Oracle Linux 6 I had this error after yum install java-1.7.0-openjdk solution was to install the development package yum install java-1.7.0-openjdk-devel then meteor add-package android worked
answers question: http://stackoverflow.com/q/25695519

http://stackoverflow.com/comment/40167628
comment on: http://stackoverflow.com/a/25698178
type: Comment
score: 0
type: AnswerComment
has text: I use google app engine to run my project. My project has war folder. My project name is ContactsWithAjax. I don;t know how to deal with the context. Please Help.

http://stackoverflow.com/comment/40122260
type: Comment
type: AnswerComment
has text: Thanks for the answer but unfortunately I have tried this and it still does not work
comment on: http://stackoverflow.com/a/25673600
score: 0

http://stackoverflow.com/q/25699316
has comment: http://stackoverflow.com/comment/40169719
has comment: http://stackoverflow.com/comment/40169751
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/40169489
has comment: http://stackoverflow.com/comment/40169730
has comment: http://stackoverflow.com/comment/40258360
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/25700305
has comment: http://stackoverflow.com/comment/40169819
has comment: http://stackoverflow.com/comment/40169837
has comment: http://stackoverflow.com/comment/40170155
has body: I deployed my first Java web application a couple of days ago and realized a strange thing was happening. After a period of time all the dynamic content and functionality that relied on a connection to my database (testimonial submission, admin login) stopped working. It seems like this is happening every 24 hours or so. Every morning I realize it isn't working again. I solve the issue by going in to the Tomcat web application manager and clicking "reload" on the web app in question. Immediately the dynamic features of the website work again. My server is running Tomcat 7 and MySQL and the web app uses the JDBC driver to establish the connection to the database. I've made no alterations to Apache or Tomcat settings. I have other web apps written in PHP that work persistently without fault it just seems to be this Java web app that has this problem. What would cause this to happen and how can I make it so the web app doesn't need to be reloaded before it can establish a database connection again? EDIT: attached some code for database connection Database connection public class DBConnection { private static Connection conn; private static final Configuration conf = new Configuration(); private static final String dbDriver = conf.getDbDriver(); private static final String dbHostName = conf.getDbHostname(); private static final String dbDatabaseName = conf.getDbDatabaseName(); private static final String dbUsername = conf.getDbUsername(); private static final String dbPassword = conf.getDbPassword(); public Connection getConnection(){ try{ Class.forName(dbDriver); Connection conn = (Connection) DriverManager.getConnection(dbHostName + dbDatabaseName, dbUsername, dbPassword); return conn; } catch(Exception e){ e.printStackTrace(); } return conn; } public void disconnect(){ try{ conn.close(); } catch (Exception e){} } } Controller for login form: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String f…
has answer: http://stackoverflow.com/a/25700305
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40169435
has comment: http://stackoverflow.com/comment/40263083
possible better answer: http://stackoverflow.com/a/25699790
tagged with: mysql
has comment: http://stackoverflow.com/comment/40253239
has answer: http://stackoverflow.com/a/25699790
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40169621
has comment: http://stackoverflow.com/comment/40170366
type: AnsweredQuestion
has title: Database connection stops after period of time for no apparent reason

http://stackoverflow.com/a/25746991
answers question: http://stackoverflow.com/q/25597215
has body: This is the way it is done. The following sample code saves the details to a file upon clicking of the submit button: Submit = (Button) findViewById(R.id.btnSubmit); //Instantiates the button in the onCreate method Submit.setOnClickListener(new OnClickListener(){ //Called when the user clicks on the Submit button @Override public void onClick(View v) { // In this case the text to be written is the selected text in a radio button from radioGroup int Selection = AttendanceGroup.getCheckedRadioButtonId(); // find the radiobutton by returned id RadioButton radiobutton = (RadioButton) findViewById(Selection); // write on SD card file data in the text box try { //gets the current date since this is an attendance app. Calendar c = Calendar.getInstance(); //Formats the date a desired SimpleDateFormat date = new SimpleDateFormat("dd-MM-yy"); String getDate = date.format(c.getTime()); //writes the text to the file named attendance.txt which is created in the phone. File myFile = new File("/sdcard/Albanapp/Attendance.txt"); FileWriter fOut = new FileWriter(myFile, true); fOut.append(getDate + "\t" + getSelectedName.getSelectedItem().toString() + "\t" + radiobutton.getText().toString() + "\n"); fOut.flush(); fOut.close(); //Returns a statment to the user showing if the editing of the attendance.txt file was successful or not. Toast.makeText(getBaseContext(),"Status Saved", Toast.LENGTH_SHORT).show(); } catch (Exception e) { Toast.makeText(getBaseContext(), "Attendance cannot be saved", Toast.LENGTH_SHORT).show(); } } }); Hope this helps :)
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25597215
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40272917
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25588719
has title: how to edit a specific element in json file using gson
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has comment: http://stackoverflow.com/comment/39968056
has comment: http://stackoverflow.com/comment/39968475
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
has body: I am creating a pause resume mechanism for a download manager. I want to write amount of bytes read to a json file after every 5 sec (Auto saving mechanism). 1) So how can edit a specific element in json without rewriting whole json file. 2) Will that method be thread safe? Lets suppose I have a single json file and multiple threads would be updating different elements of that same json. So how this can be done in using gson. Do i need a producer consumer approach or some thing simple can be done?
score: 0

http://stackoverflow.com/q/25583410
type: Question
has comment: http://stackoverflow.com/comment/39961883
has title: How to draw Rectangle with arrow in java?
has body: How I can draw rectangle with arrow with paint event in java JApplet :) Something like FaceBook message:
has comment: http://stackoverflow.com/comment/39958710
score: -2
tagged with: java
possible better answer: http://stackoverflow.com/a/25583452
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25583452
downvote count: 4
answer count: 2
upvote count: 2
accepted answer: http://stackoverflow.com/a/25586864
tagged with: swing
has answer: http://stackoverflow.com/a/25586864
favorite count: 0

http://stackoverflow.com/q/25703811
favorite count: 0
has title: uploadify works on local but not on the server:"undefined" instead of browse button
tagged with: uploadify
score: 1
tagged with: java
tagged with: struts
type: Question
has body: I'm recently using uploadify 2.1.0 with Java(struts) and When I run the project on localhost server, everything seems perfect but when upload it on server(windows server 2008), the browse button goes and an "undefined" text showed instead.I tried to install updated Adobe Flash Player(v.14) on the server but nothing changed. here is initialization script: and usage of it:` Upload
has comment: http://stackoverflow.com/comment/40177621
has comment: http://stackoverflow.com/comment/40177983
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1
tagged with: jquery

http://stackoverflow.com/q/25694544
tagged with: text-editor
tagged with: textmate
tagged with: path
tagged with: java
has answer: http://stackoverflow.com/a/25695510
has title: Importing java classes text editor
tagged with: import
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40161098
has comment: http://stackoverflow.com/comment/40161238
type: UnansweredQuestion
answer count: 1
has body: Recently I started using a text editor (text mate) instead of eclipse to program in Java. I hava file1.java in a folder A(/Users/kevincastro/Documents/Code/estructuras/clases) and a file2.java in folder B(/Users/kevincastro/Documents/Code/estructuras/datastructures). I want to import file2.java to file1.java but it doesn't word. I've tried : import Users.kevincastro.Documents.Code.estructuras.datastructures.*; import datastructures.*; import Documents.Code.estructuras.datastructures.*; none of them work. I get this error "package Users.kevincastro.Documents.Code.estructuras.datastructures does not exist" Any help? Thanks
has comment: http://stackoverflow.com/comment/40161028

http://stackoverflow.com/comment/39998347
score: 0
comment on: http://stackoverflow.com/q/25605181
type: Comment
type: QuestionComment
has text: `good` and `bad` are very confusing names here, ones used above that are better.

http://stackoverflow.com/comment/39996549
type: AnswerComment
comment on: http://stackoverflow.com/a/25604089
score: 0
type: Comment
has text: Have you seen my project structure.There is 1 image inside Source _ ........main -........webapp -........ resources ...........adminlogin.jpeg I have done that I have added my static folder in <mvc:resources mapping> I have added in the code.

twitter-bootstrap
tags question: http://stackoverflow.com/q/25615834
tag name: twitter-bootstrap
type: Tag

http://stackoverflow.com/q/25650815
tagged with: java
tagged with: mapreduce
favorite count: 0
type: Question
tagged with: hadoop
upvote count: 2
tagged with: hbase
has answer: http://stackoverflow.com/a/25705838
accepted answer: http://stackoverflow.com/a/25705838
answer count: 1
downvote count: 0
has title: Phoenix is changing the meta-information of HBase tables
tagged with: apache-phoenix
has body: I'm trying to use Apache Phoenix to run SQL queries on HBase tables. Based on the official documetation, a schema need to be created for existing tables with the SQL query: CREATE TABLE TABLE_NAME (....) I tried to avoid this by directly connecting to an existing table (created with HBase API) through the phoenix API but I was getting exceptions. The thing is when Phoenix executes this query, it creates a lot of things on the table. For instance, in the tables section of the hbase dashboard, I can see the following meta-data added by phoenix to my table: 'QUOTES', {METHOD =&gt; 'table_att', coprocessor$1 =&gt; '|org.apache.phoenix.coprocessor.ScanRegionObserver|1|', coprocessor$2 =&gt; '|org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver|1|', coprocessor$3 =&gt; '|org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver|1|', coprocessor$4 =&gt; '|org.apache.phoenix.coprocessor.ServerCachingEndpointImpl|1|', coprocessor$5 =&gt; '|org.apache.phoenix.hbase.index.Indexer|1073741823|index.builder=org.apache.phoenix.index.PhoenixIndexBuilder,org.apache.hadoop.hbase.index.codec.class=org.apache.phoenix.index.PhoenixIndexCodec'}, {NAME =&gt; '0', DATA_BLOCK_ENCODING =&gt; 'FAST_DIFF', KEEP_DELETED_CELLS =&gt; 'true'} It sounds like pheonix is changing the meta information of the table (it creates some coprocessors and index builders), Is this gone create problems for production (interfer with code that uses HBase API)? if so how to avoid it?
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/25560732
has title: Multithreading doesn't work. What is incorrect?
has comment: http://stackoverflow.com/comment/39916079
has comment: http://stackoverflow.com/comment/39915890
type: Question
has comment: http://stackoverflow.com/comment/39915974
has comment: http://stackoverflow.com/comment/39916001
has comment: http://stackoverflow.com/comment/39915951
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39942602
has body: It's a little program written with a purpose of studying multithreading. I expected to get in main method different random numbers after run. About 4 numbers per second. But I got many thousands of zeros. Where is an error? Main Class: public class Main { public static void main(String[] args) { ExternalWorld externalWorld = new ExternalWorld(); externalWorld.start(); int x = 0; while (true) { while(!externalWorld.signal){ System.out.println("qqq");} System.out.println(++x + ") " + externalWorld.getAnInt()); } } } ExternalWorld Class: import java.util.Random; public class ExternalWorld extends Thread { private int anInt = 0; public boolean signal = false; @Override public void run() { Random random = new Random(100); while(true) { anInt = random.nextInt(100); signal = true; try { Thread.sleep(200); signal = false; Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } } } public int getAnInt() { if (!signal) { int p = 1 / 0; } int result = anInt; anInt = 0; return result; } }
has answer: http://stackoverflow.com/a/25560801
has comment: http://stackoverflow.com/comment/39915960
accepted answer: http://stackoverflow.com/a/25560801
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39915910

http://stackoverflow.com/comment/39994985
has text: No, I want the JTextBox to display a name say "Kat" and behind the scenes I want it to save the value "Katrina" some thing like in the J2EE TextField
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25603366
score: 0

http://stackoverflow.com/q/25554060
has answer: http://stackoverflow.com/a/25554193
accepted answer: http://stackoverflow.com/a/25554131
tagged with: swing
tagged with: jtextfield
type: Question
has title: 'void' type not allowed here - listener to a parameter
tagged with: java
tagged with: events
tagged with: panel
has answer: http://stackoverflow.com/a/25554131
type: AnsweredQuestion
score: 0
answer count: 2
has body: Why you can't add a listener to a object which is a parameter? panelThird.add(new JTextField( "Write here !" ).addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent e) { dlm.addElement(e.getActionCommand()); } }), BorderLayout.SOUTH);
possible better answer: http://stackoverflow.com/a/25554193

http://stackoverflow.com/comment/40010492
has text: I updated the question. It looks like one cannot define `Id`s as `String`s.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25610385

http://stackoverflow.com/a/25621336
has body: Try this for any random value and then change it to 5000 in your case: String line = reader.readLine(); for (int i = 0; i &lt; randomInt + 1; i++) { line = reader.readLine(); }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25621159
type: Answer
has comment: http://stackoverflow.com/comment/40028996
score: 0
answers question: http://stackoverflow.com/q/25621159
has comment: http://stackoverflow.com/comment/40029255

http://stackoverflow.com/q/25689429
has comment: http://stackoverflow.com/comment/40154443
has comment: http://stackoverflow.com/comment/40152284
score: 0
tagged with: apache-poi
answer count: 0
has body: I have a Color object of some color (Awt) I want to set background of excel with above color Lets say I have some color green, now my excel background should be green color. but hssfstyle.setFillForegroundColor(bgColor); method accept only short value as parameter. Is there anyway to get short value(index of color for excel style ) from Color object I am using HSSFCellStyle to set excel background.
has title: Set Excel style (background) based on color object
tagged with: java
has comment: http://stackoverflow.com/comment/40252650
type: Question
has comment: http://stackoverflow.com/comment/40151874
has comment: http://stackoverflow.com/comment/40152127
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11188840
has comment: http://stackoverflow.com/comment/40255436
tagged with: swing
linked to: http://stackoverflow.com/q/17655629
tagged with: excel

http://stackoverflow.com/q/25638500
favorite count: 0
type: Question
has title: How to deploy/upload a JSP file on Server
answer count: 5
has answer: http://stackoverflow.com/a/25638548
downvote count: 0
tagged with: jsp
upvote count: 1
tagged with: tomcat
has answer: http://stackoverflow.com/a/71735083
tagged with: servlets
has answer: http://stackoverflow.com/a/25638516
accepted answer: http://stackoverflow.com/a/25638614
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25638575
has answer: http://stackoverflow.com/a/25638614
score: 1
tagged with: java
has body: I have created a jsp file which will give an output in JSON format using java class and servlet, i am new to java and i don't have idea about the deployment of jsp file. Can anyone suggest me how to do it? I used to develop an asp.net web application in which there was a specific option available which called " publish project", but i cant find in eclipse. I already have a php server in which i have uploaded few php files, can i use the same server to upload this file? Currently, my application is running fine on localhost. Please help me with this matter and thank you for your time.
possible better answer: http://stackoverflow.com/a/25638516
tagged with: eclipse

http://stackoverflow.com/comment/65448326
score: 0
has text: Possible duplicate of [Fragment has target not in fragment Manager after rotation of screen with retained async task fragment](http://stackoverflow.com/questions/25710124/fragment-has-target-not-in-fragment-manager-after-rotation-of-screen-with-retain)
comment on: http://stackoverflow.com/q/25704155
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40112650
type: Comment
comment on: http://stackoverflow.com/a/25668170
type: AnswerComment
score: 2
has text: @Stewart Optimizers are getting smarter every day so that isn't much of an advantage. The real advantage of having `final` local variables is that you won't accidentally re-assign them, and you can refer to them in anonymous inner classes.

http://stackoverflow.com/comment/40161500
comment on: http://stackoverflow.com/a/25567749
type: Comment
score: 0
type: AnswerComment
has text: Thanks a lot for your feedback. Since a very good and illustrated answer as already been given I won't edit mine, but I take not for a future answer I could give!

http://stackoverflow.com/comment/40032323
type: AnswerComment
comment on: http://stackoverflow.com/a/25623008
has text: Nope. The maths says that the best-case probability is one in 2^32. It will eventually without anyone trying. But worse than that, unless you analyse the hash functions and the "space" of keys / values, you don't know if the probability isn't significantly larger than that. And nope, a probability of an incorrect answer of that order is NOT acceptable in many, many applications.
score: 3
type: Comment

http://stackoverflow.com/comment/39982312
type: QuestionComment
has text: http://publib.boulder.ibm.com/infocenter/cicstg/v7r1m0/index.jsp
comment on: http://stackoverflow.com/q/25596488
score: 0
type: Comment

http://stackoverflow.com/comment/40064705
has text: The file you're going to obtain is a string?
comment on: http://stackoverflow.com/q/25641721
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25618181
has answer: http://stackoverflow.com/a/36180585
score: 61
type: Question
accepted answer: http://stackoverflow.com/a/25618235
has answer: http://stackoverflow.com/a/25618235
answer count: 7
has answer: http://stackoverflow.com/a/35472951
has answer: http://stackoverflow.com/a/32204747
possible better answer: http://stackoverflow.com/a/25618400
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25618238
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25618400
has body: I have following code: public class MyClass{ ... } At same workspace I have following class public class AnotherClass{ @Autowired MyClass myClass; ... } If I click right mouse button on MyClass(first mentioned) and select "open call hierarchy" I don't see anything. How to find this usage in Eclipse?
tagged with: java
upvote count: 62
has answer: http://stackoverflow.com/a/53786458
has title: How to find usages using Eclipse IDE?
tagged with: eclipse

http://stackoverflow.com/comment/40058521
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25638196
has text: @twy009987 undo all what have you done before(like the way you added jar in different folder etc etc) and follow as per my answer.If it still did not solve then create a new project and try as per my answer
type: Comment

http://stackoverflow.com/comment/40011741
has text: It simply means that every element can be compared to every other, using some sort of "stable" compare function.
type: QuestionComment
comment on: http://stackoverflow.com/q/25612648
score: 0
type: Comment

http://stackoverflow.com/a/25595401
answers question: http://stackoverflow.com/q/25595348
has comment: http://stackoverflow.com/comment/39981797
has comment: http://stackoverflow.com/comment/39980563
has comment: http://stackoverflow.com/comment/39980501
score: 0
has comment: http://stackoverflow.com/comment/39980680
has comment: http://stackoverflow.com/comment/39980845
has comment: http://stackoverflow.com/comment/39980777
has body: With maven you can build your project using the Jacoco plugin and then you can configure Sonar to use the Jacoco report. I don't think there should be a difference between Linux and Windows, except on loading the Sonar web server. More information is @ http://www.sonarqube.org/measure-coverage-by-integration-tests-with-sonar-updated/
type: Answer

http://stackoverflow.com/q/25593672
tagged with: java
has title: Creating JSplitPane with 3 panels
upvote count: 6
accepted answer: http://stackoverflow.com/a/25593985
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25593985
downvote count: 0
answer count: 1
score: 6
has body: I would like to create a window, with 3 jPanels, separated by splitPane-s. The left, and the right one should be resizable by the user, and the one in the middle should fill the remaining space. I've created it, but if I move the first splitPane, then the second one is also moving. And I'm not sure, if I use the best method for what I want. import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSplitPane; public class MyWindow extends JFrame { public MyWindow() { this.setLayout(new BorderLayout()); JPanel leftPanel = new JPanel(); JPanel centerPanel = new JPanel(); JPanel centerPanel2 = new JPanel(); JPanel rightPanel = new JPanel(); JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, centerPanel); JSplitPane sp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centerPanel2, rightPanel); centerPanel.setLayout(new BorderLayout()); this.add(sp, BorderLayout.CENTER); centerPanel.add(sp2, BorderLayout.CENTER); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(500, 500); this.setVisible(true); } }
tagged with: swing
favorite count: 0
type: Question

http://stackoverflow.com/q/25596441
has answer: http://stackoverflow.com/a/25596643
has comment: http://stackoverflow.com/comment/39982164
has title: When I click the Button it doesn't work (Android)
has body: I am working in Eclipse, My app edit two integers and click the button so the app will show the average, but when i operate the app in my device, when i click the button it stop working and show message "application has been stopped" XML File : <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <requestFocus /> <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@+id/button1" android:layout_below="@+id/button1" android:layout_marginTop="72dp" /> </RelativeLayout> JAVA File : package com.example.mine; //import com.example.mine.R; 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.TextView; public class MainActivity extends Activity { EditText num1, num2; Button count; TextView text; String e1, e2; int q, i, r; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); count = (Button) findViewById(R.id.button1); num1 = (EditText) findViewById(R.id.editText1); num1 = (EditText) findViewById(R.id.editText2); text = (TextView) findViewById(R.id.text); count.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub e1 = num1.getText().toString(); e2 = num2.getText().toString(); q = Integer.parseInt(e1); i = Integer.parseInt(e2); r = (i + q) / 2; text.setText("the average is " + r); // text.se…
type: UnansweredQuestion
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/39982149
score: 0
tagged with: android
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/40061369
comment on: http://stackoverflow.com/a/25639881
score: 0
type: Comment
has text: You’re using raw types and suppress all the warnings, I think that is not what the OP wants.
type: AnswerComment

http://stackoverflow.com/q/25704527
type: Question
linked to: http://stackoverflow.com/q/15246157
has body: I am trying to setup a project with slf4j + log4j, but the damn thing just doesn't work... I keep getting exception: Failed to instantiate SLF4J LoggerFactory Reported exception: java.lang.NoClassDefFoundError: org/apache/log4j/Level at org.slf4j.LoggerFactory.bind(LoggerFactory.java:129) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288) at TestLog.main(TestLog.java:9) Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 6 more Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Level at org.slf4j.LoggerFactory.bind(LoggerFactory.java:129) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288) at TestLog.main(TestLog.java:9) Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:…
has comment: http://stackoverflow.com/comment/40223775
has comment: http://stackoverflow.com/comment/40179288
has answer: http://stackoverflow.com/a/65619854
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40185592
downvote count: 0
tagged with: maven
has answer: http://stackoverflow.com/a/25707623
has answer: http://stackoverflow.com/a/56174232
tagged with: logging
has answer: http://stackoverflow.com/a/25707969
tagged with: slf4j
has answer: http://stackoverflow.com/a/52014524
has comment: http://stackoverflow.com/comment/40183428
has comment: http://stackoverflow.com/comment/40225094
tagged with: java
score: 10
has comment: http://stackoverflow.com/comment/40219154
upvote count: 10
tagged with: log4j
has title: How to bind SLF4J with Log4J?
favorite count: 0

http://stackoverflow.com/q/25632491
has answer: http://stackoverflow.com/a/70737555
possible better answer: http://stackoverflow.com/a/70737555
type: AnsweredQuestion
has body: I have a Java application running on JBoss EAP 6 which I can "hit" from mobile app on chrome using urls like: 127.0.0.1:8280/myAwesomeJavaApp/coolService ... so when I package the app I am using urls like this 192.168.1.64:8280/myAwesomeJavaApp/coolService //this is not working 192.168.1.64 // this gets me to my localhost (connected to WiFi (testing purposes)) I can access all other Apache web apps in my localhost , but can't consume JBoss EAP 6 services. What am I missing ?
has answer: http://stackoverflow.com/a/25632738
downvote count: 0
accepted answer: http://stackoverflow.com/a/25632738
upvote count: 1
score: 1
tagged with: java
tagged with: jboss-eap-6
tagged with: jboss
favorite count: 0
type: Question
has title: Reach JBoss EAP 6 server in local network
answer count: 2
tagged with: network-programming
tagged with: mobile
linked to: http://stackoverflow.com/q/11357314

http://stackoverflow.com/comment/40146528
comment on: http://stackoverflow.com/a/25678434
score: 0
has text: Chaitanya, just if your are curious, there is *kind* of solution... I described as as another answer.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40132350
has text: What is wrong with calling the setter on all your realms? Its either that, or using shiro.ini.
comment on: http://stackoverflow.com/q/25675533
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25598086
favorite count: 0
score: 2
tagged with: java
type: Question
tagged with: google-drive-api
has title: How to disable Downloading of files from Google Drive from the API?
answer count: 0
upvote count: 2
type: UnansweredQuestion
downvote count: 0
has body: A feature we would like to implement for a service within my company is the creation of Docs directly to Google Drive from our application (which is a web-app that already uses Google APIs), with the option of disabling the "Download as ...", "Publish to the web" and "Email as attachment" of the created files. I know disabling download used to be available from the UI a while back and I was wondering if this option is available from the remote API (and possibly in the Java client as well). At the end of the day we want the files created by our service to be editable online in the Google docs client (We are talking simple spreadsheets and word docs) but we do not want our employees to download them to their personal machines. Thanks for any help and advice.

http://stackoverflow.com/q/25704542
has answer: http://stackoverflow.com/a/25706147
answer count: 2
type: UnansweredQuestion
tagged with: swing
has body: My Java Swing app performs a number of HTTP requests that, by nature, freeze the screen until response received and processed. I would like to show a wait cursor during this time, using: frame.setCursor(JFrame.WAIT_CURSOR); Unfortunately, this is not working as it is being executed on the UI Thread which will continue processing my HTTP requests. I'm aware that I should execute the lengthy tasks on a separate Swing Worker Thread, but, to keep my code simple (because in some cases my HTTP request can be interrupted to show a dialog that needs to be executed on the UI thread), I'm looking for a solution to "force" swing to update the mouse cursor before executing future code. Is there any way to achieve this?
has title: Java Swing force cursor appearance change on UI Thread
score: 0
linked to: http://stackoverflow.com/q/782265
tagged with: java
has answer: http://stackoverflow.com/a/25704595
type: Question
has comment: http://stackoverflow.com/comment/40179138

http://stackoverflow.com/comment/39906231
type: AnswerComment
comment on: http://stackoverflow.com/a/25554590
score: 0
has text: Makes sense. Thank you for the input ! One more follow up question. The lowest level threads. They are already running tasks in a loop, I just have to check for isInterrupted() before next loop iteration starts. did i get that right?
type: Comment

http://stackoverflow.com/comment/40038975
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25627273
type: QuestionComment
has text: You can't modify collection in situation when there is an iterator which is used for example to iterate through collection. A collection modification causes this iterator to be broken so that's why you get this exception. Using above form of for loop compiler creates for you an iterator. To solve this you should create the iterator for your own and used it to remove items.

http://stackoverflow.com/q/25584183
has answer: http://stackoverflow.com/a/25585381
answer count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/25584409
type: UnansweredQuestion
has body: Could you please help me to configure correctly Jackson mix-in annotation with Spring MVC to customize a JSON response. This is what I have now : I don't know how to configure it to map the 2 classes ... : addMixInAnnotations(User.class, UserMixIn.class);
tagged with: jackson
tagged with: spring
has title: Can't configure Jackson mix in
score: 0

http://stackoverflow.com/comment/39929380
comment on: http://stackoverflow.com/a/25567684
score: 1
type: Comment
type: AnswerComment
has text: I would store this in the user session and create a simple JSP that renders the call duration value that the servlet measured and put into the session.

http://stackoverflow.com/q/25666473
tagged with: maven
type: UnansweredQuestion
answer count: 1
tagged with: maven-3
tagged with: build
has answer: http://stackoverflow.com/a/25859489
tagged with: java
has title: Activate Maven profile if another profile is not activated
upvote count: 32
tagged with: maven-profiles
score: 32
linked to: http://stackoverflow.com/q/7344728
favorite count: 0
type: Question
has body: The question is related to Maven: Only activate profile A if profile B is not activated?, but it's more specific. If I type one of the following: mvn clean install -PspecificProfile mvn clean install -Dsmth -PspecificProfile mvn clean install -Dsmth -PspecificProfile,anotherProfile then I want to activate the specificProfile profile. (+the additional specified profiles) If I type anything else like: mvn install mvn clean install mvn clean install -Dsmth mvn clean install -Dsmth -PanotherProfile mvn clean install -Dsmth -PdefaultProfile mvn clean install -Dsmth -PdefaultProfile,anotherProfile then I want to activate the defaultProfile(+the additional specified profiles). Idea: if ( specific profile P is used via command line ) { activate P; } else { activate the default profile; } activate other specified profiles; Examples: mvn ... // default mvn ... -PspecificProfile // specificProfile (no default!) mvn ... -Px // default + x mvn ... -Px,y // default + x + y mvn ... -Px,specificProfile // x + specificProfile (no default!) mvn ... -Px,specificProfile,y // x + specificProfile + y (no default!) I tried to do something like this (in pom.xml): defaultProfile !x ... specificProfile <x>true</x> ... but it doesn't work.
downvote count: 0

http://stackoverflow.com/comment/40015165
comment on: http://stackoverflow.com/a/25614303
has text: It says `reset by peer: socket write error`. `RST` reset packets occur when a destination has received a packet for a closed socket. One of the two ends terminated the connection in an abnormal way or it was simply happening so fast (maybe on loopback) that this occurs mid-closing. I have seen this error often enough to know that all IOExceptions on `write()` should be handled as if the connection was closed.
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25596210
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40026652
has comment: http://stackoverflow.com/comment/40019584
has comment: http://stackoverflow.com/comment/40015220
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40014935
upvote count: 1
answers question: http://stackoverflow.com/q/25589027
has body: You need to add a custom settings.xml to your private repository, mount it and load the configuration from there. Otherwise you won't be able to access your (protected) artifacts. The documentation is pretty well hidden, but you can find it here: http://developer.cloudbees.com/bin/view/DEV/Accessing+under+an+external+Maven+repository
has comment: http://stackoverflow.com/comment/40015196
accepted answer of: http://stackoverflow.com/q/25589027
score: 1
has comment: http://stackoverflow.com/comment/40014885

http://stackoverflow.com/q/25602284
answer count: 1
has title: Convert NSData to Java String
linked to: http://stackoverflow.com/q/3774872
has comment: http://stackoverflow.com/comment/39992975
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25602528
has comment: http://stackoverflow.com/comment/39992858
type: UnansweredQuestion
tagged with: nsdata
score: 0
has comment: http://stackoverflow.com/comment/39992801
tagged with: arrays
tagged with: ios
has body: I'm developing an iOS app which make use of a web service written in java. The app make a POST request to this web server sending an NSData object, created from a JSON, which is for example: &lt;7b22636c 69656e74 223a7b22 656e7669 726f6e6d 656e7422 3a227361 6e64626f 78222c22 70726f64 7563745f 6e616d65 223a2250 61795061 6c20694f 53205344 4b222c22 70617970 616c5f73 646b5f76 65727369 6f6e223a 22322e32 2e31222c 22706c61 74666f72 6d223a22 694f5322 7d2c2272 6573706f 6e73655f 74797065 223a2270 61796d65 6e74222c 22726573 706f6e73 65223a7b 22696422 3a225041 592d3233 44393230 32375545 36383337 3034304b 51434337 5859222c 22737461 7465223a 22617070 726f7665 64222c22 63726561 74655f74 696d6522 3a223230 31342d30 392d3031 5430383a 33353a34 335a222c 22696e74 656e7422 3a227361 6c65227d 7d&gt; so in my servlet I do String req = request.getParameter("data"); but obviously when I try to print it I get the bytes above. How can I convert such data into the initial JSON? EDIT 1: I send an NSData in this way NSData *confirmation = [NSJSONSerialization dataWithJSONObject:completedPayment.confirmation options:0 error:nil]; NSURL *url = [NSURL URLWithString:@"MY_WS"]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url]; NSString *messageBody = [NSString stringWithFormat:@"data=%@", confirmation]; [theRequest setHTTPMethod:@"POST"]; [theRequest setHTTPBody:[messageBody dataUsingEncoding:NSUTF8StringEncoding]]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; I think I cannot send the JSON string directly...

http://stackoverflow.com/q/25613246
tagged with: tomcat
has body: I am trying to set up Jersey with JAX-RS for my RESTful web application but I am overwhelmed by the amount of options. I'm currently working in Eclipse and deploying to an Apache Tomcat 7 server. I'm using Maven to manage the project dependencies. I am also very new at this. The Jersey options are very vague in their descriptions and I'm wondering if someone who has been here before can advise me on which dependency/package I need. Jersey-Maven Page: https://jersey.java.net/documentation/latest/modules-and-dependencies.html
tagged with: java
has answer: http://stackoverflow.com/a/25613287
tagged with: eclipse
type: Question
score: 0
tagged with: jersey
type: UnansweredQuestion
answer count: 1
tagged with: maven
has title: Which Jersey dependency should I use?

http://stackoverflow.com/comment/40043428
score: 0
has text: [Read this doc](http://developer.android.com/guide/topics/manifest/provider-element.html)
type: AnswerComment
comment on: http://stackoverflow.com/a/25629797
type: Comment

http://stackoverflow.com/a/25746587
type: AcceptedAnswer
downvote count: 0
upvote count: 24
has comment: http://stackoverflow.com/comment/40336779
has body: TL;DR: this has been addressed with JDK-11; at the end of the answer is an example of JDK-11’s javac output for comparison. The fact that every throwable is an instance of java.lang.Throwable is implied at various places of the Java byte code/ JVM. Even if handlers for any were meant to represent something possibly outside the Throwable type hierarchy, that idea fails as today’s class files must have a StackMapTable for methods containing exception handlers and that StackMapTable will refer to the any throwable as an instance of java.lang.Throwable1. Even with the old type inferring verifier, a handler which re-throws a throwable implicitly contains the assertion that any throwable is an instance of java.lang.Throwable as that’s the only object athrow is allowed to throw. http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.athrow The objectref must be of type reference and must refer to an object that is an instance of class Throwable or of a subclass of Throwable. Short answer: no, it is impossible to have a situation where something other than an instance of java.lang.Throwable (or a subclass) can be thrown or caught. I tried to create a minimal example of a try-with-resource statement to analyse the output of javac. The result clearly shows that the structure is an artifact of how javac works internally but can’t be intentional. The example looks like this: public static void tryWithAuto() throws Exception { try (AutoCloseable c=dummy()) { bar(); } } private static AutoCloseable dummy() { return null; } private static void bar() { } (I compiled with jdk1.8.0_20) I put the exception handler table at the beginning of the resulting byte code so it’s easier to refer to the location while looking at the instruction sequence: Exception table: from to target type 17 23 26 Class java/lang/Throwable 6 9 44 Class java/lang/Throwable 6 9 49 any 58 64 67 Class java/lang/Throwable 44 50 49 any Now to the instructions: The beginning is straightforward, two l…
type: Answer
score: 24
accepted answer of: http://stackoverflow.com/q/25615417
has comment: http://stackoverflow.com/comment/87467678
answers question: http://stackoverflow.com/q/25615417

http://stackoverflow.com/q/25633231
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40050273
accepted answer: http://stackoverflow.com/a/25633509
type: Question
has answer: http://stackoverflow.com/a/25633509
has comment: http://stackoverflow.com/comment/40050041
has comment: http://stackoverflow.com/comment/40050047
has comment: http://stackoverflow.com/comment/40050228
has title: Connecting to remote activemq instance running on docker container
tagged with: docker
has comment: http://stackoverflow.com/comment/40049971
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/40050058
upvote count: 2
tagged with: activemq-classic
has body: I have 2 docker containers, one running a spring app (in tomcat) and one running an active mq instance. When I try to connect to it from my spring app, I get the following error. Only activeMQ is running on the one container and the port is properly exposed. I verified the IP address of the docker container (shown below) and that is correct. I'm not sure what could be causing this error at this point. Any thoughts would be appreciated. ERROR [activemq.broker.BrokerService] Failed to start Apache ActiveMQ ([mybroker, ID:489af431756c-60313-1409695404227-0:1], java.io.IOException: Transport Connector could not be registered in JMX: Failed to bind to server socket: tcp://172.17.0.2:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600 due to: java.net.BindException: Cannot assign requested address)
tagged with: java
has comment: http://stackoverflow.com/comment/40050361

http://stackoverflow.com/comment/66142819
has text: Hi Attila, thanks for the clarification. I have one more corner case about the overloading resolution from Nashorn, which you may be interested. It's about the overloading. Whenever there's overloading of a field instance and a method without parameters, the [] operator returns the method reference. I have described the issue properly at the following: http://stackoverflow.com/questions/9960560/java-instance-variable-and-method-having-same-name/39391819#39391819 http://stackoverflow.com/questions/9960560/java-instance-variable-and-method-having-same-name/39391819#39391819
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25610856
type: Comment

http://stackoverflow.com/a/25581578
upvote count: 1
answers question: http://stackoverflow.com/q/25581221
type: Answer
has comment: http://stackoverflow.com/comment/39956037
has comment: http://stackoverflow.com/comment/39957719
score: 1
downvote count: 0
has body: The two approaches that you have given are basically identical. Your timings are being thrown off primarily because the JVM has not warmed up; hotspot does not kick in until a method or loop has been repeated over 10,000 times. After that many repetitions you can often also have GC kicking in adhoc, as well as OS processes in the mix too. To address some of these problems in a benchmark, warm up each method over 10k times and repeat several times. For OS noise, be sure to shutdown as many other apps and processes as you can and make sure that the machine is running idle. The OS can of course be tuned too, but lets leave that as off topic for now. Below is some example code that will give you an idea, I have also added two more ways to optimise the loop; just for fun ;) I include the timings that I got towards the bottom. The things to note are the two approaches that you included start off varying, but normalise to being about the same pretty quickly the cost of your code is being dwarfed by calls to System.out; in otherwords the io itself. to demonstrate that I have given two other alternatives, one that makes more calls to System.out and another that makes less. estimatedTime1: 17.27938 ms estimatedTime2: 17.45852 ms estimatedTime3: 100.61994 ms estimatedTime4: 9.553329999999999 ms public class Foo { public static void main( String[] args ) throws Exception { time1(); time2(); time3(); time4(); time1(); time2(); time3(); time4(); time1(); time2(); time3(); time4(); } private static final int REPEAT = 100; private static void time1() { long startTime1 = System.nanoTime(); for ( int i=0; i&lt;REPEAT; i++ ) { repeatPrint1(); } long estimatedTime1 = System.nanoTime() - startTime1; double dur = estimatedTime1/1000000.0/REPEAT; System.out.println( "estimatedTime1: " + dur ); } private static void time2() { long startTime1 = System.nanoTime(); for ( int i=0; i&lt;REPEAT; i++ ) { repeatPrint2(); } long estimatedTime1 = System.nanoTime() - startTime1; double dur = estimate…

http://stackoverflow.com/comment/40173085
type: Comment
score: 1
type: QuestionComment
has text: geometrically a circle is emphatically **not** just a "a point but bigger". A point has zero dimensions, a circle has two. Your problem is somewhat similar to the ray-tracing "ray-sphere intersection" test where the polygon edges are akin to rays - try looking at that.
comment on: http://stackoverflow.com/q/25701346

http://stackoverflow.com/q/25690830
score: 0
answer count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/25690892
has answer: http://stackoverflow.com/a/25690956
accepted answer: http://stackoverflow.com/a/25690972
upvote count: 1
has answer: http://stackoverflow.com/a/25690972
downvote count: 1
favorite count: 0
has body: I have some code that reads xml from the web and I captured title and description from that as NodeLists: DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse("http://services.explorecalifornia.org/rss/tours.php"); NodeList titleNode = doc.getElementsByTagName("title"); NodeList summaryNode = doc.getElementsByTagName("description"); I want to loop through both of them and get output like Title Description Title Descripton I can't get my head around if this is possible with loop as I used nested loop it loop the inner loop for each outer loop any suggestion for any other kinds of loop Here's an example of the XML: (from http://services.explorecalifornia.org/rss/tours.php ) <?xml version="1.0"?> Explore California Tours Explore Our World Your Way http://www.explorecalifornia.org Copyright (c) 2011 lynda.com 2 Days Adrift the Salton Sea http://www.explorecalifornia.org/tour.php?id=14 The Salton Sea is saltier than the Pacific, an unusual feat for inland body of water. And even though its salinity has risen over the years, due in part to lack of outflows and pollution from agricultural runoff, it has attracted a small, but dedicated population. The sea itself offers recreational opportunities including boating, camping, off-roading, hiking, use of personal watercraft, photography and bird watching. The sea has been termed a "crown jewel of avian biodiversity," being a major resting stop on the Pacific Flyway, a migratory path for birds. 2 Days Adrift the Salton Sea includes two nights accommodations at the Bombay Beach Inn, boat rental at the Salton City Harbor, and a guided fishing tour. From Desert to Sea A Week of Wine http://www.explorecalifornia.org/tour.php?id=26 Immerse yourself in the culture and lifestyle of a California winery. Spend 5 days in your private guest villa at the Stockbridge Winery, located in scenic Sonoma. You'll spend your days wandering the vi…
tagged with: http://stackoverflow.com/tag/xml
type: Question
has answer: http://stackoverflow.com/a/25690892
type: AnsweredQuestion
has title: What kind of loop works for outputting title and description from xml

compiler-warnings
tags question: http://stackoverflow.com/q/25602014
type: Tag
tag name: compiler-warnings

http://stackoverflow.com/a/25593172
has comment: http://stackoverflow.com/comment/39976943
type: Answer
answers question: http://stackoverflow.com/q/25593074
has body: Characters are, in fact, numbers. Computer transforms a char into an integer using a character set (charset). Charsets are tables which bind specified character to the specified integer, so your computer can transform it to binary and store it in memory. Later when needed, that number can get transformed back to character. Your compiler uses Unicode (a superset of ASCII, thanks Tom Blodget), so character '2' is actually decimal integer 50 (more info: http://unicode-table.com/en/, note that table uses hex numbers, so hex 32 is decimal 50). Since addition by default returns an integer, the character gets transformed and added, but never actually transformed back to its original form. As for why it gives in error, it's probably because Java differs between types and your compiler (or whatever's throwing the error) is more strict. Don't take my word for that, you should probably look in the standard and your implementation. In C for example, that addition would always succeed. Hope it clears things up a bit.
score: 0
has comment: http://stackoverflow.com/comment/39976806

http://stackoverflow.com/q/25695168
answer count: 1
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/25695175
type: Question
has title: Java: while loop doesn't return
type: UnansweredQuestion
has body: New to Java, taking college course. I am writing a program that asks users for their internet package so it can calculate their bill. Here's the snippet where I ask for their package, and have to confirm that they have answered either A, B, or C. For some reason, it enters the while loop even if I enter "a".. //Create Keyboard scanner Scanner keyboard = new Scanner(System.in); //Get user package String servicePackage; System.out.println("Enter your internet package: A, B, or C"); servicePackage = keyboard.nextLine(); servicePackage = servicePackage.toUpperCase(); System.out.println(servicePackage);//This line is for debugging //Validate User Package Input while (servicePackage != "A" &amp;&amp; servicePackage != "B" &amp;&amp; servicePackage != "C"){ System.out.println("Please enter a valid internet package (A, B or C)"); servicePackage = keyboard.nextLine(); servicePackage = servicePackage.toUpperCase(); System.out.println(servicePackage);//for debugging } System.out.println(servicePackage);//for debugging Not sure if it's relevant, but I am using jGrasp. Any help is appreciated!
score: 0
tagged with: while-loop
linked to: http://stackoverflow.com/q/513832
tagged with: java

http://stackoverflow.com/a/25607823
accepted answer of: http://stackoverflow.com/q/25607518
has comment: http://stackoverflow.com/comment/40037931
type: AcceptedAnswer
downvote count: 0
has body: Your path is not correct. If you have a correct path and still get an error then is a mapping error. But in this situation you have 404 error which means that path doesn't exist. Change your path to : @Path("/test/rest/TestResultService/insertTestResult/") Then if you have an error again you have to register your path to mapping conf.
score: 14
upvote count: 14
answers question: http://stackoverflow.com/q/25607518
type: Answer

http://stackoverflow.com/a/25645857
has comment: http://stackoverflow.com/comment/40075290
score: 1
has comment: http://stackoverflow.com/comment/40079683
type: Answer
has comment: http://stackoverflow.com/comment/40072715
answers question: http://stackoverflow.com/q/25645462
has comment: http://stackoverflow.com/comment/40073051
has comment: http://stackoverflow.com/comment/40072278
has body: The implementation of your interface is not present or is not at the correct version. Update the implementation version where it has that method implemented.
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40072661
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41011083
has comment: http://stackoverflow.com/comment/40072142
has comment: http://stackoverflow.com/comment/40074339
has comment: http://stackoverflow.com/comment/40072355
has comment: http://stackoverflow.com/comment/40072020
has comment: http://stackoverflow.com/comment/41010399
accepted answer of: http://stackoverflow.com/q/25645462
has comment: http://stackoverflow.com/comment/40075352

jca
tag name: jca
type: Tag
tags question: http://stackoverflow.com/q/25617615

inheritance
tags question: http://stackoverflow.com/q/25692256
tags question: http://stackoverflow.com/q/25552730
tags question: http://stackoverflow.com/q/25692811
tags question: http://stackoverflow.com/q/25588310
tags question: http://stackoverflow.com/q/25675080
tags question: http://stackoverflow.com/q/25611049
tags question: http://stackoverflow.com/q/25642005
tags question: http://stackoverflow.com/q/25711828
tags question: http://stackoverflow.com/q/25627520
tag name: inheritance
tags question: http://stackoverflow.com/q/25618184
tags question: http://stackoverflow.com/q/25697629
tags question: http://stackoverflow.com/q/25659395
tags question: http://stackoverflow.com/q/25679129
tags question: http://stackoverflow.com/q/25570889
tags question: http://stackoverflow.com/q/25656094
tags question: http://stackoverflow.com/q/25632057
tags question: http://stackoverflow.com/q/25696612
tags question: http://stackoverflow.com/q/25624672
type: Tag
tags question: http://stackoverflow.com/q/25574354
tags question: http://stackoverflow.com/q/25573174
tags question: http://stackoverflow.com/q/25710107
tags question: http://stackoverflow.com/q/25685105
tags question: http://stackoverflow.com/q/25675474

http://stackoverflow.com/q/25565020
tagged with: groovy
answer count: 3
has comment: http://stackoverflow.com/comment/39928343
tagged with: java
linked to: http://stackoverflow.com/q/18842109
downvote count: 0
accepted answer: http://stackoverflow.com/a/25567047
has title: Is Java Lambda expression is similar logic of Groovy closure?
has body: I'm learning about Java 8 new feature Lambda expressions. This is my "HelloWorld" class using Lambda expression public class LambdaHelloWorld { interface HelloWorld { String sayHello(String name); } public static void main(String[] args) { HelloWorld helloWorld = (String name) -> { return "Hello " + name; }; System.out.println(helloWorld.sayHello("John Doe")); } } This style is so similar to Groovy closure. This is groovy "HelloWorld" def sayHello(name) { println("Hello $name!") } def clos = {name -> sayHello(name)} clos.call('John Doe') I think these two codes are less difference between each others.Is Java Lambda expression is similar logic or style of Groovy closure?
score: 19
favorite count: 0
has answer: http://stackoverflow.com/a/25567047
type: Question
has comment: http://stackoverflow.com/comment/39924686
possible better answer: http://stackoverflow.com/a/25565185
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/25565185
has answer: http://stackoverflow.com/a/61733272
type: AnsweredQuestion
upvote count: 19

josephus
tags question: http://stackoverflow.com/q/25676019
type: Tag
tag name: josephus
tags question: http://stackoverflow.com/q/25675138

http://stackoverflow.com/comment/39907228
score: 1
has text: I put my answer into your question, since you were obviously misunderstood.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25555930

http://stackoverflow.com/q/25587675
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25587843
accepted answer: http://stackoverflow.com/a/25587720
has answer: http://stackoverflow.com/a/25587716
has title: Average Word Length
has answer: http://stackoverflow.com/a/25587720
has answer: http://stackoverflow.com/a/25587702
upvote count: 1
answer count: 4
type: AnsweredQuestion
tagged with: printing
has body: I am attempting to calculate the average word length of user input in Java in a very simplistic way. The actual "math" of the code I've already completed, and it seems to be working quite well, but there are some odd house keeping things I need to address in order to complete the code. So far, I have the following: public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Please type some words, then press enter: "); int count = 0; double sum = 0; while (sc.hasNext()) { String userInput = sc.next(); double charNum = userInput.length(); sum = charNum + sum; count++; double average = 0; if (count &gt; 0) { average = sum / count; } System.out.println("Average word length = " + average); } } } The end result output should look like this: run: Please type some words, then press enter: this is a test Average word length = 2.75 BUILD SUCCESSFUL (total time: 10 seconds) However, the output is looking like this: run: Please type some words, then press enter: this is a test Average word length = 4.0 Average word length = 3.0 Average word length = 2.3333333333333335 Average word length = 2.75 Based on the code that I've written, how can I change it so that: The "average word length" is only printed one final time. The program ends after the user presses enter Thank you for any suggestions.
tagged with: while-loop
score: 1
tagged with: java
downvote count: 0
tagged with: loops
possible better answer: http://stackoverflow.com/a/25587843
tagged with: enter

http://stackoverflow.com/a/25663359
has comment: http://stackoverflow.com/comment/40107883
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25652982
type: AcceptedAnswer
score: 6
answers question: http://stackoverflow.com/q/25652982
has comment: http://stackoverflow.com/comment/40107803
upvote count: 6
type: Answer
has body: The task you want to achieve is quite different from what grouping does. groupingBy does not rely on the order of the Stream’s elements but on the Map’s algorithm applied to the classifier Function’s result. What you want is to fold adjacent items having a common property value into one List item. It is not even necessary to have the Stream sorted by that property as long as you can guaranty that all items having the same property value are clustered. Maybe it is possible to formulate this task as a reduction but to me the resulting structure looks too complicated. So, unless direct support for this feature gets added to the Streams, an iterator based approach looks most pragmatic to me: class Folding&lt;T,G&gt; implements Spliterator&lt;Map.Entry&lt;G,List&lt;T&gt;&gt;&gt; { static &lt;T,G&gt; Stream&lt;Map.Entry&lt;G,List&lt;T&gt;&gt;&gt; foldBy( Stream&lt;? extends T&gt; s, Function&lt;? super T, ? extends G&gt; f) { return StreamSupport.stream(new Folding&lt;&gt;(s.spliterator(), f), false); } private final Spliterator&lt;? extends T&gt; source; private final Function&lt;? super T, ? extends G&gt; pf; private final Consumer&lt;T&gt; c=this::addItem; private List&lt;T&gt; pending, result; private G pendingGroup, resultGroup; Folding(Spliterator&lt;? extends T&gt; s, Function&lt;? super T, ? extends G&gt; f) { source=s; pf=f; } private void addItem(T item) { G group=pf.apply(item); if(pending==null) pending=new ArrayList&lt;&gt;(); else if(!pending.isEmpty()) { if(!Objects.equals(group, pendingGroup)) { if(pending.size()==1) result=Collections.singletonList(pending.remove(0)); else { result=pending; pending=new ArrayList&lt;&gt;(); } resultGroup=pendingGroup; } } pendingGroup=group; pending.add(item); } public boolean tryAdvance(Consumer&lt;? super Map.Entry&lt;G, List&lt;T&gt;&gt;&gt; action) { while(source.tryAdvance(c)) { if(result!=null) { action.accept(entry(resultGroup, result)); result=null; return true; } } if(pending!=null) { action.accept(entry(pendingGr…

http://stackoverflow.com/comment/40187416
type: AnswerComment
comment on: http://stackoverflow.com/a/25708597
score: 0
type: Comment
has text: Therefore you Need the Facebook app package Name which is com.facebook.katana. I will edit my answer with the new code.

http://stackoverflow.com/comment/40303224
type: Comment
has text: @Mark, thanks, If i put D:\user\softwares\phantomjs-1.9.7-windows\phantomjs-1.9.7-windows in path(windows env variable), the error is resolved but getting "Failed rendering: SyntaxError: Unable to parse JSON string" on the browser, there is no error on server console. when i export JPEG,PNG, it redirects to "http://127.0.0.1:7777/highcharts-export"
comment on: http://stackoverflow.com/a/25703937
score: 0
type: AnswerComment

http://stackoverflow.com/a/25711940
has comment: http://stackoverflow.com/comment/40193319
downvote count: 0
answers question: http://stackoverflow.com/q/25710883
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/40206404
has body: What you have encountered has to do with what Java EE is and what it not is: Java EE is optimized for handling many concurrent, short-lived requests, each of which (usually) handle a single transaction. The containers do that very well, particularly with stateless beans, but also with stateful beans (cluster replication etc). As such, Java EE might be well-suited to process the requests coming from your HTML5/JS clients and feed the requests to the messaging infrastructure. Java EE is not, however, designed for long running, thread-blocking background processes like yours. FWIW: Another issue that you have not yet encountered is, even if you could get that one fixed: Next you'll encounter the transaction timeout on your @PostConstruct method. I think you are better of with moving the game engine out of the Java EE stack. You already mentioned you plan to use HornetQ - then why not put the game engine in a simple standalone application that receives messages from HornetQ and feeds replies back into HornetQ. Another option might be a dedicated Java game server engine, see, e.g., this question and its accepted answer on programmers.stackoverflow.com. (Update: it seems the "RedDwarf Server" project mentioned in that answer was discontinued 3 years ago). If you absolutely want to use the Java EE environment, I suggest you use a TimerService instead. Note, however, that this also requires that your game loop calculation is quick and guaranteed to finish until the next timeout is scheduled, otherwise the container will skip the scheduled invocation (with a "still running" message or similar). Finally, let me mention that if I were to start a new game server today, I would definitely take a look at Akka, Node.js or similar projects that support "reactive" programming.
accepted answer of: http://stackoverflow.com/q/25710883
upvote count: 2
score: 2

http://stackoverflow.com/q/25694872
has comment: http://stackoverflow.com/comment/40161705
upvote count: 2
has comment: http://stackoverflow.com/comment/40161774
has body: Edit: Sorry about posting here instead of the codegolf stackexchange, didn't heard of that before. Anyway thanks for the answers! Okey, we all know the normal way to throw a NullPointerException in Java: throw new NullPointerException(); // 33 characters But I am searching for shorter (as in less characters) ways to do so. The shortest I could get was ((Void)null).toString(); // 24 characters How can we produce a java.lang.NullPointerException with even less code and without imports? There must be a way!
downvote count: 2
has comment: http://stackoverflow.com/comment/40161729
answer count: 1
accepted answer: http://stackoverflow.com/a/25694989
has comment: http://stackoverflow.com/comment/40163119
has answer: http://stackoverflow.com/a/25694989
favorite count: 0
has comment: http://stackoverflow.com/comment/40161640
type: Question
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/40161717
has comment: http://stackoverflow.com/comment/40161602
has comment: http://stackoverflow.com/comment/40161737
tagged with: java
has comment: http://stackoverflow.com/comment/40161603
has comment: http://stackoverflow.com/comment/40162852
linked to: http://stackoverflow.com/q/17576922
has comment: http://stackoverflow.com/comment/40176350
tagged with: optimization
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40161681
has title: Shortest code to throw a NullPointerException?

http://stackoverflow.com/a/25660974
type: Answer
has comment: http://stackoverflow.com/comment/40099940
has comment: http://stackoverflow.com/comment/40099868
score: 0
has body: The following should work: public int getRandomNumber(int digits) { assert digits &gt; 0; //added because of comment BigInteger tenPower = new BigInteger("10"); return new Random().nextInt((tenPower.pow(digits).subtract(tenPower.pow(digits-1))).intValue()) + tenPower.pow(digits-1).intValue(); } Output: Digits: 1 - Random nextInt Param: 9 - Adding: 1 Random number: 1 Digits: 2 - Random nextInt Param: 90 - Adding: 10 Random number: 66 Digits: 3 - Random nextInt Param: 900 - Adding: 100 Random number: 377 Digits: 4 - Random nextInt Param: 9000 - Adding: 1000 Random number: 1734 Digits: 5 - Random nextInt Param: 90000 - Adding: 10000 Random number: 96602 So it creates the numbers like this: 1...9 10...99 100...999 1000...9999 10000...99999
has comment: http://stackoverflow.com/comment/40099815
answers question: http://stackoverflow.com/q/25660804

http://stackoverflow.com/q/25691914
tagged with: jbutton
has body: I'm quite new to the whole GUI scene of Java but I decided to give it a try. I have a project in NetBeans and I am using their little auto generator thing and was wondering if you can have multiple even listeners on one button? Right now I have it so when you click it changes the button to a certain color and I was wondering if you can make it so when you click it again, it changes the color back to the default color? This is what my button looks like right now private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { jButton1.setBackground(Color.black); jButton1.setForeground(Color.yellow); } I have an idea of how it would look but I can't really get it to work. I know you have to set it back to the regular color like this. jButton1.setBackground(null); Any help is appreciated!
type: AnsweredQuestion
has title: jFrame multiple event listeners on one button
tagged with: actionlistener
has answer: http://stackoverflow.com/a/25691944
tagged with: java
accepted answer: http://stackoverflow.com/a/25691944
type: Question
tagged with: netbeans
score: 0
answer count: 1
tagged with: swing

http://stackoverflow.com/q/25712364
has body: I am a seasoned java developer I feel I am quite good in java programming. Unfortunately I could not make why we need java plug in for browser. I know it is not mandatory to have this plug in. My findings. here It is advised to disable java plugin. Question ? why we need java plug in browsers. I know applet runs in browser apart form applet what are the use cases of java plug in ? Clarification: I am not using the applet. I am interested in other use cases of java plug in browser. Thanks
answer count: 1
tagged with: applet
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40202364
score: -2
has answer: http://stackoverflow.com/a/25717353
has comment: http://stackoverflow.com/comment/40202659
has comment: http://stackoverflow.com/comment/40202472
tagged with: browser
upvote count: 0
downvote count: 2
has title: why browser needs java plug in?
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/40082827
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25634745
score: 0
has text: It doesn't help. My application run on `http://localhost:8080/spring-hibernate4/` so when I set I'm forwarded to `http://localhost:8080/uploadOneFile` I tried to set but I'm getting the same error HTTP Status 405 - Request method 'POST' not supported

http://stackoverflow.com/comment/40129202
has text: Try to look at http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#useDelimiter(java.lang.String)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25677384
type: QuestionComment

http://stackoverflow.com/comment/112438825
type: Comment
type: AnswerComment
score: 1
has text: does this be added in broadcast receiver? it does register the callback, so I am confused.
comment on: http://stackoverflow.com/a/58468010

http://stackoverflow.com/q/25690525
has comment: http://stackoverflow.com/comment/40153072
has comment: http://stackoverflow.com/comment/40153050
has comment: http://stackoverflow.com/comment/40153021
type: Question
upvote count: 0
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/25691212
downvote count: 5
has comment: http://stackoverflow.com/comment/40153109
favorite count: 0
score: -5
has body: The question is: Create a new project called EvenOrOdd containing a class called Tester. In the main Method of Tester print a prompt that says, "Enter an integer:" Input the user's response from the keyboard, test the integer to see if it is even or odd (use the modulus operator % to do this), and then print the results as show below (Several runs are shown) Enter an integer: 28 The integer 28 is even. Enter an integer: 2049 The integer 2049 is odd. Enter an integer: -236 The integer 236 is even. The code that I wrote it is correct to the question? Here is the code: import java.util.*; public class HelloWorld{ Scanner kbReader =new(System.in) System.out.println("Enter an integer:"); int kbReader.nextInt( ); int inputNum; if(inputNum != 0 || inputNum != 1) { inputNum = inputNum -1; } else { if(inputNum == 0) { System.out.println("Even."); } else if(inputNum == 1) { System.out.println("Odd."); } }
tagged with: java
has title: My Java code for my project is not compiling, I don't see the error

http://stackoverflow.com/q/25624977
possible better answer: http://stackoverflow.com/a/25630654
favorite count: 0
type: Question
has title: How to save Quartz executed jobs?
score: 3
has body: One problem, after executed jobs, quartz delete jobs from database qrtz_triggers table, but in specific situation needed to repeat job which is failed. Is any configuration options or way to store jobs to another table after execute??? Thanks
has answer: http://stackoverflow.com/a/25637392
accepted answer: http://stackoverflow.com/a/25637392
tagged with: jboss
has answer: http://stackoverflow.com/a/25630654
type: AnsweredQuestion
upvote count: 3
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40043708
tagged with: java
tagged with: quartz-scheduler

http://stackoverflow.com/q/25641896
has title: Getting NullPointerException when passing the current activity to a class
type: Question
has answer: http://stackoverflow.com/a/25642027
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40065100
has comment: http://stackoverflow.com/comment/40064744
has comment: http://stackoverflow.com/comment/40064767
score: 0
tagged with: java
has body: I'm creating an object called gm and setting a property called a in a class to the activity. //This is in the Activity GameConfiguration gm = new GameConfiguration(); gm.setA(this); And then in the class I'm doing this. public class GameConfiguration { private Activity as; public TextView tx; public void setTextsTextViews(){ Activity b = getA(); tx = (TextView) b.findViewById(R.id.category); tx.setText("Test"); // } public Activity getA() { return as; } public void setA(Activity a) { this.as = a; } } The class GameConfiguration is a parent of 2 clases and in those 2 I'm just calling the method setTextsTextViews, I though this would work but I'm getting a NullPointerException error in this line tx = (TextView) b.findViewById(R.id.category); What I don't understand is that when I do this, public void setTextsTextViews(Activity a){ tx = (TextView) a.findViewById(R.id.category); tx.setText("Test"); // } Passing the activity from the child class it does work, I don't know I'm new to all of this, thank you if you can help
answer count: 1

http://stackoverflow.com/a/25643543
has comment: http://stackoverflow.com/comment/40069230
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/40067954
has body: First of all it is not Java library, it is Wolfram language previously known as Mathematica. It does have JLink and can be called from Java, but you must have Wolfram Kernel running that executes the code. This is called Natural Language Processing and it's a huge, complex field. I have fiddled about with few problems, but all I can say this is harder then complex if you want to get reliable solution. Something you might want to take a look at would be : The Stanford NLP
downvote count: 0
answers question: http://stackoverflow.com/q/25643335
upvote count: 1

http://stackoverflow.com/comment/40082588
type: QuestionComment
has text: It is highly unlikely you can get device specific information from the printer without access to the device driver and spooling system. By "doesn't work" I assume you mean it always returns success, which just means the print job was correctly passed to the spooling system. As far as the Java code can determine the job "printed" correctly. What happens after the job is spooled is not visible to your code.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25651451

http://stackoverflow.com/q/25680974
favorite count: 0
has comment: http://stackoverflow.com/comment/40139019
has body: I am writing a JUnit test for testing some function in which I am using a time class from java 1.4. What this test case does is create a file and that file will be passed a parameter to the function which I am testing. My method is using timer.schedule(TimerTask task, long delay); to remove that file. My test case is running but it doesnt wait for the delay passwed to timer.schedule(). My code example is as follows. Function to test: public void clean(String fileName){ long delay = 1000 * 60; timer = new Timer(); final File f= new File(fileName); if(!f.exists()){ f.createNewFile(); } timer.schedule(new RemoveFile(f), delay); //RemoveFile() is inner class which extends TimerTask and remove the file. TimerTask is an abstract class that implements Runnable interface. } My TestCase is as follows public void testClean(){ String file = "c:\\Users\\abc\\abc.txt"; Cleaner instance = Cleaner.getInstace(); //Static method instance.clean(file); } This testcase doesnt wait for the TimerTask to complete its function. I dont know how to put some wait that the testcase wait for the TimeTask thread to finish its work.
tagged with: java
has comment: http://stackoverflow.com/comment/40137781
has comment: http://stackoverflow.com/comment/40138823
type: Question
has comment: http://stackoverflow.com/comment/40138738
has comment: http://stackoverflow.com/comment/40139252
has comment: http://stackoverflow.com/comment/40137524
has comment: http://stackoverflow.com/comment/40137905
answer count: 0
has comment: http://stackoverflow.com/comment/40137518
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40137983
has comment: http://stackoverflow.com/comment/40138950
tagged with: junit
upvote count: 1
has title: JUnit test for Timer class java 1.4
downvote count: 1

http://stackoverflow.com/q/25605113
has comment: http://stackoverflow.com/comment/39998109
tagged with: servlets
type: Question
tagged with: constructor
has comment: http://stackoverflow.com/comment/39998042
accepted answer: http://stackoverflow.com/a/25605177
has answer: http://stackoverflow.com/a/25605177
tagged with: class
tagged with: instantiation
has title: Can't instantiate type even though class and constructor exist
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40000717
tagged with: java
has body: So I'm actually writing this particular code to deal with Servlet and Handler. ContentHandler handler = new ContentHandler(); contents = handler.translateToContent(doc); I face the error of can't instantiate type. however on my ContentHandler class, I have already have an empty constructor. I don't quite understand where is the error at. I'm following an example and it works but it doesn't work on this. Please help and I appreciate it. public ContentHandler() { } public ArrayList&lt;ContentBean&gt; translateToContent(Document doc) { NodeList contentNode = doc.getElementsByTagName("dc"); ArrayList&lt;ContentBean&gt; contentList = new ArrayList&lt;ContentBean&gt;(); for (int i = 0; i &lt; contentNode.getLength(); i++) { Node n = contentNode.item(i); NodeList contentElements = n.getChildNodes(); Many thanks! Regards.
answer count: 1

http://stackoverflow.com/comment/40179004
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25704546
has text: Can you edit your question and add the content of the xml file and the file that is being referenced (if any) in the xml file?
score: 1

http://stackoverflow.com/comment/40202351
has text: In above code in question, I have forget to metion, that code producing logs ... { _log.append("xxxxx\n"); _log.append("xxxxx"); } runs in another thread than doInBackground. All such logs producing code is in one thread, started inside doInBackground, but other, than doInBackground itself.
type: Comment
comment on: http://stackoverflow.com/q/25616601
type: QuestionComment
score: 0

http://stackoverflow.com/comment/120635342
score: 0
type: Comment
comment on: http://stackoverflow.com/a/59453276
has text: Your second last paragraph reminds me a movie. Good try though!
type: AnswerComment

http://stackoverflow.com/q/25709407
has body: i have seen so many examples in which we called wait() and notify() method directly like below. class ThreadB extends Thread{ int total; @Override public void run(){ synchronized(this){ for(int i=0; i&lt;100 ; i++){ total += i; } notify(); } } } but in the object class, method signature of notify is defined as public final void notify() Can someone please explain how we can call these method directly without using an object as these methods are not defined as static.
upvote count: 2
has comment: http://stackoverflow.com/comment/40187749
has answer: http://stackoverflow.com/a/25709649
downvote count: 1
has answer: http://stackoverflow.com/a/25709573
has title: wait() and notify() method in java
type: AnsweredQuestion
answer count: 3
score: 1
accepted answer: http://stackoverflow.com/a/25709652
tagged with: java
possible better answer: http://stackoverflow.com/a/25709573
has answer: http://stackoverflow.com/a/25709652
has comment: http://stackoverflow.com/comment/40187785
favorite count: 0
type: Question

http://stackoverflow.com/a/25678065
upvote count: 4
has body: Something like this should work: public class B { Context context; public B(Context context) { this.context = context; } public void startNewActivity(String str) { try { Intent i = new Intent(context, Class.forName(str)); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } Use case of class B: B b = new B(A.this); b.startNewActivity("MainActivity");//the "MainActivity" is the className of the java class Note I find this way wierd and a overkill.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25678007
downvote count: 0
has comment: http://stackoverflow.com/comment/40130427
score: 4
answers question: http://stackoverflow.com/q/25678007
type: Answer

http://stackoverflow.com/comment/39906419
has text: @AleksandrM this is what I've been doing, I want to build the project with eclipse
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25555483

http://stackoverflow.com/comment/39960452
type: QuestionComment
comment on: http://stackoverflow.com/q/25584501
score: 0
has text: So can you give me a link from where to find them because from the given link in the documentation http://pmd.sourceforge.net/pmd-5.1.2/rules/index.html I can't find them.
type: Comment

http://stackoverflow.com/a/25635697
has comment: http://stackoverflow.com/comment/40054070
score: 0
has comment: http://stackoverflow.com/comment/40054091
has comment: http://stackoverflow.com/comment/40054044
has body: You can use a String key and append each of the coordinates/points to the String so by the time you put the same coordinate it wont put it to a separate location in the HashMap. sample: Line2D line1 = new Line2D.Double(x1, y1, x2, y2); HashMap&lt;String, Integer&gt; hashMap = new HashMap&lt;&gt;(); String keyToGetOrPut = line1.getP1().getX() + "" + line1.getP1().getY() + "" + line1.getP2().getX() + "" + line1.getP2().getY(); if(hashMap.get(keyToGetOrPut) != null){ hashMap.put(keyToGetOrPut, hashMap.get(keyToGet)+1); //increment by 1 if points is already in the HashMap } else { hashMap.put(keyToGetOrPut, 1); //put a new record to the HashMap }
has comment: http://stackoverflow.com/comment/40054010
answers question: http://stackoverflow.com/q/25635608
type: Answer

http://stackoverflow.com/comment/40009369
comment on: http://stackoverflow.com/a/25610551
score: 1
has text: I've marked this as answer as the suggestion of progressively removing portions of code (or re-implementing them, as I done) resulted in finding the cause of my problem - thank you
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25697131
answer count: 2
has answer: http://stackoverflow.com/a/25697179
has comment: http://stackoverflow.com/comment/40166200
downvote count: 1
tagged with: simplify
favorite count: 0
type: Question
tagged with: while-loop
type: UnansweredQuestion
tagged with: java
score: -1
has title: Simplify multiple similar statements on (while)
has body: For example let's say i have this: while( i1 % 1!=0 || i1 % 2!=0 || i1 % 11!=0 || i1 % 16!=0 || i1 % 7!=0 ||i1 % 3!=0 ||i1 % 12!=0 ||i1 % 17!=0 || i1 % 8!=0 ||i1 % 4!=0 ||i1 % 13!=0 ||i1 % 18!=0 || i1 % 9!=0 ||i1 % 5!=0 ||i1 % 14!=0 ||i1 % 19!=0 || i1 % 10!=0 ||i1 % 6!=0 ||i1 % 15!=0 ||i1 % 20!=0 ) {} How can i simplify that? Like while the module of i1 for 1-20 is different to 0. without all that mess. Pardon if its a dumb question, I'm fairly new to this.
tagged with: module
has answer: http://stackoverflow.com/a/25697215
upvote count: 0

http://stackoverflow.com/comment/40146408
has text: Which is why I said he needs setters and getters. lastName and company are private
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25687002

http://stackoverflow.com/comment/40079904
has text: Don't you need to implement Canvas to getBufferStrategy and createBufferStrategy?
type: AnswerComment
comment on: http://stackoverflow.com/a/25617232
type: Comment
score: 0

http://stackoverflow.com/a/25568393
has comment: http://stackoverflow.com/comment/39961079
downvote count: 0
has body: First, for performance you should use StringBuilder (not StringBuffer). StringBuilder is more efficient because (unlike StringBuffer) not every method is synchronized. Finally, your posted examples will almost certainly have the same performance so use the style you prefer.
accepted answer of: http://stackoverflow.com/q/25568328
type: Answer
has comment: http://stackoverflow.com/comment/39961102
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25568328
score: 2

http://stackoverflow.com/a/25616236
has body: You have not passed proper context of your activity that is why its throwing nullpointer error. Just change your method as below. public boolean usernameChk(String usrname){ String usrnmQuery = "SELECT * FROM " + TABLE_ACCOUNTS + " WHERE username = '" + usrname + "'"; SQLiteDatabase db = this.getReadableDatabase(); Declare one common Context in your DatabaseHelper and assign the value of constructor in your while creating instance of your helper class as below: public Context m_context; public DatabaseHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); m_context = context; }
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25616096
has comment: http://stackoverflow.com/comment/40018374
has comment: http://stackoverflow.com/comment/40018390
downvote count: 0
has comment: http://stackoverflow.com/comment/40018335
upvote count: 1

http://stackoverflow.com/a/25629815
accepted answer of: http://stackoverflow.com/q/25629804
type: AcceptedAnswer
score: 8
answers question: http://stackoverflow.com/q/25629804
upvote count: 8
downvote count: 0
type: Answer
has body: You can't. Constructors are not inherited. Only the default one is automatically called on super classes, but still not "inherited". The compiler will automatically add a call to the default constructor "super()" in every constructor, unless a constructor is explicitly called, and provided the superclass has a default constructor. Moreover, if a classe doesn't explicitly define a constructor, the compiler will provide a default empty one, which as stated before calls the super() default constructor. That's why it "looks like" the default constructor is "inherited", but it's just a compiler trick.
has comment: http://stackoverflow.com/comment/40043566

http://stackoverflow.com/a/25645856
answers question: http://stackoverflow.com/q/25645641
has body: I am guessing your sample output was mistaken... If you would like to replace all contiguous groups of non-zero digits in a string with a comma, try this: s = s.replaceAll("[1-9]+", ","); If you are trying to replace all substrings that repeat "255" one or more times with a comma, try this: s = s.replaceAll("(255)+", ",");
type: Answer
upvote count: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25645641
downvote count: 0
score: 4

http://stackoverflow.com/q/25697629
has comment: http://stackoverflow.com/comment/40167409
tagged with: java
has body: Say you have two classes as follows: class A{ static int statint = 5; int instanceint = 5; public void instanceMethod(){} public static void staticMethod(){} } class B extends A{ static int statint = 6; int instanceint = 6; public void instanceMethod(){} public static void staticMethod(){} } and then you instantiate as follows: public static void main(String[] args){ A basa =new B(); //child(B) stored as parent(A) type int i=basa.statint; /**gives you (child)B's static data member (6)**/ int j=basa.instanceint; //gives you (parent)A's instance data member (5) basa.instanceMethod(); //calls (child)B's instanceMethod() version. basa.staticMethod(); /**call's (parent)A's staticMethod() version.**/ } My question is: Why can the child's static methods hide the parent's static data members, but not the parent's static methods? I would think that it would be neither or both. (I'm aware of ways around this - e.g. for static data member/method access, use ClassName.datamember or ClassName.method() notation to ensure the proper version is called, and for instance variables, explicitly downcast the child to be stored in the child type when accessing variables, as with ((B)basa).instanceint;, to get B's instance data member - My question is more for my own understanding of why the defaults don't seem to be consistent for hidden static data members and hidden static methods accessed from an instance.)
score: -1
type: Question
upvote count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/40166786
has answer: http://stackoverflow.com/a/25697770
type: UnansweredQuestion
answer count: 1
downvote count: 1
has title: In Java, why does a child stored as a parent call the parent's static methods, but access the child's static data members?
tagged with: inheritance
favorite count: 0

http://stackoverflow.com/comment/40168866
type: AnswerComment
comment on: http://stackoverflow.com/a/25698178
type: Comment
has text: @SibichakravarthyGunasekaran Try to type in your browser (not in jquery request) http://localhost:8888/ContactsWithAjaxServlet and see if it correctly invokes the servlet
score: 0

http://stackoverflow.com/comment/40173922
type: QuestionComment
comment on: http://stackoverflow.com/q/25701762
has text: And does Eclipse show you on error on the `import org.apache.http.client.methods.HttpPost` line? (Could it actually import it?)
score: 0
type: Comment

http://stackoverflow.com/comment/40072490
score: 0
comment on: http://stackoverflow.com/q/25642712
type: QuestionComment
has text: I'm using the latest S2 & ajax-plugin and I've tried that all - nothing.
type: Comment

http://stackoverflow.com/comment/40069360
type: Comment
score: 0
type: AnswerComment
has text: yes, give it inside non-capturing group, and seperate the chars with `|`, that is `(?:>|=|<....)`
comment on: http://stackoverflow.com/a/25644315

http://stackoverflow.com/comment/40011891
comment on: http://stackoverflow.com/q/25612730
has text: So you are using Spring Framework and Spring MVC or plain JSP?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40096783
type: AnswerComment
has text: You should create your bean that will live in Spring context, inject `AutowireCapableBeanFactory` into it and use it to create other instances programmatically. These instances will be autowired if you use code similar to one that I referenced.
type: Comment
comment on: http://stackoverflow.com/a/25649206
score: 0

http://stackoverflow.com/q/25625330
type: UnansweredQuestion
answer count: 1
tagged with: websocket
downvote count: 0
tagged with: spring
tagged with: rabbitmq
tagged with: java
has body: My use case considers three actors: A Message Producer (for instance, a Remote Backend); A Message Broker (for instance, RabbitMQ); A Message Consumer (a Spring-based web application on is own AS). The communication process is as follows: The Message Producer creates a message (by specifying a recipient) and then sends it to the Message Broker; The Message Broker relays the message to the Message Consumer; The Message Consumer receives the message, then delivers it to a specific user (by mapping recipient and username) by using a WebSocket. Is it possible to implement this scenario?
has title: Messaging with Spring and external Message Brokers
favorite count: 0
type: Question
score: 2
has answer: http://stackoverflow.com/a/25626096
tagged with: spring-messaging
upvote count: 2

http://stackoverflow.com/comment/40142640
type: Comment
has text: Do you check whether map is empty or not before iteration? Show your full jsp.
comment on: http://stackoverflow.com/q/25685048
type: QuestionComment
score: 0

http://stackoverflow.com/q/25661941
answer count: 0
has body: I have two entities: Student and Info and they linked by a @ManytoOne relationship. The entity Info is used to handle file upload and store upload file in database. I m able to save file path in database.but Not With Student_id. i want to save file with student id. and show the uploaded file with in table format.Any example suggestions are appreciated. I m new to web development.thanks Two Model entities linked by a @ManytoOne relationship. Model Info is as follows. package models; @Entity public class Info extends Model { public static Info findById(Long id) { return find.byId(id); } @Id public Long id; public String picture; @ManyToOne(cascade = CascadeType.PERSIST) private Student student; public static Model.Finder&lt;Long, Info&gt; find = new Model.Finder&lt;Long, Info&gt;(Long.class, Info.class); public Info(){ // Left empty } public Info(Student student ,Long id){ this.customer=customer; this.id=id; } public String toString() { return String.format("%s" ,id); } public void setPicture(String picture) { this.picture = picture; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Student getStudent() { return student; } public void setStudent(Student student) { this.student = student; } public String getPicture() { return picture; } } another student model package models; @Entity public class Info extends Model{ private static List&lt;Info&gt; products; @Id public Long id; public String name; @OneToMany(mappedBy="student") private List&lt;Info&gt; info; public static Finder&lt;Long, Student&gt; find = new Finder&lt;Long, Student&gt;(Long.class, Student.class); public Student() { } public Student(String btn){ this.btn = btn; this.info = new ArrayList&lt;Info&gt;(); } public String toString() { return String.format("%s - %s" ,id, business_address); } public static Student findById(Long id) { return find.where().eq("id", id).findUnique(); } public List&lt;Info&gt; getInfo() { return info; } public void setInfo(List&lt;Info&gt; in…
tagged with: java
has comment: http://stackoverflow.com/comment/40185028
type: Question
has title: File upload with @ManyToOne relationship in play framework
type: UnansweredQuestion
tagged with: javascript
tagged with: playframework-2.2
score: 0
has comment: http://stackoverflow.com/comment/40203223

http://stackoverflow.com/a/25672877
score: 2
has comment: http://stackoverflow.com/comment/40157763
has comment: http://stackoverflow.com/comment/40165720
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25672796
has body: The position of the BufferedReader is "shared" among all places where it's used. If you read lines until you reach a "MATCH", and use the BufferedReader in another method, it will continue from that line. Also, if (line = match) doesn't look right. You're probably after if (line.equals(match))
accepted answer of: http://stackoverflow.com/q/25672796
has comment: http://stackoverflow.com/comment/40166085
type: Answer
has comment: http://stackoverflow.com/comment/40166207

http://stackoverflow.com/comment/40000004
type: AnswerComment
score: 1
has text: if `x` is `0`, then it is already normalized anyway. @PeterLawrey no, `Math.abs(x) > 0` is the assumption.
type: Comment
comment on: http://stackoverflow.com/a/25606169

http://stackoverflow.com/q/25677652
has comment: http://stackoverflow.com/comment/40131082
has answer: http://stackoverflow.com/a/25677670
tagged with: listview
type: UnansweredQuestion
has title: Getting the value of a selected listview
has answer: http://stackoverflow.com/a/25678478
has comment: http://stackoverflow.com/comment/40162872
type: Question
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/25678467
answer count: 3
has comment: http://stackoverflow.com/comment/40129788
tagged with: android-listview
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40129959
has body: I have a screen that shows user's information in a 3 listview columnn, I get the data for each listview from 3 arraylist, each arraylist contains data from xml that I parsed using DOM parser. for the first listview, I want the user to be able to click on it, get the value of the listview item(its a string), and get navigated to another screen based on the value of the single item selected. E.G. the arraylist will contain ( A,B,C,D,...), so the listview will have ( A,B,C,D), if the user clicked on B> the user should be navigated to screen B(I'm gonna have a query that uses the value of that list item) ViewMyTickets.java public class ViewMyTickets extends ListActivity { public static String buttonText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_view_my_tickets); string theirID = xmlresult// this is the xml result i get from web services try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(theirID)); Document doc = db.parse(is); //All the UDSObjects NodeList nodesUDSObjectList = doc.getElementsByTagName("UDSObject"); // iterate the UDSObjects Map<String, List<String>> map = new HashMap<String, List<String>>(); List<String> valSetOne = new ArrayList<String>(); List<String> valSetTwo = new ArrayList<String>(); List<String> valSetThree = new ArrayList<String>(); for (int i = 0; i < nodesUDSObjectList.getLength(); i++) { Element elementUDSObject = (Element) nodesUDSObjectList.item(i); //You have a UDSObjects now NodeList nodesAttributeList = elementUDSObject.getElementsByTagName("Attribute"); //You have a list of the attributes for UDSObject(i) // iterate the Attributes of the elementUDSObject(i) for (int iA = 0; iA < nodesAttributeList.getLength(); iA++) { Element elementAttribute = (Element) nodesAttributeList.item(iA); //You have attribute(iA)…

http://stackoverflow.com/q/25565880
tagged with: android
has body: I am developing an Android Application that Contain one Expandable List view for Load data from web service, but I do not want to load whole data on start up but first load parent list then when expand particular list item of list view load that particular item's child item so first is it possible or not ? My Sample Code : package adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.TextView; import com.rk.socialsync.R; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; import utils.Global; import utils.OnlineProperty; public class ExpandableListAdapter extends BaseExpandableListAdapter { private Context _context; private List&lt;Date&gt; _listDataHeader; private HashMap&lt;Date, List&lt;OnlineProperty&gt;&gt; _listDataChild; public ExpandableListAdapter(Context context, List&lt;Date&gt; listDataHeader, HashMap&lt;Date, List&lt;OnlineProperty&gt;&gt; listChildData) { this._context = context; this._listDataHeader = listDataHeader; this._listDataChild = listChildData; } @Override public OnlineProperty getChild(int groupPosition, int childPosititon) { return this._listDataChild.get(this._listDataHeader.get(groupPosition)) .get(childPosititon); } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { OnlineProperty onlineProperty = getChild(groupPosition, childPosition); String child1Text = onlineProperty.getOnlineTime(); String child2Text = onlineProperty.getOfflineTime(); if (convertView == null) { LayoutInflater infalInflater = (LayoutInflater) this._context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = infalInflater.inflate(R.layout.listelementchild, null); } TextVi…
tagged with: expandablelistview
score: 1
tagged with: java
answer count: 1
has title: Load Child Item when click on Parent List Item in Expandable List view in android
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25566025
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39926082

http://stackoverflow.com/comment/40095506
has text: Thanks @icza. The quote was helpful. So now I believe it is a design best practice.
type: Comment
comment on: http://stackoverflow.com/a/25658502
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40072023
comment on: http://stackoverflow.com/q/25645751
type: QuestionComment
has text: Seems like Commitee has only one field to store in database. It's id. The annotated list field in Commitee - just for link to the another table. Maybe that's why `Form.form(Committee.class).bindFromRequest().hasErrors()` false?
type: Comment
score: 0

http://stackoverflow.com/comment/40026925
type: Comment
comment on: http://stackoverflow.com/a/25619620
has text: add some explaination
type: AnswerComment
score: 0

http://stackoverflow.com/q/25700510
has answer: http://stackoverflow.com/a/25700582
has title: No exception within assert?
has comment: http://stackoverflow.com/comment/40215085
has body: I'm struggling with some strange behavior of an assertion within a JUnit test which confuses me a lot. @Test public void ArticleTest() { Article ArticeToTest = null; assert(ArticeToTest.get_price() == price); //No exception here!? boolean test = ArticeToTest.get_price() == price; //NullPointerException! } I don't really understand why the assertion is not causing any exception. It's even possible for me to run through this line in debug mode without any error, the exception occures only in the last line. If I delete the last line, the test appears to be green!? I'm working with Eclipse Luna (4.4.0), javac 1.8.0_20 and JUnit 4.11.
has answer: http://stackoverflow.com/a/25700771
downvote count: 0
accepted answer: http://stackoverflow.com/a/25700524
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25700582
score: 1
tagged with: java
tagged with: junit
has answer: http://stackoverflow.com/a/25700524
has answer: http://stackoverflow.com/a/25700554
answer count: 4
favorite count: 0
type: Question

http://stackoverflow.com/a/25657674
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40150690
has body: You forgot to begin the transaction: Transaction tx = session.getTransaction(); tx.begin(); // Add this line
type: Answer
has comment: http://stackoverflow.com/comment/40148761
answers question: http://stackoverflow.com/q/25657305
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25657305

changeset
tags question: http://stackoverflow.com/q/25623691
tag name: changeset
type: Tag

http://stackoverflow.com/comment/39999075
score: 0
comment on: http://stackoverflow.com/a/25593596
type: AnswerComment
type: Comment
has text: The `s:a` tag requires tuning.

http://stackoverflow.com/comment/40121145
comment on: http://stackoverflow.com/a/25664726
type: AnswerComment
score: 0
type: Comment
has text: Are you trying to get Strings which are formatted as the above numbers? Or the above numbers in `double` form?

http://stackoverflow.com/comment/40166200
type: QuestionComment
has text: `i1 % 1` always evaluates to 0 unless `i1` is floating point.
comment on: http://stackoverflow.com/q/25697131
type: Comment
score: 1

http://stackoverflow.com/q/25626986
downvote count: 0
has body: It seems that some servlet containers reuse HttpServletRequest (or more generally, ServletRequest) instances between requests. Question: Can someone point to the servlet spec where this behavior (or the validity rules for references to such instances) is defined?
tagged with: java
answer count: 1
score: 6
tagged with: web-applications
tagged with: application-server
tagged with: tomcat
favorite count: 0
type: Question
upvote count: 6
has answer: http://stackoverflow.com/a/25626998
accepted answer: http://stackoverflow.com/a/25626998
tagged with: servlets
has title: HttpServletRequest reuse
type: AnsweredQuestion

http://stackoverflow.com/comment/40011858
has text: @T_01 If you are viewing it from within eclipse, you may have to refresh your project space. Then you should see a `target` folder after you run `maven install`.
score: 0
comment on: http://stackoverflow.com/a/25572311
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25566887
answers question: http://stackoverflow.com/q/25566734
downvote count: 0
type: AcceptedAnswer
score: 6
upvote count: 6
accepted answer of: http://stackoverflow.com/q/25566734
has body: Yes, but it is not part of JTable but RowSorter. You can add a RowSorterListener: table.getRowSorter().addRowSorterListener(new RowSorterListener() { @Override public void sorterChanged(RowSorterEvent e) { // Sorting changed } });
type: Answer

http://stackoverflow.com/comment/40091070
type: QuestionComment
comment on: http://stackoverflow.com/q/25651456
has text: @AndreDuarte There you go!
score: 1
type: Comment

http://stackoverflow.com/comment/77132936
comment on: http://stackoverflow.com/a/45080231
has text: This does not privede an answer to a question, should be a comment. Please see [When should I comment?](https://stackoverflow.com/help/privileges/comment). Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment](https://stackoverflow.com/help/privileges/comment) on any post; instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead).
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/a/25700590
has body: First of all, you should be using hybrid encryption, i.e. first encrypt the data using a symmetric cipher and then encrypt the random secret with an RSA key - sending both to the receiver. Second, you should never have to perform doFinal in a loop for a single message. Use update and a single doFinal instead. And thirdly, 2048 bits is 256 bytes. As long as you keep trying to decrypt 128 bytes instead of 256, you will get this exception. Usually I use 2048 / Byte.SIZE instead, it makes the code more readable and will avoid mistakes.
accepted answer of: http://stackoverflow.com/q/25698921
score: 3
has comment: http://stackoverflow.com/comment/40198956
answers question: http://stackoverflow.com/q/25698921
type: Answer
has comment: http://stackoverflow.com/comment/40196393
upvote count: 3
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39916957
type: Comment
comment on: http://stackoverflow.com/q/25561307
type: QuestionComment
has text: Use the `edit` button at the bottom of your post.
score: 0

http://stackoverflow.com/q/25655384
answer count: 3
has answer: http://stackoverflow.com/a/25655406
tagged with: java
has comment: http://stackoverflow.com/comment/40090418
downvote count: 3
has comment: http://stackoverflow.com/comment/40089867
has body: not sure what is wrong keeps telling me i need a semicolon and parentheses package savingsaccount; /** * * @author cgw94 */ public class SavingsAccount { public static void main(String[] args) { System.out.println("Savings Account Balances/Month Saver1/n"); double savingBal1=2000; double savingBal2=3000; for(int n=1; n&lt;12; n=n+1){ savingBal1=(savingBal1*.04)/12)+savingBal1; savingBal2=(savingBal2*.04)/12)+savingBal2; System.out.println(n"/n"savingBal1"/t/t/t/t/t"savingBal2"/n"); } } }
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25655409
type: UnansweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/40089873
upvote count: 1
has title: Getting ";" expected error simple fix, new to java and Netbeans
has answer: http://stackoverflow.com/a/25655399
has comment: http://stackoverflow.com/comment/40089920

http://stackoverflow.com/q/25679722
type: Question
has title: Two 'if's don't make an 'else if'...?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25679746
accepted answer: http://stackoverflow.com/a/25679769
has answer: http://stackoverflow.com/a/25679807
tagged with: if-statement
has body: So I ran into this while programming a looping counter... public void onClick(View view) { if(mFactBook.number &lt; mFactBook.mFacts.length){ mFactBook.number++; } if(mFactBook.number == mFactBook.mFacts.length){ mFactBook.number = 0; } String fact = mFactBook.getFact(); //Update label with dynamic fact factLabel.setText(fact); int color = mColorWheel.getColor(); relativeLayout.setBackgroundColor(color); showFactButton.setTextColor(color); counter.setText("#" + (mFactBook.number + 1)); } So basically what this does is runs through and checks is mFactBook.number less than mFactBook.mFacts.length? if yes, than add 1 to mFactBook.number. is mFactBook.number equal to mFactBook.mFacts.length? if yes, than set mFactBook.number to 0. etc... but when combined into an if else if statement as so... if(mFactBook.number &lt; mFactBook.mFacts.length){ mFactBook.number++; } else if(mFactBook.number == mFactBook.mFacts.length){ mFactBook.number = 0; } ...the app won't set mFactBook.number to 0 after it hits the max length of mFacts. Why is this? I'm curious as to why putting both checkpoints into one if else if statement doesn't work, but having two separate check points does work.
has answer: http://stackoverflow.com/a/25679769
tagged with: android
has answer: http://stackoverflow.com/a/25679840
score: -3
downvote count: 4
has answer: http://stackoverflow.com/a/25679830
has comment: http://stackoverflow.com/comment/40133428
has answer: http://stackoverflow.com/a/25680016
possible better answer: http://stackoverflow.com/a/25679744
tagged with: java
has comment: http://stackoverflow.com/comment/40133324
answer count: 7
upvote count: 1
has answer: http://stackoverflow.com/a/25679744
has comment: http://stackoverflow.com/comment/40138539
favorite count: 0

http://stackoverflow.com/comment/130711705
comment on: http://stackoverflow.com/a/25709312
score: 0
type: AnswerComment
has text: Thanks , your detailed answer help me solve my issue
type: Comment

http://stackoverflow.com/comment/40195365
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25712830
has text: Yes, but it doesn't have to be through `@ModelAttribute`, you can simply add the attribute to the `Model` with `model.addAttribute("chapter", new Chapter())`. It's up to you.

http://stackoverflow.com/comment/39956300
type: QuestionComment
comment on: http://stackoverflow.com/q/25582226
score: 0
has text: u want cut some part in image from imageview
type: Comment

http://stackoverflow.com/comment/40293320
score: 0
type: AnswerComment
has text: tnx. I'm adding this url from your web site: http://ecmarchitect.com/archives/2013/08/26/3528
comment on: http://stackoverflow.com/a/25667403
type: Comment

classnotfoundexception
tags question: http://stackoverflow.com/q/25635604
tag name: classnotfoundexception
type: Tag
tags question: http://stackoverflow.com/q/25582746
tags question: http://stackoverflow.com/q/25568688

http://stackoverflow.com/q/25637036
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40057208
tagged with: eclipse
has answer: http://stackoverflow.com/a/25637055
has answer: http://stackoverflow.com/a/25637065
has title: Java other directory for src
downvote count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40057508
score: 1
has body: I have packages that don't want to place in src folder in order to compile. Can I setup Eclipse so that other directory along with src would act as a source directory? EDIT: When I do Build Path &gt; Use as source folder on the folder which contains com/some_package/classes/*.java then error in Eclipse disappear but in command line compile time I get cannot find symbol error. Whereas, when I copy the same com.some_package/classes/*.java into src directory it works in eclipse and compiles command line too. How to fix command line compilation too?
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40057177
type: Question
has comment: http://stackoverflow.com/comment/40057876
tagged with: java
has answer: http://stackoverflow.com/a/25637109

jlabel
tags question: http://stackoverflow.com/q/25591324
tags question: http://stackoverflow.com/q/25584562
tags question: http://stackoverflow.com/q/25705056
tags question: http://stackoverflow.com/q/25646790
tags question: http://stackoverflow.com/q/25621312
tag name: jlabel
tags question: http://stackoverflow.com/q/25602172
tags question: http://stackoverflow.com/q/25596830
tags question: http://stackoverflow.com/q/25652353
tags question: http://stackoverflow.com/q/25689404
type: Tag
tags question: http://stackoverflow.com/q/25686482

transactions
tags question: http://stackoverflow.com/q/25693125
tags question: http://stackoverflow.com/q/25604025
tags question: http://stackoverflow.com/q/25692873
tags question: http://stackoverflow.com/q/25650201
tags question: http://stackoverflow.com/q/25643358
tag name: transactions
type: Tag
tags question: http://stackoverflow.com/q/25701919
tags question: http://stackoverflow.com/q/25599468
tags question: http://stackoverflow.com/q/25597794
tags question: http://stackoverflow.com/q/25633085
tags question: http://stackoverflow.com/q/25562778
tags question: http://stackoverflow.com/q/25670398
tags question: http://stackoverflow.com/q/25583522
tags question: http://stackoverflow.com/q/25639600
tags question: http://stackoverflow.com/q/25681557

http://stackoverflow.com/a/25621253
answers question: http://stackoverflow.com/q/25596352
type: Answer
score: 0
has body: It doesn't really work for getters like in your example, but since the question is more generic I think it's worth mentioning that with Java 8 you can define default methods in interfaces. So if you had something a bit more complex like: public interface ComplexFoo { String getFirstName(); String getLastName(); String getFullName(); } You do not have to repeat the getFullName implementation in every subclass, but can specify it in the interface: public interface ComplexFoo { String getFirstName(); String getLastName(); default String getFullName() { return getFirstName() + " " + getLastName(); } } The getters though still need repeating, since they access members that are not yet available in the interface: public class FooImpl1 implements ComplexFoo { private String firstName = "foo"; private String lastName = "name1; private String getFirstName() { return firstName; } private String getLastName() { return lastName; } } public class FooImpl2 implements ComplexFoo { private String firstName = "foo"; private String lastName = "name2; private String getFirstName() { return firstName; } private String getLastName() { return lastName; } }

http://stackoverflow.com/comment/40061024
has text: Thank you for response but this doesn't solve my problem. I updated original post with more exact clarification of what is my problem - My problem is to reproduce an exception when executing JDBC.executeQuery("select into; select @@rowcount") - all my out of box SQL Servers returns result set without an exception.
comment on: http://stackoverflow.com/a/25631412
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40204689
comment on: http://stackoverflow.com/a/25682657
score: 0
type: Comment
type: AnswerComment
has text: you include the lib and the project complied, right? did you got an exception? if so, please show us this one and also show us your method(s).

http://stackoverflow.com/q/25554001
has answer: http://stackoverflow.com/a/25554049
has comment: http://stackoverflow.com/comment/39903017
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25554071
type: Question
has comment: http://stackoverflow.com/comment/39903078
tagged with: algorithm
has answer: http://stackoverflow.com/a/25554096
has title: new to programming - it takes 17 bits to store 5 digits - how?
upvote count: 1
answer count: 6
has comment: http://stackoverflow.com/comment/39903736
accepted answer: http://stackoverflow.com/a/25554119
has comment: http://stackoverflow.com/comment/39903051
has answer: http://stackoverflow.com/a/25554316
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25554119
has comment: http://stackoverflow.com/comment/39903032
linked to: http://stackoverflow.com/q/11179516
has body: I was reading this question which stated it takes 17 bits to store 5 digits, how is that possible? Here is what I understand: I used the following calculator and entered the number 99999. I got this huge number: 11000000111001110000110100111111100001101001111111000011010011111 From what I understand, each 0 and 1 represents one bit. As you can see, there are more than 17 bits! Am I understanding this wrong? Also, it was also stated: "Now the first binary value which allows you to fit 99999 numbers is 131072," Huh? I thought binary values are ONLY 0 and 1? What am I missing here?
has answer: http://stackoverflow.com/a/25554087
has comment: http://stackoverflow.com/comment/39903289
has comment: http://stackoverflow.com/comment/39903037
possible better answer: http://stackoverflow.com/a/25554049
has comment: http://stackoverflow.com/comment/39904163
tagged with: java

http://stackoverflow.com/comment/40019308
has text: That's the trick. If the enum will have id - integer. This will be persited in table [EventStatus] with those ids. Without proper update to DB, you won't be able to change your enum. And that is a **big helper**. Why? because otherwise in the system would be stale/non-existing references... the removed enum values. Does it help?
comment on: http://stackoverflow.com/a/25616544
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39905812
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25555251
type: AnswerComment
has text: I saw it that I didnt include FileWriter. Thnx for ur help

http://stackoverflow.com/q/25694235
has comment: http://stackoverflow.com/comment/40160529
tagged with: boolean
score: 0
has body: I've been running through a lot of code reviews and keep running into a situation where I see conflicting coding standards regarding boolean variables and if statements. Here is an example of one method(1): boolean isXTrue = getBooleanValue(DataSetX); if (isXTrue) { //do code } Here is an example of the other method(2): if (getBooleanValue(DataSetX)) { //do code } Both do the same thing and function just fine. In some cases, method 1 is a lot more readable since the boolean variable can be named something meaningful, while method 2 saves more lines and unnecessary boolean variable creations. Maybe I am reading too deep into a simple coding standard, but I'm rather curious that if we use method 1 more often, we could have unnecessary booleans being made. Sorry if this is a stupid question, but I wanted to get some opinions anyway :)
answer count: 1
tagged with: variables
accepted answer: http://stackoverflow.com/a/25694287
has title: JAVA: Create boolean variable or put argument within If statement?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25694287
tagged with: if-statement
has comment: http://stackoverflow.com/comment/40160442
tagged with: java
has comment: http://stackoverflow.com/comment/40160488
tagged with: statements
has comment: http://stackoverflow.com/comment/40160389
has comment: http://stackoverflow.com/comment/40160560
type: Question

http://stackoverflow.com/comment/39949637
has text: @Aniruddha..It didn't solve my problem...Just to be clear you wanted me to remove seekTo in if condition and not the else condition right ...?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25578373

http://stackoverflow.com/comment/40134627
score: 0
type: Comment
type: QuestionComment
has text: without it, the five threads will execute the run() method. However, the Java Doc says, once a thread get the monitor of an object, other thread cannot execute the synchronized code (and will wait until being released).@talex
comment on: http://stackoverflow.com/q/25679793

http://stackoverflow.com/comment/40013281
type: QuestionComment
has text: Will you specify your version of Eclipse and the ADT Plugin?
score: 0
comment on: http://stackoverflow.com/q/25613258
type: Comment

http://stackoverflow.com/comment/40152749
comment on: http://stackoverflow.com/a/25689980
type: Comment
score: 2
type: AnswerComment
has text: because you may be forcing the network layer to send data more frequently than it might otherwise.

http://stackoverflow.com/comment/39951462
comment on: http://stackoverflow.com/a/25579411
has text: Can you come for a personal chat?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40133751
has text: What do you mean by throwing the exception after catching it? Jon mentioned it too. Can you please edit your post, and explain that?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25679833

http://stackoverflow.com/a/25689361
answers question: http://stackoverflow.com/q/25689186
type: Answer
score: 24
has body: Problems ask for results modulo primes because the alternatives, namely asking for a floating-point result giving the "high-order bits" and asking for the whole result, aren't always what the problem setter is looking for. These problems are often "find and implement a recurrence" problems. The low-order bits will often tell you whether the recurrence you found is right. There may be a special trick for the "high-order bits" problem, perhaps based on a clever analytic approximation. The reason people don't often ask for the whole result is that this requires the contestant to implement big-number arithmetic. Problem setters usually don't want unexpected tricks to crack their problems for "the wrong reasons." 10^9+7 winds up being a pretty good choice of prime. It is a "safe prime." What that means: 10^9+7 is a prime number. This means that the "Chinese remainder trick" doesn't apply; if you're trying to work something out modulo a product of two primes, say pq, then you can work it out modulo p and modulo q and use the extended Euclidean algorithm to put the pieces together. More than that, 10^9+6, which is 10^9+7-1, is twice a prime. So the multiplicative group modulo 10^9+7 doesn't decompose into small things and hence no Chinese-remainder-like trick applies there.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40151083
accepted answer of: http://stackoverflow.com/q/25689186
upvote count: 24

mapreduce
tags question: http://stackoverflow.com/q/25678084
tags question: http://stackoverflow.com/q/25628393
tags question: http://stackoverflow.com/q/25593533
type: Tag
tags question: http://stackoverflow.com/q/25669531
tags question: http://stackoverflow.com/q/25618406
tags question: http://stackoverflow.com/q/25638371
tags question: http://stackoverflow.com/q/25700459
tags question: http://stackoverflow.com/q/25576193
tags question: http://stackoverflow.com/q/25650815
tags question: http://stackoverflow.com/q/25701795
tag name: mapreduce
tags question: http://stackoverflow.com/q/25587811

http://stackoverflow.com/q/25551108
tagged with: junit
has body: Sometimes I stumble across test methods in test classes which are not annotated with @Test by mistake. The methods' names usually begin with the prefix test and their bodies contain assertions. Is there any way to find such JUnit 4 test cases with missing annotations?
tagged with: eclipse
downvote count: 1
favorite count: 0
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/25639681
tagged with: testing
answer count: 2
type: UnansweredQuestion
score: 3
has title: Find missing @Test annotations
tagged with: java
has answer: http://stackoverflow.com/a/58940506

http://stackoverflow.com/comment/40081848
score: 0
has text: ..In general this won't be happening right since as soon as the server goes down, it will get added to `blockList` and then no thread will be making a call to that server (after few milliseconds), instead it will try another server in the list? So it should be smooth process and then as soon as those servers are up, blockList will get updated from the background thread and then you can start making a call.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25640179

http://stackoverflow.com/comment/40007624
comment on: http://stackoverflow.com/a/25610385
has text: Thanks for the answer. Changing to `Cascade.PERSIST` gets rid of the exception, however the data of `TestPlayer` do not end in the database at all, there are only entries for `TestTeam`.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25596488
has comment: http://stackoverflow.com/comment/39982639
has title: how to get a java date in "packed byte" format?
has answer: http://stackoverflow.com/a/25596817
downvote count: 1
has comment: http://stackoverflow.com/comment/39982240
favorite count: 0
has comment: http://stackoverflow.com/comment/39982601
has comment: http://stackoverflow.com/comment/39982695
type: Question
has answer: http://stackoverflow.com/a/25596602
upvote count: 0
answer count: 2
tagged with: smf-forum
type: UnansweredQuestion
has body: I'm trying to manually enter a forum user into an smf database but can't seem to figure out how to get the current date in the proper format, which I found out is something called "packed byte". can anyone point me to some info to help out?
score: -1
has comment: http://stackoverflow.com/comment/39982673
has comment: http://stackoverflow.com/comment/39982312
has comment: http://stackoverflow.com/comment/39982334
tagged with: java

http://stackoverflow.com/comment/40169128
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25699131
has text: @Eran not able to find sum
score: 0

http://stackoverflow.com/comment/40050032
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25626471
has text: Well, it would be helpful to see how would you do that. I'll explain you how I'm doing it right now so you can see if I'm going through the right way or not: In the ".xml" I erased almost everything and right now, where there were the layouts "ContributorLayout_X...", there's just a LinearLayout, which is the container of the programmatically EditViews, EditTexts, etc... Then, in the class, I add the fields programmatically with bucles for, and in the public onClick for the button "Add another contributor" I've done the same to add one by one the fields.

http://stackoverflow.com/comment/40500139
comment on: http://stackoverflow.com/a/25856642
score: 1
has text: But a redirect is not a popup.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40049557
has text: No. Later, if you find that your production setup suffers from performance problems and a hardware upgrade can't be afforded, you may try to speed things up by using routing tables / routing columns (it means you have to somehow digest the routing yourself and add columns to store the node/lookup key)
comment on: http://stackoverflow.com/a/25613464
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40033774
has text: If you are writing this new code against Jetty 9 or Servlet 3.1, then it is *strongly advised* that you use `AsyncProxyServlet` (as the normal ProxyServlet is only for migrated code from servlet 2.5)
type: QuestionComment
comment on: http://stackoverflow.com/q/25574554
score: 1
type: Comment

http://stackoverflow.com/comment/40014023
comment on: http://stackoverflow.com/a/25613818
score: 0
type: AnswerComment
has text: Many thanks. This is for an Android application where various commands (which are command-response sequences) are performed via a Bluetooth or USB connection. The way I have designed my command objects is such that a given type of command may be constructed, handed off to my 'command executor' which fires the command's payload via the connection, collects the response, and then calls back an asynchronous handler. I *think* this fits in quite well with the Android way of doing things and because some of my various state machines are event driven, but I'm always open to other ideas. (Cont...)
type: Comment

http://stackoverflow.com/a/25558417
answers question: http://stackoverflow.com/q/25558387
upvote count: 2
downvote count: 0
has body: There is a Scanner constructor that takes a String, but it just reads from the String directly. Constructs a new Scanner that produces values scanned from the specified string. You should create a File from your filename and pass the File to another Scanner constructor that takes a File: Constructs a new Scanner that produces values scanned from the specified file. Scanner input = new Scanner(new File("words.txt"));
type: Answer
score: 2

http://stackoverflow.com/comment/40110874
type: Comment
has text: the dimension of the container is (100000 * 1000), the statement new BufferedImage(100000 * 1000, BufferedImage.TYPE_INT_ARGB) throws outofmemoryerror, so only i planned to slice the container into smaller buffered images
comment on: http://stackoverflow.com/a/25667114
score: 0
type: AnswerComment

http://stackoverflow.com/q/25702561
accepted answer: http://stackoverflow.com/a/25702766
upvote count: 1
has answer: http://stackoverflow.com/a/25702840
possible better answer: http://stackoverflow.com/a/25702840
has comment: http://stackoverflow.com/comment/40175555
tagged with: mergesort
tagged with: sorting
has title: Need help count inversions with merge sort
favorite count: 0
type: AnsweredQuestion
downvote count: 0
tagged with: algorithm
has answer: http://stackoverflow.com/a/25702766
score: 1
has body: The following code counts inversions in an array nums (pairs i,j such that j&gt;i &amp;&amp; nums[i] &gt; nums[j]) by merge sort. Is it possible to use the same approach to count the number of special inversions like j&gt;i &amp;&amp; nums[i] &gt; 2*nums[j]? How should I modify this code? public static void main (String args[]) { int[] nums = {9, 16, 1, 2, 3, 4, 5, 6}; System.out.println("Strong Inversions: " + countInv(nums)); } public static int countInv(int nums[]) { int mid = nums.length/2; int countL, countR, countMerge; if(nums.length &lt;= 1) { return 0; } int left[] = new int[mid]; int right[] = new int[nums.length - mid]; for(int i = 0; i &lt; mid; i++) { left[i] = nums[i]; } for(int i = 0; i &lt; nums.length - mid; i++) { right[i] = nums[mid+i]; } countL = countInv (left); countR = countInv (right); int mergedResult[] = new int[nums.length]; countMerge = mergeCount (left, right, mergedResult); for(int i = 0; i &lt; nums.length; i++) { nums[i] = mergedResult[i]; } return (countL + countR + countMerge); } public static int mergeCount (int left[], int right[], int merged[]) { int a = 0, b = 0, counter = 0, index=0; while ( ( a &lt; left.length) &amp;&amp; (b &lt; right.length) ) { if(left[a] &lt;= right[b]) { merged [index] = left[a++]; } else { merged [index] = right[b++]; counter += left.length - a; } index++; } if(a == left.length) { for (int i = b; i &lt; right.length; i++) { merged [index++] = right[i]; } } else { for (int i = a; i &lt; left.length; i++) { merged [index++] = left[i]; } } return counter; } I tried this while ((a &lt; left.length) &amp;&amp; (b &lt; right.length)) { if (left[a] &lt;= right[b]) { merged[index] = left[a++]; } else { if (left[a] &gt; 2 * right[b]) { counter += left.length - a; } merged[index] = right[b++]; } index++; } but there's a bug in the while loop, when left[a]&lt;2*right[b] but left[a+n] maybe&gt;2*right[b], for instance left array is {9,16} and right array is {5,6}, 9&lt;2*5 but 16>2*5. My code just skip cases like t…
tagged with: java
has comment: http://stackoverflow.com/comment/40180362
type: Question
answer count: 2

http://stackoverflow.com/a/25682294
downvote count: 0
answers question: http://stackoverflow.com/q/25682102
score: 2
has body: HttpURLConnection and service interaction using the "gzip" compression（android2.2 and later） u should set: connection.setRequestProperty("Accept-Encoding", "identity"); reference api: By default, this implementation of HttpURLConnection requests that servers use gzip compression. Since getContentLength() returns the number of bytes transmitted, you cannot use that method to predict how many bytes can be read from getInputStream(). Instead, read that stream until it is exhausted: whenread() returns -1.
accepted answer of: http://stackoverflow.com/q/25682102
type: Answer
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/39914383
has text: No it's not possible
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25559839
type: Comment

http://stackoverflow.com/a/25557259
downvote count: 0
has body: Don't confuse javax @WebService with Spring @Service which is defined here. Although both are called service. @Service's purpose is simply: This annotation serves as a specialization of @Component, allowing for implementation classes to be autodetected through classpath scanning. So, since @WebService is for WSDLs (external access), a @Serviceis for Spring's internal use. If you want to access "Services" from other machines, you have to write a @WebService or use @RequestMapping with SpringMVC.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25556550
score: 1

http://stackoverflow.com/a/25651207
score: 0
has body: It's not ideal, but if you need to do something crazy like that (I also did) and you are using maven, you could do something like this to shade the packages: org.sonatype.plugins jarjar-maven-plugin 1.8 process-classes jarjar true com.fasterxml:aalto-xml commons-codec:commons-codec javax.xml.stream:stax-api org.codehaus.woodstox:stax2-api com.cookies:app javax.xml.stream.** com.cookies.internal.javax.xml.stream.@1 <!-- Android packages commons-codec < 1.4 and we want to make use of the Base64OutputStream to *decode* --> org.apache.commons.codec.** com.cookies.internal.org.apache.commons.codec.@1
type: Answer
answers question: http://stackoverflow.com/q/25651058

http://stackoverflow.com/a/25656014
type: Answer
has comment: http://stackoverflow.com/comment/114971856
accepted answer of: http://stackoverflow.com/q/25643097
score: 7
upvote count: 7
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25643097
has body: You could do the following with JAXB and StAX: import javax.xml.bind.*; import javax.xml.stream.*; import javax.xml.stream.events.XMLEvent; import java.io.*; public class Demo { public static void main(String[] args) throws Exception { XMLInputFactory xif = XMLInputFactory.newFactory(); XMLOutputFactory xof = XMLOutputFactory.newFactory(); try( FileInputStream in = new FileInputStream("in.xml"); FileOutputStream out = new FileOutputStream("out.xml"); ) { XMLEventReader xer = xif.createXMLEventReader(in); XMLEventWriter xew = xof.createXMLEventWriter(out); JAXBContext jc = JAXBContext.newInstance(File.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); while(xer.hasNext()) { if(xer.peek().isStartElement() &amp;&amp; xer.peek().asStartElement().getName().getLocalPart().equals("file")) { // Unmarshal the File object from the XMLEventReader File file = (File) unmarshaller.unmarshal(xer); // Modify the File object file.description = "NEW DESCRIPTION"; // Marshal the File object to the XMLEventWriter marshaller.marshal(file, xew); } else { // Copy node from reader to writer xew.add(xer.nextEvent()); } } } } }

http://stackoverflow.com/comment/39982240
comment on: http://stackoverflow.com/q/25596488
score: 0
has text: What are you talking about?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40051791
type: Comment
score: 0
type: AnswerComment
has text: Just added the Server constructor for you to see.
comment on: http://stackoverflow.com/a/25633970

http://stackoverflow.com/comment/40122161
type: AnswerComment
has text: @SotiriosDelimanolis Absolutely, although he just wants to debug
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25612938

build
tag name: build
tags question: http://stackoverflow.com/q/25591365
tags question: http://stackoverflow.com/q/25687274
tags question: http://stackoverflow.com/q/25581336
type: Tag
tags question: http://stackoverflow.com/q/25708596
tags question: http://stackoverflow.com/q/25666473
tags question: http://stackoverflow.com/q/25564337
tags question: http://stackoverflow.com/q/25695832

http://stackoverflow.com/comment/40152502
comment on: http://stackoverflow.com/q/25688330
type: QuestionComment
has text: See [What is a stack trace, and how can I use it to debug my application errors?](http://stackoverflow.com/q/3988788/418556) & [What is a NullPointerException, and how do I fix it?](http://stackoverflow.com/q/218384/418556)
type: Comment
score: 0

http://stackoverflow.com/comment/110156397
type: AnswerComment
has text: Currently, the only option I'm aware of is using RedisGears - see here for details https://github.com/antirez/redis/issues/5766#issuecomment-620623878
score: 0
comment on: http://stackoverflow.com/a/25710944
type: Comment

http://stackoverflow.com/comment/40033211
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25601681
has text: ok, now you can place buttons inside html and use php if(isset($_POST['btn1'])){} based on that you can run the socket code and send appropriate message.

http://stackoverflow.com/q/25573632
upvote count: 2
has body: I have Java 8 update 20 and I just made my first applet, but when I try to run it in the browser it says that my security settings have blocked it! After I go into my java settings and go in the security tab all I see it: Enable Java content in the browser (It is a checkbox) Security level for applications not on the Exception site list Very high (RADIO BUTTON) High (RADIO BUTTON) And then I have my exception site list... I am missing the Medium radio button? I can't run my applet without the medium option! I have tried adding my site to the exceptions list but it didn't work... I have deinstalled the previous version of java which was Java 8 update 11. What's the problem??? Thanks!
downvote count: 0
answer count: 1
tagged with: applet
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25573707
tagged with: security
has answer: http://stackoverflow.com/a/25573707
tagged with: java
score: 2
tagged with: missing-features
type: AnsweredQuestion
has title: Java 8 Update 20 Missing security options

http://stackoverflow.com/comment/39918510
has text: samosa vegetable pakora........mmmm,yummy code
type: QuestionComment
comment on: http://stackoverflow.com/q/25562098
type: Comment
score: 0

http://stackoverflow.com/q/25551541
tagged with: java
tagged with: spring
has comment: http://stackoverflow.com/comment/39898217
tagged with: spring-mvc
has title: Spring-Scheduling Problems: org.springframework.beans.factory.BeanCreationException:
has body: I try to deploy the application, but the console show me this error, I'm not familiar with Spring MVC and Spring scheduler. This is my first project. SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [Beans.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/support/AopUtils at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) 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:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) at org.apache.catalina.core.StandardContext…
has comment: http://stackoverflow.com/comment/39898150
score: 1
upvote count: 1
tagged with: spring-scheduled
has answer: http://stackoverflow.com/a/25554115
downvote count: 0
answer count: 1
favorite count: 0
type: Question
type: UnansweredQuestion

http://stackoverflow.com/q/25667971
tagged with: gwt
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40112693
tagged with: java
has title: Adding ScrollPanel to CellTable
type: Question
has comment: http://stackoverflow.com/comment/40112513
has answer: http://stackoverflow.com/a/25669646
accepted answer: http://stackoverflow.com/a/25669646
upvote count: 1
answer count: 1
has body: i want to make celltable with scrollpanel on my gwt with uibinder, but can't get this scrollpanel to shown. I tried to add scrollPanel to ui.xml file and within add this celltable: <g:HTMLPanel> <c:CellTable pageSize='10' styleName="cellTable" ui:field='Source'></c:CellTable> <c:SimplePager ui:field='simplePager' location='CENTER'></c:SimplePager> </g:HTMLPanel> but it doesn't show any scrollbar, i tried use datagrid instead of celltable withtin docklayoutpanel like hier: <g:DockLayoutPanel unit="EM"> <g:center> <c:DataGrid ui:field='dataGrid' /> </g:center> but get nothing at all to displayed on the gui, nothing. Can someone please suggest me how to add scrollpanel to celltable in my ui.xml file? EDIT: <g:HTMLPanel> **<g:ScrollPanel> <c:CellTable pageSize='10' styleName="cellTable" ui:field='Source'></c:CellTable> </g:ScrollPanel>** <c:SimplePager ui:field='simplePager' location='CENTER'></c:SimplePager> </g:HTMLPanel>
favorite count: 0

http://stackoverflow.com/q/25706794
has title: How to detect an external process crash in Java?
has comment: http://stackoverflow.com/comment/40183338
has comment: http://stackoverflow.com/comment/40192568
tagged with: java
linked to: http://stackoverflow.com/q/673036
tagged with: external-process
score: 4
has body: I am working on an application that needs to launch a process and wait for its output. Sometimes the process crashes (very often,) but is not really an issue since I have mitigation tasks. The problem is that Windows detects the process crashed and prompts for user input, to either check for a solution online, or just close the program. I tried to solve this by waiting for the process to complete in a Runnable submitted to an ExecutorService and using the Future returned to specify a timeout. Speed is not really a concern for the application, and the external process is supposed to run for just a couple of seconds. This is the code I am using: final Process process = ... final ExecutorService service = Executors.newSingleThreadExecutor(); try { final Future&lt;?&gt; future = service.submit(new Runnable() { @Override public void run() { try { process.waitFor(); } catch (InterruptedException e) { /* error handling */} } }); future.get(10, TimeUnit.SECONDS); } catch (final TimeoutException e) { // The process may have crashed process.destroy(); } catch (final Exception e) { // error handling } finally { service.shutdown(); } The code above worked well, but the crash dialog still pops up and it doesn't go away without user interaction. This question presents a similar problem but from a .Net perspective and proposes to suppress the pop up through the Windows registry, which I cannot do, given that its effect is global to all process in the machine. Is there a way to prevent the dialog from being displayed at all? or Is there a way to detect the application crash and handle it directly from Java without needing user interaction? Additional details: I don't have the source of the external process. The external process is a console based application (i.e. no GUI.) Preferably I'm looking for a pure Java based solution (no JNI.) Thank you.
upvote count: 4
tagged with: crash
type: UnansweredQuestion
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40189681
has comment: http://stackoverflow.com/comment/40192867
favorite count: 0
has answer: http://stackoverflow.com/a/25765646
type: Question
has comment: http://stackoverflow.com/comment/40192595
has comment: http://stackoverflow.com/comment/40183571
has comment: http://stackoverflow.com/comment/40183308

http://stackoverflow.com/comment/39988275
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/25599802
has text: Even if months start with 0, I set the value to '8' explicitly.And has displayed '9' for the month set to '9'.Why Not '10' ?

http://stackoverflow.com/a/25567865
has comment: http://stackoverflow.com/comment/39930966
score: 2
has comment: http://stackoverflow.com/comment/39930840
has comment: http://stackoverflow.com/comment/39931395
has comment: http://stackoverflow.com/comment/39930608
downvote count: 0
has comment: http://stackoverflow.com/comment/39930923
has body: I want to avoid inlining of the final string so it cannot be seen from the apk. But you are not hiding the constants just by moving them to another method, what you are doing has only one effect: It makes you code more confusing for no reason at all. In fact what you are trying to do is impossible. It doesn't matter what you do, all values in your code can be read from your reverse engineered APK and there is no way to prevent that. You can only make it more difficult through obfuscation. Are the two following statements inlined? Is one better than the other? Both are completely equal, it makes no difference at all. If you want to improve this part, then do this: // Declare these as constant fields private final static String CONST1 = "const1"; private final static String CONST2 = "const2"; private final static String CONST3 = "const3"; ... // Use these constant fields directly to build your String myString = CONST1 + CONST2 + CONST3; Or even better, do this: // Declare this as constant fields private final static String CONST1 = "const1"; private final static String CONST2 = "const2"; private final static String CONST3 = "const3"; // Since the resulting String is build from constants it is itself also a constant // This means we can also declare it as a constant field: private final static String MY_STRING = CONST1 + CONST2 + CONST3; And if you don't need CONST1, CONST2 or CONST3 separately then just do this: private final static String MY_STRING = "const1const2const3"; All these improvements are just to keep your code clean, maintainable and readable. It makes absolutely no difference aside from that. The program will run in exactly the same way regardless of how or where you define those Strings, but doing it like I suggested keeps the code simple and easy to understand - which by the way should be a good programmers first priority. There might be a minuscule performance boost from implementing my suggestions above since there probably is less overhead since you …
has comment: http://stackoverflow.com/comment/39930549
answers question: http://stackoverflow.com/q/25567738
has comment: http://stackoverflow.com/comment/39931068
has comment: http://stackoverflow.com/comment/39931181
upvote count: 2
has comment: http://stackoverflow.com/comment/39930390
type: Answer
has comment: http://stackoverflow.com/comment/39930990
has comment: http://stackoverflow.com/comment/39931059

http://stackoverflow.com/q/25667380
has answer: http://stackoverflow.com/a/30075853
has title: iOS MDM : apply Policies (Restrictions) and Wifi Configurations on Device
downvote count: 0
has body: I have completed the iOS MDM Enrollment Phases as well as the APNs push for Commands like DeviceInformation, DeviceLock etc. Now I am trying to push policies (restrictions) , wifi configurations and passcode over the device. So currently in my device i have one profile installed which is the MDM Management profile. Going through this Updating Configuration Profile installed in iOS device in MDM forum, we have to send an InstallProfile Command to the device whenever we want to apply policies. But when i do so a in my Profiles section under settings -> General -> Profile , i see 2 profiles installed one is my MDM payload and second is the restrictions payload which i had sent. This is how i am trying to send the Payload <?xml version="1.0" encoding="UTF-8"?> Command RequestType InstallProfile Payload cGhfbWRtX2Jhc2VfNjRfZW5jb2RlZA== CommandUUID ph_mdm_command_uuid Here Payload value contains the base64 encoded plist for profile this is my profile configuration which is being sent in the Payload of InstallProfile requesttype. PayloadContent PayloadDescription PayloadDisplayName Restrictions PayloadIdentifier com.hQLvCF.mdm.version1.mdm3.restrictions1 PayloadOrganization PayloadType com.apple.applicationaccess PayloadUUID E9D5CFA9-4482-47DA-9CFA-5AA7AF4F62DC PayloadVersion 1 allowAddingGameCenterFriends <true/> allowAppInstallation <true/> allowAssistant <true/> allowAssistantWhileLocked <true/> allowBookstoreErotica <true/> allowCamera <true/> allowCloudBackup <true/> allowCloudDocumentSync <true/> allowDiagnosticSubmission <true/> allowExplicitContent <true/> allowGlobalBackgroundFetchWhenRoaming <true/> allowInAppPurchases <true/> allowMultiplayerGaming <true/> allowPassbookWhileLocked <true/> allowPhotoStream <true/> allowSafari <true/> allowScreenShot <true/> allowSharedStream <true/> allowUntrustedTLSPrompt <true/> allowVideoConferencing <true/> allowVoiceDialing <true/> allowYouTube <true/> allowiTunes <true/> forceEncryptedBackup <false/> forceITunesStorePasswor…
score: 1
upvote count: 1
tagged with: java
linked to: http://stackoverflow.com/q/9698228
favorite count: 0
has answer: http://stackoverflow.com/a/25669564
type: Question
answer count: 2
type: UnansweredQuestion
tagged with: ios
tagged with: mdm

http://stackoverflow.com/comment/40142439
type: Comment
type: QuestionComment
has text: According to the Apache documentation i guess u need to use, setProcessInputStream(OutputStream os): "Set the OutputStream by means of which input can be sent to the process.", write your bytes to an outputstream and call this function.
score: 0
comment on: http://stackoverflow.com/q/25680210

http://stackoverflow.com/comment/40191861
type: Comment
comment on: http://stackoverflow.com/a/25703250
type: AnswerComment
has text: Are you saying that your mock server also received JSON without quotes around fieldnames i.e. exactly like mine? Was mock server able to correctly parse it? You said "The raw string after serializing through the postForEntity is actually generating JSON with double quotes." - I don't see that in your code. Unfortunately, I don't have access to Server side code.
score: 0

http://stackoverflow.com/q/25670077
favorite count: 0
type: Question
tagged with: export
tagged with: serialization
has body: For exam preparation I am writing a little program that uses RMI. A data-collection on a RMI-server should be accessible to external clients. Clients should be able to "lock" and "unlock" the collection. When the collection is unlocked, clients should receive a reference to the exported remote Data-object. When the collection is locked clients should only receive a serialized copy (i.e. by-value) of said Data-object (thus the Data-interface extends both the Serializable and the Remote-Interfaces). I have already got the following code, but I do not know how to force the serialization of the object (and then send it via RMI) inside the close() and get() methods. (Modifying the remote-object when the collection isOpen() works perfectly, though.) Any hints, thoughts, ideas? Service-Object: public interface Service extends Remote { public Data open() throws RemoteException; public Data close() throws RemoteException; public Data get() throws RemoteException; public boolean isOpen() throws RemoteException; } public class ServiceImpl extends UnicastRemoteObject implements Service { private boolean open; private DataImpl data; public ServiceImpl() throws RemoteException { open = true; data = new DataImpl(); } @Override public synchronized Data open() throws RemoteException { open = true; //by-reference return data; } @Override public synchronized Data close() throws RemoteException { open = false; //force by-value //TODO: How to force serialization??? return null; } @Override public synchronized Data get() throws RemoteException { if (open) { //by-reference return data; } else { //force by-value //TODO: How to force serialization??? return null; } } @Override public synchronized boolean isOpen() throws RemoteException { return open; } } Data-Object public interface Data extends Remote, Serializable { public void append(String s) throws RemoteException; public ArrayList&lt;String&gt; getValues() throws RemoteException; public String getString() throws RemoteException; } pub…
upvote count: 2
tagged with: interface
downvote count: 0
accepted answer: http://stackoverflow.com/a/25679902
type: AnsweredQuestion
score: 2
has title: Remote Method Invocation (RMI) - Force "Call-by-Value" on an exported object
has answer: http://stackoverflow.com/a/25679902
tagged with: rmi
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40199858

http://stackoverflow.com/comment/39951477
has text: So I spent some time revamping my code with the things you suggested, and I think my code looks a lot nicer! The only problem I am currently having is that my character count won't update still. Do you mind taking a look at it and give me some pointers? http://pastebin.com/RnzMn3VU
type: AnswerComment
comment on: http://stackoverflow.com/a/25577603
score: 0
type: Comment

http://stackoverflow.com/q/25694369
type: UnansweredQuestion
answer count: 1
has body: I can't figure out why my program won't continue past the while loop once I enter the string "end" as one of the items. I tried putting println statements after the while loop and they didn't print after I typed "end". I also tried putting a print statement at the end of the while loop and it did not print once I typed "end", so it isn't running the while loop after I type "end", but it also isn't running anything after it. Any ideas? Here's the code: package a1; import java.util.Scanner; public class A1Adept { public static void main(String[] args) { Scanner s = new Scanner(System.in); process(s); } public static void process(Scanner s) { int[] numbers = new int[10]; double[] cost = new double[10]; String itemName = ""; int categoryNumb; int quantities; double costs; System.out.println("Please enter the names of the items, their category, their quantity, and their cost."); while(!itemName.equals("end")){ itemName = s.next(); categoryNumb = s.nextInt(); quantities = s.nextInt(); costs = s.nextDouble(); numbers[categoryNumb] += quantities; cost[categoryNumb] += (costs*quantities); } System.out.println("win"); int qMax = 0; int qMin = 0; int cLarge = 0; int cLeast = 0; int max = 0; int min = 100; double large = 0; double least = 100; for (int i = 0; i &lt; 10; i++){ if (numbers[i] &gt;= max) { max = numbers[i]; qMax = i; } if (numbers[i] &lt;= min){ min = numbers[i]; qMin = i; } if (cost[i] &gt;= large){ large = cost[i]; cLarge = i; } if (cost[i] &lt;= least){ least = cost[i]; cLeast = i; } } System.out.println("Category with the most items:"+qMax); System.out.println("Category with the least items:"+qMin); System.out.println("Category with the largest cost:"+cLarge); System.out.println("Category with the least cost:"+cLeast); } }
tagged with: java
has answer: http://stackoverflow.com/a/25694380
has title: Why won't my program continue on once I enter as the itemName?
type: Question
score: 0

http://stackoverflow.com/comment/40195812
type: Comment
type: AnswerComment
has text: Scrolling could be pretty ugly if you're extracting an image from a zip file on demand on the FX Application Thread, though, no?
comment on: http://stackoverflow.com/a/25712972
score: 1

http://stackoverflow.com/comment/40127323
type: Comment
comment on: http://stackoverflow.com/q/25676175
type: QuestionComment
has text: I think your assignment is steering you towards putting the data you read into a list- or dictionary-like structure to perform the reporting on - create the aggregates (sum + avg) and sort ascending and descending (min + max).
score: 0

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/25585393

http://stackoverflow.com/comment/40101362
has text: @user130004 Thank you, that's gratifying ;)
score: 0
comment on: http://stackoverflow.com/a/25639720
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25641489
downvote count: 0
has title: Import sales data into Quickbooks via .IIF files
tagged with: quickbooks
favorite count: 0
has body: I'm trying to import Sales into Quickbooks 2013 with an IIF file. Background: I'm developing an export engine for those IIF files for Quickbooks and now I'm trying to import sales datas into it. The message from Quickbooks is following: The Tax field cannot be left blank, even for non- taxable customers and sales which have to no taxable items, so non-taxable sales will be correct for this district. Examples of the receipts I try to import are: TRNS 1001148 CASH SALE 08/27/2014 Service "19,95" 1001148 Y Y SPL CASH SALE 08/27/2014 Spirituosen "-16,76" "Aalborg Jubiläums Akvavit 0.70l Fl" -1 "19,95" 5700359304907 Y SPL CASH SALE 0 0 "-3,19" "Voller Satz" -1 "-3,19" Sales Tax N ENDTRNS TRNS 1001147 CASH SALE 08/27/2014 Service "39,90" 1001147 Y Y SPL CASH SALE 08/27/2014 Spirituosen "-16,76" "Aalborg Jubiläums Akvavit 0.70l Fl" -1 "19,95" 5700359304907 Y SPL CASH SALE 08/27/2014 Spirituosen "-16,76" "Aalborg Jubiläums Akvavit 0.70l Fl" -1 "19,95" 5700359304907 Y SPL CASH SALE 0 0 "-6,38" "Voller Satz" -1 "-6,38" Sales Tax N ENDTRNS Actually I'm exporting these files manualy. Is there a way or a library to export IIF files preferably in Java?
type: Question
type: UnansweredQuestion
tagged with: iif
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/25648936
tagged with: java
answer count: 1

http://stackoverflow.com/q/25690272
tagged with: android
has comment: http://stackoverflow.com/comment/40153928
linked to: http://stackoverflow.com/q/14827949
has title: ActionBarActivity problems returnin to ListFragment for api10f
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26244066
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/26244066
downvote count: 0
upvote count: 1
score: 1
favorite count: 0
type: Question
tagged with: supportmapfragment
tagged with: android-listfragment
has body: I have a android.support.v7.app.ActionBarActivity that has a FrameLayout holding a SupportMapFragment and android.support.v4.app.ListFragment. I instantiate both fragments in the OnCreate of ActionBarActivity if(mFM.findFragmentByTag("ListFragment")==null){ mPlaceListFragment = new PlaceListFragment_1(); mFM.beginTransaction().add(R.id.listfragment_container, mPlaceListFragment,"ListFragment").commit(); }else{ mPlaceListFragment = (PlaceListFragment_1)mFM.findFragmentByTag("ListFragment"); } if(mFM.findFragmentByTag("MapFragment")==null){ mMapFragment = new map_fragment(); //always create map fragment mFM.beginTransaction().add(R.id.mapfragment_container, mMapFragment,"MapFragment").commit(); }else{ mMapFragment = (map_fragment) mFM.findFragmentByTag("MapFragment"); } And in order to avoid recreating each fragment when it’s selected I hide/show them depending on which one is selected. @Override public boolean onNavigationItemSelected(int i, long l) { //OnFragmentInteractionListener FragmentTransaction ft = mFM.beginTransaction(); if(i==0){ //map if (mPlaceListFragment.isVisible())ft.hide(mPlaceListFragment); if (mMapFragment.isHidden())ft.show(mMapFragment); }else{ //list if (mPlaceListFragment.isHidden())ft.show(mPlaceListFragment); if (mMapFragment.isVisible())ft.hide(mMapFragment); } ft.commit(); return true; //True if the event was handled, false otherwise. } This all works fine. I can select each Fragment using the dropdown in ActionBar and manipulate UI etc. Orientation change also works ok. The problem occurs when the ListFragment is visible and the app opens a new Activity and the back key is pressed to return to the original Activity. OR the ListFragment is visible and the HOME button is pressed and an attempt is made to reopen the app from the task bar. The problem doesn’t occur with the map fragment just the ListFragment. Also the app works for in GenyMotion emulators for API17+ The app returns to the ListFragment ok but the UI controls (actionbar control…

http://stackoverflow.com/q/25570989
tagged with: libgdx
has comment: http://stackoverflow.com/comment/39935367
has comment: http://stackoverflow.com/comment/39936260
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: How to fix "Couldn't load shared library 'libgdx64.so' for target: Linux, 64-bit"
answer count: 1
has answer: http://stackoverflow.com/a/25573248
accepted answer: http://stackoverflow.com/a/25573248
has comment: http://stackoverflow.com/comment/106644270
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39938134
linked to: http://stackoverflow.com/q/1051640
score: 5
upvote count: 5
has body: I am trying to use the headless LibGDX for unit testing, but when I run the test I get this error: Couldn't load shared library 'libgdx64.so' for target: Linux, 64-bit I read here that I need to add gdx-natives.jar. Is this correct, and where can I find this file? Also, where in my project should I add the file?

http://stackoverflow.com/q/25574597
has answer: http://stackoverflow.com/a/25574628
type: Question
tagged with: jakarta-ee
tagged with: rest
accepted answer: http://stackoverflow.com/a/25574628
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has title: How to get method's request in springmvc
score: 0
has body: I have the next method: @RequestMapping(value="/busqueda/basica", method = {RequestMethod.POST,RequestMethod.GET}) public String busquedaBasica(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap, @RequestParam("nombreBasica") String nombre){ ... } Is there any way to get the method's request, POST or GET?
tagged with: java
answer count: 1

http://stackoverflow.com/a/25696042
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/40177683
accepted answer of: http://stackoverflow.com/q/25695841
type: AcceptedAnswer
downvote count: 0
has body: ActionBarDrawerToggle(<Activity>, <DrawerLayout>, R.drawable.main_icon, 0, 0); drawable/main_icon.xml: <?xml version="1.0" encoding="utf-8"?> <item android:drawable="@drawable/your_icon" android:left="10dp" /> Then adjust the margins android:left, android:right etc.
answers question: http://stackoverflow.com/q/25695841
type: Answer

interface
tags question: http://stackoverflow.com/q/25696567
tag name: interface
tags question: http://stackoverflow.com/q/25710107
tags question: http://stackoverflow.com/q/25599725
tags question: http://stackoverflow.com/q/25670077
tags question: http://stackoverflow.com/q/25695205
tags question: http://stackoverflow.com/q/25671800
tags question: http://stackoverflow.com/q/25613752
tags question: http://stackoverflow.com/q/25637022
tags question: http://stackoverflow.com/q/25695998
tags question: http://stackoverflow.com/q/25596352
type: Tag
tags question: http://stackoverflow.com/q/25555540

http://stackoverflow.com/comment/40072362
type: QuestionComment
comment on: http://stackoverflow.com/q/25646048
score: 0
type: Comment
has text: @theMarceloR not a duplicate. The one you linked to is using `SimpleDateFormat` while @batman is asking about JodaTime

http://stackoverflow.com/comment/40138188
has text: Yes, delete statement is in log in this case.
comment on: http://stackoverflow.com/q/25681260
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40088703
has text: Your code is in src/main/java/some/package, thrift code is in target/generated-code/other/package (assuming you are using normal Maven-style project structure; even if you don't for some reason, they should definitely be in different packages and thus different directories).
comment on: http://stackoverflow.com/a/25651535
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40012611
type: AnswerComment
has text: @PatrickW.McMahon: be careful that you only create one Foo instance. Any place you see `new Foo()` you've created a completely new and distinct instance, and changes to one won't be reflected in the other. That's why I've taken pains to pass references around.
comment on: http://stackoverflow.com/a/25613039
type: Comment
score: 0

http://stackoverflow.com/comment/40084949
has text: Ok, but how can I connect to server and send object to server inside that method? What code should I write inside of sendMessage()?
type: AnswerComment
comment on: http://stackoverflow.com/a/25652777
score: 0
type: Comment

http://stackoverflow.com/comment/39992134
type: Comment
has text: Dear Filip,Thanks for the response. I am trying to implement your program. Searching for all the packages required for that till I execute.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25601423

http://stackoverflow.com/comment/40071561
type: QuestionComment
comment on: http://stackoverflow.com/q/25645641
type: Comment
score: 1
has text: Do you want to `replace all` series of `one or more` digits which are not zeroes (are in range `1-9`) with `,`? If that is the case than why in your result there are more zeroes than at in your input?

http://stackoverflow.com/q/25693526
type: Question
tagged with: soap-client
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32495312
has body: I have problem with my webservice client which build using Axis 1.3.1 I encounter below error when executing the webservice: [9/5/14 15:05:47:211 EDT] 0000018f ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service Uncaught service() exception thrown by servlet SWPChooseAccountServlet: java.lang.AbstractMethodError: org/apache/axis2/databinding/ADBBean.serialize(Ljavax/xml/namespace/QName;Ljavax/xml/stream/XMLStreamWriter;)V at org.apache.axis2.databinding.ADBDataSource.serialize(ADBDataSource.java:90) at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:781) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:967) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245) at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:207) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74) at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84) The webservice client is deployed in IBM WAS 8.5.5.1 My temporary solution is to add axis2-adb-1.4.1.jar to WebSphere app server shared library and add the library as a reference library in the Java class loader (Classes loaded with local class loader first (parent last))
tagged with: web-services
has comment: http://stackoverflow.com/comment/40165045
tagged with: java
answer count: 1
has title: SOAP error : Axis 2 AbstractMethodError
has comment: http://stackoverflow.com/comment/40371532

http://stackoverflow.com/comment/39904356
comment on: http://stackoverflow.com/a/25554087
type: Comment
score: 0
type: AnswerComment
has text: @shmedfred, in order to understand what 131072 represents, you need to understand place-value number systems (http://en.wikipedia.org/wiki/Positional_notation), and especially, the base-2 (a.k.a., "binary") place-value system.

http://stackoverflow.com/q/25701426
has title: where to put phantomjs.exe in Tomcat 7 on Windows 7
type: Question
has comment: http://stackoverflow.com/comment/40286139
has comment: http://stackoverflow.com/comment/40303341
has answer: http://stackoverflow.com/a/25703937
type: UnansweredQuestion
has body: I want to configure Highstock export server in Tomcat 7.0.55. I followed steps given here. I did not get on this step--> "install PhantomJS on the server, see here" I downloaded PhontomJs zip file, extracted to D:\user\softwares\phantomjs-1.9.7-windows\phantomjs-1.9.7-windows. Web app path:D:\user\softwares\apache-tomcat-7.0.55-windows-x86\apache-tomcat-7.0.55\webapps I have given phontomjs.exe file in app-convert.properties location of the phantomjs executable, -->exec = D:/user/softwares/phantomjs-1.9.7-windows/phantomjs-1.9.7-windows. Getting this error: [ERROR] [pool-1-thread-1 08:13:12] (TaskUtils.java:handleError:95) Unexpected er ror occurred in scheduled task. java.lang.RuntimeException: java.io.IOException: Cannot run program "phantomjs": CreateProcess error=2, The system cannot find the file specified at com.highcharts.export.server.Server.&lt;init&gt;(Server.java:80) at com.highcharts.export.pool.ServerObjectFactory.create(ServerObjectFac tory.java:47) at com.highcharts.export.pool.ServerObjectFactory.create(ServerObjectFac tory.java:25) at com.highcharts.export.pool.AbstractPool.createObject(AbstractPool.jav a:39) at com.highcharts.export.pool.AbstractPool.poolCleaner(AbstractPool.java :79) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.scheduling.support.ScheduledMethodRunnable.run(Sc heduledMethodRunnable.java:64) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnabl e.run(DelegatingErrorHandlingRunnable.java:53) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47 1) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java :351) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178) at java.util.concurrent.ScheduledThreadPoolE…
score: 0
tagged with: java
tagged with: highcharts
tagged with: tomcat
answer count: 1

http://stackoverflow.com/comment/40206868
type: AnswerComment
comment on: http://stackoverflow.com/a/25682657
type: Comment
has text: I have since been told that only Background task and process can be run using @Background so trying to create a surfaceView and renderer is a big no no as it is UI related, i have actually fixed my problem, i will do a short write up soon. Thanks
score: 0

http://stackoverflow.com/q/25602146
has comment: http://stackoverflow.com/comment/39993142
score: 0
has body: I have a project having subprojects in the following structure |-- project1 | -- src --main --java -- resources -- test |-- project2 .. |-- build.gradle |-- gradle.properties |-- settings.gradle |-- weblogic.gradle For project1, I have some test cases written in TestNG which are not getting invoked. Here is by build script apply plugin: 'war' apply plugin: 'ear' apply plugin: 'java' ... project(':project1') { ... dependencies{ ... compile 'org.testng:testng:6.8.8' compile 'com.jayway.restassured:rest-assured:2.3.2' } test{ useTestNG() testLogging.showStandardStreams = true } ... } project(':project2') { .. } ... The tests are working when tried from an IDE. Also the build script works for other tasks like build and deploy. Only test is failing. Another observation was that when defining dependency, the test jars are getting downloaded only when i say compile. It doesnt download for testCompile. When i execute gradle test It says Build Succesful. But I dont see any test output on terminal nor report getting generated Gradle version used is 2.0 Any help will be appreciated
tagged with: java
has answer: http://stackoverflow.com/a/25622147
tagged with: gradle
tagged with: build.gradle
has comment: http://stackoverflow.com/comment/39992768
tagged with: testng
has comment: http://stackoverflow.com/comment/39995641
type: UnansweredQuestion
has title: Gradle multiproject tests not getting invoked
answer count: 1
has comment: http://stackoverflow.com/comment/40022741
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/40023055
has comment: http://stackoverflow.com/comment/40018129
type: Question

http://stackoverflow.com/comment/40128698
has text: This is my answer to similiar question which will help you http://stackoverflow.com/questions/24057041/unable-to-load-java-class-from-w3c/24057478#24057478 You need to add that class into classPath.I guess Wordnet is some external library?If you have jar simply add it corrctly to class path.Easy way is to let IDE do it for you.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25676878

http://stackoverflow.com/q/25574393
has answer: http://stackoverflow.com/a/31325034
type: Question
tagged with: aaa-security-protocol
has title: Unexpected first EAP message in Diameter
tagged with: java
has comment: http://stackoverflow.com/comment/41383890
has body: So I've been looking at adding support for Diameter EAP in my server. After reading up on rfc4072 and rfc3748 I was fooled to have a general idea. My expectation was that the client would pass a so called EAP-Start message (an empty EAP-Payload AVP) to my server. I would respond with an proper EAP request for identity (type 1) and diameter client would deliver the response to that in the new EAP-Payload and then the cycle would continue. However, when I was looking at actual pcap traces from freeDiameter (ex this pcap) I noticed that the 1st EAP diameter request (No.6) contained an EAP Identity response (!!) already. Kind of by-passing the initial round-trip. While I don't have a huge a problem with implementing this I would really like to know if this is by (EAP-)spec? Can you start an EAP transaction with a response with?
score: 0
has comment: http://stackoverflow.com/comment/39944958
has comment: http://stackoverflow.com/comment/50453801
type: UnansweredQuestion
answer count: 1
tagged with: diameter-protocol

http://stackoverflow.com/q/25604838
tagged with: amazon-s3
tagged with: java
has title: Java - Automatic updates from S3
has body: I have my Java application all set and working. But I will need to include Auto-updating feature where files are scheduled to be downloaded from AWS Bucket. I was planning to make use of AWS SDK for this functionality, but this library seems to add up extra 7MB to the installer size. Is there any way I can add this functionality without the use of AWS SDK library?, or Use the same library but not let it take so much of size with the installer?
has answer: http://stackoverflow.com/a/25610783
type: UnansweredQuestion
answer count: 1
tagged with: amazon-web-services
type: Question
score: 0
tagged with: sdk

http://stackoverflow.com/comment/39906891
has text: An log wrapper would be unnecessary, you can better solve the problem you have -edit: Because normally `System.out` is printed to logcat
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25555488
type: Comment

http://stackoverflow.com/comment/40024079
type: QuestionComment
has text: In addition to the answers (which already cover the main point: Flexibility!) : 1. `Parent` **IS** a subclass of `Parent` and 2. The list is not "write protected": You can still add `null` (or remove elements)
comment on: http://stackoverflow.com/q/25617284
type: Comment
score: 0

http://stackoverflow.com/q/25706917
answer count: 1
type: AnsweredQuestion
has title: Ongoing notification in service class causes phone to freeze
score: 0
accepted answer: http://stackoverflow.com/a/25755100
has answer: http://stackoverflow.com/a/25755100
tagged with: android
tagged with: java
tagged with: android-notifications
type: Question
tagged with: android-service
linked to: http://stackoverflow.com/q/24221166
linked to: http://stackoverflow.com/q/5693997
has body: Currently I have a service class that locks apps for a selected amount of time. I am trying to display the time remaining for the user in an ongoing notification. However, the problem is that when I run it on my phone it becomes very laggy and the entire notification bar is blanked out. I have done research, but no luck so far. Android: How to create an "Ongoing" notification? Notification at end of CountDownTimer and tried using non-deprecated methods for the notification; however, when I use notification builder my phone just freezes on and off. There is no log report. I am not sure what to do. Here is my service class: package com.ibc.android.demo.appslist.app; import android.app.ActivityManager; import android.app.AlarmManager; import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.IBinder; import java.util.ArrayList; import java.util.List; import java.util.Map; public class HeartBeat extends Service { ArrayList<String> packagezList; SharedPreferences sharedPrefs; Map<String, ?> allEntries; SharedPreferences sharedPrefsapp; SharedPreferences endTimerPreferences; long timerends; @Override public IBinder onBind(Intent arg0) { return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { //startService(new Intent(this, HeartBeat.class)); endTimerPreferences = getApplicationContext().getSharedPreferences("endservice", Context.MODE_PRIVATE); timerends= endTimerPreferences.getLong("endservice", 0); //Log.e("MONOLO ", timerends + ""); sharedPrefs = getApplicationContext().getSharedPreferences(getApplicationContext().getPackageName(), Context.MODE_PRIVATE); sharedPrefsapp = getApplicationContext().getSharedPreferences("appdb", Context.MODE_PRIVATE); allEntries= null; allEntries = sharedPrefsapp.getAll(); packagezList= null; packagezList = new ArrayList<String>(); for (Map.Entry<String, ?> entry : allEntries.entry…

http://stackoverflow.com/comment/40013145
has text: Thanks think I can make something out of your tips
comment on: http://stackoverflow.com/a/25613433
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39950543
comment on: http://stackoverflow.com/q/25578887
type: QuestionComment
has text: do you know the difference of `fragment` and `activity`? here you post activity. and also do you want us to debugge it yes? is it all your question?
type: Comment
score: 0

http://stackoverflow.com/q/25623099
tagged with: serializable
tagged with: android-intent
possible better answer: http://stackoverflow.com/a/25623182
upvote count: 6
has title: ArrayList cannot be cast to custom class extending ArrayList
tagged with: arraylist
has answer: http://stackoverflow.com/a/25623237
has answer: http://stackoverflow.com/a/25623182
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40030760
has comment: http://stackoverflow.com/comment/40030745
has body: I have class mentioned below: public class JsonHistoryList extends ArrayList&lt;JsonHistory&gt; implements Serializable{} I wish to pass it through intent using timerService.putExtra(TimerService.ACTIVITY_LIST_ARG, activities); But after I receive it (way below) JsonHistoryList temp = (JsonHistoryList) intent.getSerializableExtra(TimerService.ACTIVITY_LIST_ARG); in my service it gives me exception: Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.epstim.captime.jsonmodel.JsonHistoryList I don't understand why java can't handle that operation. I've changed my code in service to: ArrayList&lt;JsonHistory&gt; temp = (ArrayList&lt;JsonHistory&gt;) intent.getSerializableExtra(TimerService.ACTIVITY_LIST_ARG); activities.addAll(temp); And it worked.
has answer: http://stackoverflow.com/a/56724673
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/40030763
has answer: http://stackoverflow.com/a/25623249
accepted answer: http://stackoverflow.com/a/25626637
favorite count: 0
linked to: http://stackoverflow.com/q/4862960
type: Question
has answer: http://stackoverflow.com/a/25626637
answer count: 5
has comment: http://stackoverflow.com/comment/40030741
tagged with: android
score: 6

http://stackoverflow.com/a/25570324
answers question: http://stackoverflow.com/q/25569920
type: Answer
type: AcceptedAnswer
downvote count: 0
has body: It looks like what is happening is similar to what's happening in this question. If you manage to work around the language restrictions and make a reference to an uninitialized variable, it will have it's default value (0 in the case of int). So in this case, you call int i = ++this.j. Since isn't yet initialized, it takes value 0, which is then incremented. On your next call, it preserves the value it had before and adds one to it. I found another answer which goes into more detail about the restrictions on initialization. The key part is this The declaration of a member needs to appear textually before it is used only if the member is an instance (respectively static) field of a class or interface C and all of the following conditions hold ... The usage is via a simple name So basically, what you're doing is allowed just because the language designers didn't explicitly forbid it. To deal with the other part of your question, I'll reference the Java documentation. The Java compiler copies initializer blocks into every constructor. So the initialization code you wrote happens in the constructor of the object. When the object is created, both variables are initialized with values of 0, after which your code runs to modify those values. So no, the line int i = ++this.j; doesn't initialize j. That happens automatically before that line is reached.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25569920
has comment: http://stackoverflow.com/comment/39934499
score: 1

http://stackoverflow.com/q/25603022
has comment: http://stackoverflow.com/comment/39995258
has body: How can i change the textcolor of all TextView by changing the textcolor of theme (which is mentioned in style) programmatically?? Example Suppose I want to change the setting in my android application I have a spinner , and I fill it with different color name. Then how can i change the textcolor of ALL textviews by selected item of spinner. my default theme is: Can someone help me with this?
tagged with: eclipse
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39995336
answer count: 1
has comment: http://stackoverflow.com/comment/39995348
has answer: http://stackoverflow.com/a/25603626
has title: Change text color in style theme by code
has comment: http://stackoverflow.com/comment/39994418
linked to: http://stackoverflow.com/q/3241729
score: 0
has comment: http://stackoverflow.com/comment/39994403
has comment: http://stackoverflow.com/comment/39994369
tagged with: android
tagged with: java

http://stackoverflow.com/q/25600831
answer count: 1
linked to: http://stackoverflow.com/q/4216745
score: -6
has answer: http://stackoverflow.com/a/25600876
favorite count: 0
type: Question
tagged with: java
downvote count: 6
has body: Using java I need to parse this 2014-08-31 13:53:42.0 to 31-AUG-14 01.53.42 PM
has comment: http://stackoverflow.com/comment/39990177
has comment: http://stackoverflow.com/comment/39990348
duplicate of: http://stackoverflow.com/q/4216745
has comment: http://stackoverflow.com/comment/39990269
upvote count: 0
type: UnansweredQuestion
has title: How to parse a Date+Time String

instantiation
tags question: http://stackoverflow.com/q/25634542
type: Tag
tag name: instantiation
tags question: http://stackoverflow.com/q/25601575
tags question: http://stackoverflow.com/q/25605113

http://stackoverflow.com/q/25696211
has answer: http://stackoverflow.com/a/25696227
tagged with: methods
has title: Displaying error on toString method
type: Question
has body: I am working on this code where a menu pops up and you enter a choice to enter a computer or to display the computers added. However the only problem i have is when it displays it give me a null for the type of cpu and its speed. It is suppose to display like this \nBrandName:\tDell\n CPU:\t\tpentium3,500HZ\n Memory:\t\t398M\n Price:\t\t$1,390.00\n\n but it displays like this \nBrandName:\tDell\n CPU:\t\tnullHZ\n Memory:\t\t398M\n Price:\t\t$1,390.00\n\n here is my code there are three classes a main Assignment4 class a CPU class and a computer class, I believe my error is somewhere in my computer class. here is my Assignment4 class // Description: Assignment 4 class displays a menu of choices to a user // and performs the chosen task. It will keep asking a user to // enter the next choice until the choice of 'Q' (Quit) is entered. import java.io.*; import java.util.*; public class Assignment4 { public static void main (String[] args) { // local variables, can be accessed anywhere from the main method char input1 = 'Z'; String inputInfo; String brandName; double price; int memory; String cpuType; int cpuSpeed; String line = new String(); // instantiate a Computer object Computer computer1 = new Computer(); printMenu(); //Create a Scanner object to read user input Scanner scan = new Scanner(System.in); do // will ask for user input { System.out.println("What action would you like to perform?"); line = scan.nextLine(); if (line.length() == 1) { input1 = line.charAt(0); input1 = Character.toUpperCase(input1); // matches one of the case statement switch (input1) { case 'A': //Add Computer System.out.print("Please enter the computer information:\n"); System.out.print("Enter a brand name:\n"); brandName = scan.nextLine(); computer1.setBrandName(brandName); System.out.print("Enter a computer price:\n"); price = Double.parseDouble(scan.nextLine()); computer1.setPrice(price); System.out.print("Enter a computer memory:\n"); memory = Integer.parseInt(scan.nextLine()); computer…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40164279
has comment: http://stackoverflow.com/comment/40164322
has answer: http://stackoverflow.com/a/25696307
tagged with: class
score: 0
answer count: 2
tagged with: java

http://stackoverflow.com/comment/40052735
comment on: http://stackoverflow.com/q/25634710
type: Comment
has text: @Simonegianni please consider that make you comment as an answer.
score: 0
type: QuestionComment

http://stackoverflow.com/q/25705695
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/68074270
has title: How do I produce an error when input is bad?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40181870
downvote count: 0
has comment: http://stackoverflow.com/comment/40182212
upvote count: 1
has body: I am trying to have my program output an error code when the input values are too high, but I can only get it to display the error message in the terminal window, not in the method return. Here is the code: public class AckermannAdvanced { public static long ack (long m, long n) { long ans; System.out.print("\f"); if (m > 3 && n > 1) { System.out.print("Input values are too high"); } else { if (m == 2) ans = (2*n)+3; else if (m == 1) ans = n+2; else if (m == 0) ans = n+1; else if (n == 0) ans = ack(m-1, 1); else ans = ack(m-1, ack(m, n-1)); System.out.print(ans); return(ans); } return 0; } }
has comment: http://stackoverflow.com/comment/40181296
tagged with: ackermann
has comment: http://stackoverflow.com/comment/40181719
tagged with: recursion
has comment: http://stackoverflow.com/comment/57371876
score: 1
tagged with: java
answer count: 1
tagged with: error-handling

http://stackoverflow.com/comment/40119235
score: 0
type: Comment
type: QuestionComment
has text: What I'm doing is rendering shapes onto a SurfaceView's canvas. The problem is that the exact code I've posted is not drawing anything onto the canvas, when in fact it should. In any case, I've finally discovered the cause and will post the answer.
comment on: http://stackoverflow.com/q/25658457

http://stackoverflow.com/a/25552615
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Try removing from HTTP Header Manager the Transfer-Encoding header. Can you show you Http Request in your Question ? and the Header Manager in it ?
type: Answer
has comment: http://stackoverflow.com/comment/39900644
has comment: http://stackoverflow.com/comment/40034507
accepted answer of: http://stackoverflow.com/q/25552307
answers question: http://stackoverflow.com/q/25552307
has comment: http://stackoverflow.com/comment/39937045

http://stackoverflow.com/comment/39914269
type: QuestionComment
has text: Are you trying to create a new `quizcard`? or defining the constructor? the first is done with `new QuizCard("What's the name...", "Will Smith")`, the second is done with user2548635's comment
comment on: http://stackoverflow.com/q/25559850
score: 0
type: Comment

http://stackoverflow.com/q/25612096
type: Question
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/25613827
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/40010695
upvote count: 2
has title: Why is my code not throwing the EntityExistsException
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/40010609
tagged with: exception
has body: I'm currently studying Java EE 7, and was trying to figure out when the EntityExistsException would be thrown. I currently have a very simple Message class with basic attributes. To my understanding, when a entity with same primary key that is to be persisted already exists in the database, the EntityExistsException should be thrown. I wasn't too sure whether it would matter if the said entity was detached or not, so made a quick test to see when it would occur. However both the test cases pass for some reason, without showing me the error. import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.Persistence; import org.iys.jpa.mysql.example.Message; import org.junit.After; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; public class MessageIT { private static EntityManagerFactory emf ; private EntityManager em; private EntityTransaction tx; public MessageIT() { } @Before public void setUp() { emf= Persistence.createEntityManagerFactory("JPAMYSQLExampleU"); em = emf.createEntityManager(); tx = em.getTransaction(); Message m1= new Message("Hello"); tx.begin(); em.persist(m1); tx.commit(); System.out.println("Setting up the test"); } @After public void tearDown() { if (em != null) { em.close(); } } //either one of the test should fail @Test public void shouldFail1(){ Message msg = em.find(Message.class, 1L); Message copied= msg; copied.setMessage("changed"); assertTrue(em.contains(msg)); em.clear(); assertFalse(em.contains(msg)); assertFalse(em.contains(copied)); //both entities are currently detached tx.begin(); em.persist(copied); tx.commit(); } @Test public void shouldFail2(){ Message msg = em.find(Message.class, 1L); assertTrue(em.contains(msg)); tx.begin(); em.persist(msg); tx.commit(); } } If I'm misunderstanding the conditions for the e…
has answer: http://stackoverflow.com/a/25613827
tagged with: java
answer count: 1
tagged with: mysql
favorite count: 0

http://stackoverflow.com/q/25690527
score: -1
has comment: http://stackoverflow.com/comment/40153081
has comment: http://stackoverflow.com/comment/40153088
type: Question
has body: Are there any alternatives to java.util.regex.Pattern and java.util.regex.Matcher that can be used on android?
has comment: http://stackoverflow.com/comment/40154182
upvote count: 0
has title: Alternatives to java.util.regex
answer count: 1
has comment: http://stackoverflow.com/comment/40153056
downvote count: 1
has comment: http://stackoverflow.com/comment/40153115
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40153122
has answer: http://stackoverflow.com/a/25690578
accepted answer: http://stackoverflow.com/a/25690578
tagged with: android
tagged with: java

http://stackoverflow.com/a/25664477
has body: You have no control over the sender, that is unfortunate because the best solution would be the following (I will give another solution afterwards which doesn't require the sender to change anything). The sender should rename the file when the upload is finished. E.g. the file is named fileInProgress.txt during upload and fileFinished.txt when the upload is finished. You will restrict your java program to only watch for files with the name *Finished.txt. This is the easiest and an absolute reliable solution. Your solution would be the following. From your java program do a file-listing on the upload folder and store the file-sizes. Wait for 10 secs (or longer if you want to be on the save side). Do a file-listing again. All files that didn't change in size are finished and can be processed. Note that this does not give you absolute certainity that the upload is finished but it comes closer the longer the interval between your file size check is.
answers question: http://stackoverflow.com/q/25664072
type: Answer
score: 0

http://stackoverflow.com/q/25599725
tagged with: java
has title: A class implementing common method of interface
type: Question
has comment: http://stackoverflow.com/comment/39988247
has comment: http://stackoverflow.com/comment/39988169
type: UnansweredQuestion
tagged with: interface
answer count: 1
has comment: http://stackoverflow.com/comment/39988125
has comment: http://stackoverflow.com/comment/39988557
has body: There is just one question in which i am got confused... There are two interfaces A , B which contains the same method methodC()...and C class implements A&amp;B. which interface method it should be implemented A or B Now as per my analysis i have lyk say below class.. interface A { /** * Doc A * **/ public void MethodA(); public String MethodB(); } interface B { /** * Doc B * **/ public String MethodA(); public void MethodB(); } class lucy implements A,B{ @Override public String MethodA() { //To change body of implemented methods use File | Settings | File Templates. return null; } @Override public String MethodB() { //To change body of implemented methods use File | Settings | File Templates. return null; } } Output: Hello Hello
has comment: http://stackoverflow.com/comment/39988110
has comment: http://stackoverflow.com/comment/39988153
has answer: http://stackoverflow.com/a/25600067
has comment: http://stackoverflow.com/comment/39988049
score: 0

http://stackoverflow.com/comment/39995502
type: Comment
type: AnswerComment
has text: Check out http://www.codeproject.com/Articles/13093/C-method-calls-within-a-Java-program and http://www.codeproject.com/Articles/378826/How-to-wrap-a-Csharp-library-for-use-in-Java . You could also use standalone command line C# program and access it with `ProcessBuilder` or HTTP server like proposed by Michael Barker@ in the post I linked in my first response.
comment on: http://stackoverflow.com/a/25602302
score: 0

http://stackoverflow.com/a/25583493
accepted answer of: http://stackoverflow.com/q/25583355
score: 37
has comment: http://stackoverflow.com/comment/51074764
upvote count: 37
answers question: http://stackoverflow.com/q/25583355
has comment: http://stackoverflow.com/comment/51072072
has body: Which is the default scope of a Spring 4 @Service? The default scope is singleton It is reasonable to design a Service implementation in order to store some info, related to the current logged user (according to the current HTTP session) Yes. In that case, the service will have to have the scope "session". See http://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html#beans-factory-scopes-other
type: Answer
has comment: http://stackoverflow.com/comment/51072119
has comment: http://stackoverflow.com/comment/72263393
has comment: http://stackoverflow.com/comment/51066970
has comment: http://stackoverflow.com/comment/51066490
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39958591
downvote count: 0
has comment: http://stackoverflow.com/comment/39958393

http://stackoverflow.com/comment/40185403
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25706362
has text: Yeah, that'e because you initialized smallest and largest as 0 and never entered something smaller than 0. It would be better to initialize smallest and largest with the first user inputed value. I've made the appropriate edits, and tested them. (Note to self: don't post code on stack-overflow that you haven't tested, even if you need to run somewhere)
score: 0

http://stackoverflow.com/a/25639943
upvote count: 1
answers question: http://stackoverflow.com/q/25639845
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/40061666
has body: public static void main(String[] args) { String[] Test = new String[]{"1","2","3","4","5","6","7","8","9"}; for(int i = 1; i &lt;= Test.length; i++) { System.out.print(Test[i - 1]+" "); if(i % 3 == 0) System.out.println(); } }
has comment: http://stackoverflow.com/comment/40061923
downvote count: 0

refresh
tags question: http://stackoverflow.com/q/25662415
tag name: refresh
tags question: http://stackoverflow.com/q/25687660
type: Tag

http://stackoverflow.com/a/25707952
type: Answer
answers question: http://stackoverflow.com/q/25707942
score: 2
upvote count: 2
has body: Compile the pattern outside the while loop: Pattern pattern = Pattern.compile(Pattern.quote(s2), Pattern.CASE_INSENSITIVE); while ((line = reader.readLine()) != null) { pattern.matcher(s1).find(); //... }
downvote count: 0

http://stackoverflow.com/q/25603191
tagged with: javascript
tagged with: java-8
has comment: http://stackoverflow.com/comment/40019110
tagged with: nashorn
type: AnsweredQuestion
has title: Nashorn bug when calling overloaded method with varargs parameter
has comment: http://stackoverflow.com/comment/40007599
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25605250
has answer: http://stackoverflow.com/a/25610856
accepted answer: http://stackoverflow.com/a/25610856
has comment: http://stackoverflow.com/comment/40006808
favorite count: 0
type: Question
has body: Assume the following API: package nashorn.test; public class API { public static void test(String string) { throw new RuntimeException("Don't call this"); } public static void test(Integer... args) { System.out.println("OK"); } } The following Nashorn JavaScript snippet will fail: var API = Java.type("nashorn.test.API"); API.test(1); The first method will be called instead of the second. Is this a bug in the Nashorn engine? For the record, this issue was previously reported on the jOOQ User Group, where method overloading and varargs are used heavily, and where this issue may cause a lot of trouble. About boxing There might be a suspicion that this could have to do with boxing. It doesn't. The problem also appears when I do public class API { public static void test(String string) { throw new RuntimeException("Don't call this"); } public static void test(Integer... args) { System.out.println("OK"); } public static void test(MyType... args) { System.out.println("OK"); } } And: public class MyType { } And then: var API = Java.type("nashorn.test.API"); var MyType = Java.type("nashorn.test.MyType"); API.test(new MyType());
score: 20
upvote count: 20
linked to: http://stackoverflow.com/q/9960560
downvote count: 0
has answer: http://stackoverflow.com/a/25603192
has comment: http://stackoverflow.com/comment/40008940
possible better answer: http://stackoverflow.com/a/25603192

http://stackoverflow.com/q/25586853
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40058549
has comment: http://stackoverflow.com/comment/39966746
has comment: http://stackoverflow.com/comment/39992674
upvote count: 1
accepted answer: http://stackoverflow.com/a/25648566
has comment: http://stackoverflow.com/comment/39971930
favorite count: 0
has comment: http://stackoverflow.com/comment/40051891
type: Question
has answer: http://stackoverflow.com/a/25648566
tagged with: mongodb
has comment: http://stackoverflow.com/comment/39968077
has comment: http://stackoverflow.com/comment/40051329
has title: Mongos throttling query speed
has comment: http://stackoverflow.com/comment/39966323
has body: I've got a mongo v2.6.4 cluster with: 2 app servers running mongos instances 3 standalone config servers 3 mongod servers in a replica set From the app servers I can connect to the cluster with no problem. However, each server is limited to about 1k queries per second (this figure from a quick findOne on a small collection using the Java driver). In my dev environment on a small vm I am seeing over 4k queries per second with the same test app. What is really strange is if I add more app servers I can get about 1k queries per second from each app server concurrently (i.e. 4 app servers can get about 4k queries per second total). This leads me to believe there is something wrong with the mongos setting which is throttling the query performance. Am I crazy? Is there any way to boost performance from mongos? Edit 1 (adding sample code and details about mongos config) The mongos config is 100% default except configdb=server1,server2,server3 maxConns=10000 Code for the quick test running on one of the app servers import com.mongodb.DB; import com.mongodb.DBCollection; import com.mongodb.MongoClient; class Tester { public static void main (String[] args) { try { MongoClient mongoClient = new MongoClient("192.168.1.100"); DB db = mongoClient.getDB("my_db"); db.authenticate("my_user", "my_passwd".toCharArray()); DBCollection coll = db.getCollection("my_collection"); long counter = 10000l; long start = System.currentTimeMillis(); for (int i=0; i&lt;counter; i++){ coll.findOne(); } double totalTime = (System.currentTimeMillis() - start) / 1000.0; System.out.println(counter + " counter find operations in " + totalTime + " seconds (" + (counter/totalTime) + " per second)"); } catch (Exception e) { e.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/39971839
has comment: http://stackoverflow.com/comment/39981389
has comment: http://stackoverflow.com/comment/40033706
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39964560
has comment: http://stackoverflow.com/comment/39982915
has comment: http://stackoverflow.com/comment/39966480
has comment: http://stackoverflow.com/comment/39965656
score: 1
has comment: http://stackoverflow.com/comment/39966885
tagged with: java

intellij-idea
tags question: http://stackoverflow.com/q/25668117
tags question: http://stackoverflow.com/q/25700652
tags question: http://stackoverflow.com/q/25590440
tags question: http://stackoverflow.com/q/25664639
tags question: http://stackoverflow.com/q/25683464
tags question: http://stackoverflow.com/q/25692359
tags question: http://stackoverflow.com/q/25659381
tags question: http://stackoverflow.com/q/25631912
tags question: http://stackoverflow.com/q/25705572
tags question: http://stackoverflow.com/q/25577007
tags question: http://stackoverflow.com/q/25567111
tags question: http://stackoverflow.com/q/25614662
tags question: http://stackoverflow.com/q/25618384
tags question: http://stackoverflow.com/q/25652140
tags question: http://stackoverflow.com/q/25555717
tags question: http://stackoverflow.com/q/25561243
tags question: http://stackoverflow.com/q/25601190
tags question: http://stackoverflow.com/q/25623605
tags question: http://stackoverflow.com/q/25571580
tags question: http://stackoverflow.com/q/25682471
tags question: http://stackoverflow.com/q/25570454
type: Tag
tags question: http://stackoverflow.com/q/25601034
tags question: http://stackoverflow.com/q/25676779
tags question: http://stackoverflow.com/q/25620297
tags question: http://stackoverflow.com/q/25694626
tags question: http://stackoverflow.com/q/25676738
tag name: intellij-idea
tags question: http://stackoverflow.com/q/25591971
tags question: http://stackoverflow.com/q/25666506
tags question: http://stackoverflow.com/q/25617461
tags question: http://stackoverflow.com/q/25683965
tags question: http://stackoverflow.com/q/25674642
tags question: http://stackoverflow.com/q/25589152
tags question: http://stackoverflow.com/q/25591991
tags question: http://stackoverflow.com/q/25594442
tags question: http://stackoverflow.com/q/25635377
tags question: http://stackoverflow.com/q/25565764
tags question: http://stackoverflow.com/q/25583136
tags question: http://stackoverflow.com/q/25695697

http://stackoverflow.com/a/25582046
type: Answer
answers question: http://stackoverflow.com/q/25581886
upvote count: 2
score: 2
downvote count: 0
has body: Because Error is not Exception, so the catch block is not monitoring it use throw new Exception()

accordion
tags question: http://stackoverflow.com/q/25667809
tag name: accordion
type: Tag

http://stackoverflow.com/q/25668345
has comment: http://stackoverflow.com/comment/40112720
tagged with: java
tagged with: anonymous
has body: I have a couple questions about he following code: final Runnable accept = new Runnable() { public void run() { while (connect == true) { try { sock = servsock.accept(); } catch (Exception e) { System.out.println(e); } } } }; new Thread(accept).start(); //creates new instance every time i want to run accept() See, every time I want to run 'accept', I create a new thread instance and start it. Can someone tell me how to stop one of these threads? Like, how do I identify the thread? Should I rather use an array of threads?
has comment: http://stackoverflow.com/comment/40112728
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25668550
score: 2
upvote count: 2
has title: control different instances of a thread
tagged with: multithreading
downvote count: 0
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/25668581
has answer: http://stackoverflow.com/a/25668435
type: Question

http://stackoverflow.com/comment/40147529
type: Comment
has text: @Maas The Original Poster asks for JAX-RS, not for Spring.
type: AnswerComment
comment on: http://stackoverflow.com/a/25687675
score: 1

http://stackoverflow.com/comment/40155144
type: QuestionComment
type: Comment
has text: You probably could create those tables manually (and specifying the tablespace) before running Liquibase for the first time.
score: 0
comment on: http://stackoverflow.com/q/25689757

http://stackoverflow.com/comment/96056544
type: QuestionComment
score: 0
has text: Well, this question is not good in regards of SO standards, but in fact the easiest way for me to move forward, thanks!
type: Comment
comment on: http://stackoverflow.com/q/25669990

http://stackoverflow.com/comment/40008984
comment on: http://stackoverflow.com/a/25610480
has text: You're welcome. That's much more helpful than me just giving you working code. I don't know without knowing what the error is you are getting.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/25675080
has body: I have a Tree&lt;> class (legacy code, can't be changed), where each node consists of a label and a list of children: public class Tree&lt;L&gt; implements Serializable, Comparable&lt;Tree&lt;L&gt;&gt;, Iterable&lt;Tree&lt;L&gt;&gt; { public Tree(L label, List&lt;Tree&lt;L&gt;&gt; children) { this.label = label; this.children = children; } ... // lots of methods, including the usual setters and getters } Now, I want to write a class DoublyLinkedTree&lt;L&gt; extends Tree&lt;L&gt; where, in addition to the children, each node also has a parent pointer. Normally, I wouldn't try to do this, but the base Tree&lt;&gt; class already contains a lot of very useful methods (e.g. getSubtrees(), getSubtreesAtDepth()) which I do not want to rewrite. The trouble with extending the base class is that I want methods like setChildren(List&lt;DoublyLinkedTree&lt;L&gt;&gt; children), which clash with the method setChildren(List&lt;Tree&lt;L&gt;&gt; children) in the base class. Is there an elegant way to write a doubly-linked tree class extending the Tree&lt;&gt; class? The base class is very ill-suited for methods that involve upward searches like getGrandParent(), getAllAncestorLabels(), etc. I am not expecting a readymade solution, but I feel that I am looking to solve the issue in a wrong way. Any guidance will be of immense help.
tagged with: java
has title: How to extend an existing Tree (with children, but no parents) to a doubly linked tree?
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40125150
has comment: http://stackoverflow.com/comment/40125381
tagged with: subclass
answer count: 1
tagged with: data-structures
tagged with: inheritance
tagged with: tree
has answer: http://stackoverflow.com/a/29705996
accepted answer: http://stackoverflow.com/a/29705996
type: AnsweredQuestion
score: 2
downvote count: 0

http://stackoverflow.com/q/25611741
has title: java.net.SocketException: Connection reset by peer: socket write error When serving a file
has comment: http://stackoverflow.com/comment/40016895
type: Question
has comment: http://stackoverflow.com/comment/40016302
has comment: http://stackoverflow.com/comment/40009949
has comment: http://stackoverflow.com/comment/40016852
tagged with: sockets
has comment: http://stackoverflow.com/comment/40016329
score: 18
upvote count: 18
has comment: http://stackoverflow.com/comment/40016360
possible better answer: http://stackoverflow.com/a/25614132
has comment: http://stackoverflow.com/comment/40016452
has answer: http://stackoverflow.com/a/25614132
type: AnsweredQuestion
tagged with: java
answer count: 3
downvote count: 0
has body: I am trying to implement an HTTP Server using Sockets. If the Client (For example a browser) requests a directory the server displays a list of available files. The problem arises when the client is requesting a file. I get the following error: java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113) at java.net.SocketOutputStream.write(SocketOutputStream.java:159) at cf.charly1811.java.web.RequestHandler.writeFile(RequestHandler.java:152) at cf.charly1811.java.web.RequestHandler.processRequest(RequestHandler.java:139) at cf.charly1811.java.web.RequestHandler.handleRequest(RequestHandler.java:110) at cf.charly1811.java.web.RequestHandler.run(RequestHandler.java:86) at java.lang.Thread.run(Thread.java:745) The stacktrace shows that the problem is coming from the writeFile() methods: private void writeFile(File request) throws IOException { InputStream byteReader = new BufferedInputStream(new FileInputStream(request)); byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = byteReader.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } byteReader.close(); } But I can't figure out what's wrong. Can you help me? EDIT Thanks everyone for your answers. After I read your answers I understood that the problem was that the Socket when an error occured. Here's was my wrong code: // Method to process a single request handleRequest() throw IOException { // process here // if the client request a file writeFile(); // close socket when the request is processed } // The method is called public run() { try{ // If an error occurs the try/catch won't be called because it is implemented outside the loop. So when an IOException occurs, the loop just stop and exit the program while(true) { handleRequest(); } } catch(IOException e) { // Handle exception here } } And my new code was looking like this: // Method to proces…
tagged with: socketexception
accepted answer: http://stackoverflow.com/a/25614303
has answer: http://stackoverflow.com/a/63131085
favorite count: 0
has answer: http://stackoverflow.com/a/25614303

http://stackoverflow.com/a/25563988
has comment: http://stackoverflow.com/comment/39921867
accepted answer of: http://stackoverflow.com/q/25563715
has body: Here rotation is the angle in degrees, the value is 0 &lt;= rotation &lt; 360 g2d.rotate(angle) rotates an image. It requires angle to be specified in radians. Math.toRadians(rotation) translates degrees to radians, the value 0 &lt;= radians &lt; 2Pi Update: The code rotates the image when cursor keys pressed. It rotates it by 1 degree to the right or 1 degree to the left. The full turn is 360 degrees. When it reaches 360 it resets the rotation variable to zero, which is the same angle as 360. Hence : rotation++; if (rotation &gt; 360) rotation = 0;
type: Answer
has comment: http://stackoverflow.com/comment/39922127
score: 1
answers question: http://stackoverflow.com/q/25563715
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25685347
favorite count: 0
type: Question
type: UnansweredQuestion
score: -1
has answer: http://stackoverflow.com/a/70737005
has answer: http://stackoverflow.com/a/25685492
has body: I've the following code String url = "http://e2e-soaservices:44000/3.1/StandardDocumentService?wsdl"; //createSOAPRequest(); SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url); in the createSOAPRequest Method:- MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); File fXmlFile = new File("src/XML/gen_VDD7S0PLYPAS058_1409900400000_2.xml"); String xmlStr=finalXmlString(fXmlFile); DocumentBuilderFactory docBuilderFactory=DocumentBuilderFactory.newInstance(); docBuilderFactory.setNamespaceAware(true); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); Document doc=docBuilder.parse(xmlStr); System.out.println("dasdasdasd"+doc.toString()); String serverURI = "http://www.aaancnuie.com/DCS/2012/01/DocumentCreation/IStandardDocumentService/CreateDocuments"; // SOAP Envelope SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("example", serverURI); SOAPBody soapBody = envelope.getBody(); soapBody.setTextContent(xmlStr); soapMessage.saveChanges(); return soapMessage; The error message Error occurred while sending SOAP Request to Server java.net.MalformedURLException: no protocol: http%3A%2F%2Fe2e-soaservices%3A44000%2F3.1%2FStandardDocumentService%3Fwsdl at java.net.URL.<init>(URL.java:567) at java.net.URL.<init>(URL.java:464) at java.net.URL.<init>(URL.java:413) at SOAPCLIENTSAAJ.main(SOAPCLIENTSAAJ.java:36)
answer count: 2
has title: java.net.MalformedURLException:no protocol
upvote count: 0
tagged with: java
downvote count: 1

http://stackoverflow.com/q/25667842
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/38794683
possible better answer: http://stackoverflow.com/a/38794683
tagged with: java
has title: not getting headers passed with RestTemplate.getForObject
has comment: http://stackoverflow.com/comment/40113226
type: Question
accepted answer: http://stackoverflow.com/a/25670424
has comment: http://stackoverflow.com/comment/40112162
has body: I am newbie using Spring . I am working on a code trying to pass headers using restTemplate.getForObject client side : String userServiceUrl = "http://localhost:8080/SampleRest/api/user/"; HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", UUID.randomUUID().toString() ); restTemplate.getForObject(userServiceUrl + "{id}",User.class,HttpMethod.GET,headers) ; however on server the request header "Authentication" is not passed at all . there is no header "Authentication" requestHeaders.get("Authorization").get(0) //yields null exception I cannot use restTemplate.exchange what am I doing wrong ? Help will greatly appreciated
tagged with: spring
has answer: http://stackoverflow.com/a/25670424
type: AnsweredQuestion

http://stackoverflow.com/comment/47875511
has text: Hi, I have the same problem. I want to create Java pojo classes and map them on insert/select query. Are there any guides to do that? I don't need smth complex
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25570582
type: QuestionComment

http://stackoverflow.com/a/25560355
has comment: http://stackoverflow.com/comment/39915296
has comment: http://stackoverflow.com/comment/39915352
score: 2
has comment: http://stackoverflow.com/comment/39915456
has body: Looks like the problem is in this line: ImageIcon ii = new ImageIcon(this.getClass().getResource(emilia)); which means most likely that you haven't placed your .png file in the right place for Java to find it. Could you post the exact path of the .png file on disk? More specifically: a null pointer in this line of ImageIcon.java: this(location, location.toExternalForm()); would imply that the URL location is null (causing an exception in the method call .toExternalForm(). If you look at the docs for Class.getResource() you will see it says: Returns: A URL object or null if no resource with this name is found which implies that Java can't find the resource in question. For us to help, you will need to describe your runtime environment (are you running your program from .class files or in a .jar? at the command-line or in a debugger in Eclipse / Netbeans?) so we can help you figure out why the resource isn't being found. You're effectively calling Emilia.class.getResource("emiliasprite.png") with Emilia.java in the default (root) package, which means that you need to tell your IDE / build process to copy this file into the root of the classpath. (in the same directory that Emilia.class ends up) Otherwise, Java has no idea where to find it. If you want to place the resource somewhere else, you need to change the path accordingly, as well as the mechanism that copies the resource from the source directory to the appropriate place on the classpath. See this stackoverflow answer: Java in Eclipse: Where do I put files on the filesystem that I want to load using getResource? (e.g. images for an ImageIcon)
has comment: http://stackoverflow.com/comment/39915340
has comment: http://stackoverflow.com/comment/39915311
has comment: http://stackoverflow.com/comment/39942163
has comment: http://stackoverflow.com/comment/39943829
answers question: http://stackoverflow.com/q/25560315
upvote count: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39915294

http://stackoverflow.com/q/25596985
has answer: http://stackoverflow.com/a/25597006
type: Question
has title: java: unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
tagged with: java
has body: Why am I getting a "must be caught or declared to be thrown" error with this code ? All I want is to test a bunch of code by pasting it into a new java program what is the easiest way to bunch of code ? import java.io.File; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(new File("C:\\Users\\User\\Selenium\\scrapjv\\interface\\NASDAQlist.txt")); List&lt;String&gt; symbolList = new ArrayList&lt;String&gt;(); while (sc.hasNextLine()) { symbolList.add(sc.nextLine()); } PrintWriter logput = new PrintWriter("C:\\Users\\User\\Selenium\\scrapjv\\interface\\log.txt", "UTF-8"); for (String symb : symbolList) { System.out.println(symb); } logput.close(); } }
has comment: http://stackoverflow.com/comment/39983273
has comment: http://stackoverflow.com/comment/39983237
score: -1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11589302
upvote count: 0
answer count: 2
linked to: http://stackoverflow.com/q/2417485
downvote count: 1
possible better answer: http://stackoverflow.com/a/25597035
accepted answer: http://stackoverflow.com/a/25597006
favorite count: 0
linked to: http://stackoverflow.com/q/4392446
duplicate of: http://stackoverflow.com/q/11589302
has answer: http://stackoverflow.com/a/25597035

http://stackoverflow.com/a/25690750
accepted answer of: http://stackoverflow.com/q/25690566
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40153833
has body: With scope="application", you would need to do this: ${applicationScope.dataBean.currentDate}. You probably don't want that date to be set as application scope though, so remove scope="application" from the tag like this: &lt;jsp:useBean id="dateBean" class="business.DateBean" /&gt; Also you need to import your class into your JSP, so place this at the top: &lt;%@ page import="business.DateBean" %&gt;
has comment: http://stackoverflow.com/comment/41696813
type: Answer
answers question: http://stackoverflow.com/q/25690566

http://stackoverflow.com/q/25692274
has answer: http://stackoverflow.com/a/25692408
has answer: http://stackoverflow.com/a/25692459
has comment: http://stackoverflow.com/comment/40156636
type: AnsweredQuestion
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/25692437
tagged with: java
possible better answer: http://stackoverflow.com/a/25692408
has answer: http://stackoverflow.com/a/25692437
type: Question
has title: Java - Format numbers in scientific notation
tagged with: double
linked to: http://stackoverflow.com/q/2944822
has body: I want to format this String: String number = "3.4213946120686956E-9"; to this: String number = "3.42E-9"; Rounding to 2 decimals. How can I achieve it?

moxy
tag name: moxy
tags question: http://stackoverflow.com/q/25609869
type: Tag

http://stackoverflow.com/a/25627466
accepted answer of: http://stackoverflow.com/q/25627318
upvote count: 4
answers question: http://stackoverflow.com/q/25627318
has body: Just like you define the prefix PREFIX res: &lt;http://dbpedia.org/resource/&gt;, you need to specify a prefix for dbpedia-owl. Using DBPedia's Predefined Namespace Prefixes, I assume the updated query would look like this: PREFIX res: &lt;http://dbpedia.org/resource/&gt; PREFIX dbpedia-owl: &lt;http://dbpedia.org/ontology/&gt; SELECT DISTINCT ?string WHERE { res:David_Cameron dbpedia-owl:birthPlace ?string . }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40066445
type: Answer
score: 4

http://stackoverflow.com/comment/40015538
type: QuestionComment
comment on: http://stackoverflow.com/q/25614637
has text: I think you need to install Java 6 SDK. (Java 1.6 = Java 6)
score: 0
type: Comment

http://stackoverflow.com/comment/40092742
score: 0
type: Comment
type: QuestionComment
has text: could you please tell me why vote down?
comment on: http://stackoverflow.com/q/25656937

http://stackoverflow.com/comment/40326439
score: 0
type: AnswerComment
has text: That means you have JSON which is invalid.
comment on: http://stackoverflow.com/a/25703937
type: Comment

http://stackoverflow.com/q/25590435
has comment: http://stackoverflow.com/comment/39972984
tagged with: java
has comment: http://stackoverflow.com/comment/39973109
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39971248
has comment: http://stackoverflow.com/comment/39972963
has body: We can set qualifier names for a bean (for example @Qualifier(value="myBeanQualifiedName") ) . but I want to know how to set a Qualifier name at run time in a @Configuration class. Assume based on a application logic I want to give a name to a bean as a qualifier in a configuration file. EDITED: ConcreteBean is a child class of MyAbstractBean. @Configuration public class MyBeanFactory { @Bean public MyAbstractBean getMySpecifiedBean(String condition){ String QUALIFIER_NAME="QulifierName"+condition; if(//some condition here ){ //How to set a qualifier name :QUALIFIER_NAME for this ConcreteBean instance? MyAbstractBean b1= new ConcreteBean(); b1.setService(new AnotherService1); // and set some field values to this concrete bean return b1; } else { MyAbstractBean b2= new ConcreteBean(); b2.setService(new AnotherService2); return b2; } } } Assume getMySpecifiedBean() method is called from different locations and each location need difference instances, but the type of ConcretBean(). Instances are differ each other because of the setService() method set different property values. Therefore, the b1 and b2 will do difference things with its service instance where they are used. In my above example, based on the condition, the QUALIFIER_NAME name will be changed.Then Can we assign the prepared QUALIFIER_NAME to the qualifier name to the newly created bean? and how to get such beans with the qualifier name (qualifier name is known) ? For example in another location, String qalifierName="QulifierName" + preparedConditionedString; @Autowired @Qualified (qalifierName) String qalifierName2="QulifierName" + preparedConditionedString2; @Autowired @Qualified (qalifierName2) Also you may think what if we hard code the qualifiers.. but think what if there 20 or more instances to be created ? We have to repeat the codes.
has answer: http://stackoverflow.com/a/25602419
accepted answer: http://stackoverflow.com/a/25602419
has comment: http://stackoverflow.com/comment/39972018
favorite count: 0
type: Question
tagged with: jakarta-ee
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/39971959
has title: How to set a bean qualifier name at run time in Spring
tagged with: spring
has comment: http://stackoverflow.com/comment/39971341
has comment: http://stackoverflow.com/comment/39972007
has comment: http://stackoverflow.com/comment/39972763
has comment: http://stackoverflow.com/comment/39973031
type: AnsweredQuestion
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/39977782

http://stackoverflow.com/q/25575655
tagged with: utf-8
tagged with: http://stackoverflow.com/tag/xml
has title: Can´t show UTF-8 encoding in generated XML by Apache Jena
favorite count: 0
type: Question
upvote count: 4
tagged with: encoding
tagged with: jena
downvote count: 0
accepted answer: http://stackoverflow.com/a/25576328
score: 4
has answer: http://stackoverflow.com/a/25576328
type: AnsweredQuestion
has body: I want that Apache Jena generates an XML with &lt;?xml version="1.0" encoding="UTF-8"?&gt; My code: RDFWriter writer = myJenaModel.getWriter("RDF/XML-ABBREV"); writer.setProperty("showXmlDeclaration", "true"); FileOutputStream fos = new FileOutputStream(filepath); OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); writer.write(myJenaModel, osw, null); only generates &lt;?xml version="1.0"?&gt; But, if I change OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); to OutputStreamWriter osw = new OutputStreamWriter(fos, "ISO-8859-1"); it generates &lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; as expected. I tried to follow the instruction in Jena documentation, but had no success. Does anyone know how can I make Jena generate my RDF/XML with the UTF-8 encoding declaration?
tagged with: java
answer count: 1
linked to: http://stackoverflow.com/q/6302544

http://stackoverflow.com/q/25669917
tagged with: junit4
has answer: http://stackoverflow.com/a/25671200
has answer: http://stackoverflow.com/a/25669959
has answer: http://stackoverflow.com/a/25670603
type: AnsweredQuestion
answer count: 3
downvote count: 0
has body: So, for example I have a few classes implementing the List&lt;T&gt; interface. How to test them - whether they implement the methods correctly? Now I only see one way to do so: public class MyListImplementationsTest { private Collection&lt;List&lt;Integer&gt;&gt; listImplementations; @BeforeClass public static void setUp() throws Exception { listImplementations = Arrays.asList( new QuickList&lt;Integer&gt;(), new EfficientMemoryList&lt;Integer&gt;() ); } @Test public void testIsEmptyAfterCreationEmptyList() { // Use forEachList(handler) in order to not iterate // the lists manually every time. // May be there is no need to do so, // because using &lt;&lt;for (item : items)&gt;&gt; instead of // iterating using index prevents from OutOfBounds errors forEachList(new OnEachListHandler&lt;Integer&gt;() { @Override public void onEach(List&lt;Integer&gt; list) { assertTrue(list.isEmpty()); } }); } private &lt;T&gt; void forEachList(OnEachListHandler&lt;T&gt; handler) { for (List&lt;T&gt; each : listImplementations) { handler.onEach(each); } } private static interface OnEachListHandler&lt;T&gt; { void onEach(List&lt;T&gt; each); } } But in my opinion it's complicated to iterate lists in every test. Is there more elegant way to test classes implementing the same interface in JUnit4?
upvote count: 1
accepted answer: http://stackoverflow.com/a/25669959
score: 1
tagged with: java
tagged with: junit
possible better answer: http://stackoverflow.com/a/25670603
favorite count: 0
type: Question
has title: The best way to test classes implementing the same interface

http://stackoverflow.com/comment/40204738
comment on: http://stackoverflow.com/a/25701291
type: Comment
has text: you can vote my answer up so that it will be easy for others to find the answer for the same question
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40060614
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25639515
score: 0
has text: `Persistence` and `EntityManagerFactory` normally are provided by the same jar (e.g. javaee-api-7.0.jar), can you tell us which one you are using?

http://stackoverflow.com/q/25552491
type: Question
upvote count: 4
answer count: 2
has title: Servlet 3.1 - Security Constraints - Without web.xml
has answer: http://stackoverflow.com/a/25562633
downvote count: 0
favorite count: 0
type: AnsweredQuestion
tagged with: security
tagged with: web.xml
possible better answer: http://stackoverflow.com/a/25562633
has body: The Java Servlet 3.0 and 3.1 specifications allow developers to perform many of the common configuration based tasks in Java code rather than via the traditional mechanism of providing a web.xml file. I have all of this working for my application, but upon looking to tackle application security, I could not find any reference to how or if it is possible to also configuration application security constraints via code. Basically, I am looking for a programmatic way to do the following: <web-resource-collection> my-secure-webapp /* GET POST </web-resource-collection> SSORole CLIENT-CERT SSORole Is anyone aware of a means to do this? thanks
accepted answer: http://stackoverflow.com/a/25564532
tagged with: java
has answer: http://stackoverflow.com/a/25564532
score: 4
tagged with: servlets

http://stackoverflow.com/q/25624251
linked to: http://stackoverflow.com/q/12015980
answer count: 5
has answer: http://stackoverflow.com/a/25624417
has answer: http://stackoverflow.com/a/25624283
accepted answer: http://stackoverflow.com/a/25624283
upvote count: 89
has title: List.addAll throwing UnsupportedOperationException when trying to add another list
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/52291932
has answer: http://stackoverflow.com/a/25624334
score: 88
possible better answer: http://stackoverflow.com/a/48960070
tagged with: java
linked to: http://stackoverflow.com/q/5755477
downvote count: 1
has body: List.addAll throwing UnsupportedOperationException when trying to add another list. List&lt;String&gt; supportedTypes = Arrays.asList("6500", "7600"}; and in loop I am doing, supportedTypes.addAll(Arrays.asList(supportTypes.split(","))); //line 2 reading supportTypes from a file. But line 2 throws a UnsupportedOperationException, but I am not able to determine why? I am adding another list to a list, then why this operation is unsupported?
has answer: http://stackoverflow.com/a/48960070
favorite count: 0
type: Question
duplicate of: http://stackoverflow.com/q/5755477

http://stackoverflow.com/comment/40171963
type: Comment
comment on: http://stackoverflow.com/q/25700652
score: 0
type: QuestionComment
has text: @rahulserver Not necessarily. But if you follow the [installation instructions](http://maven.apache.org/download.cgi) in the download page you could make it work from the command line.

http://stackoverflow.com/q/25651445
possible better answer: http://stackoverflow.com/a/25651640
tagged with: java
tagged with: jpanel
type: AnsweredQuestion
upvote count: 0
downvote count: 2
answer count: 2
has body: I've got a popular problem. I've read a lot about it, but I still can't solve it. I'm coding something like MSW Logo (Turtle graphics interpreter) and I want to save my image (drawn on class extending JPanel). The problem is that saved image is blank (only white background, nothing more, no shapes). From posts on StackOverflow I noticed, that drawing on JPanel is wrong and I should draw on BufferedImage, but I don't know how to apply this tip to my source code. Please, help me get off the ground. Thanks a lot! :) My class extending JPanel: public class TurtlePanel extends JPanel { public TurtlePanel() { super(); this.setPreferredSize(new Dimension(481, 481)); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); } } Creating the panel: public class PanelView { private JPanel panel; private MainWindowView mainView; public PanelView(MainWindowView mainView) { this.mainView = mainView; createView(); } private void createView() { panel = new TurtlePanel(); panel.setBounds(280, 30, 481, 481); panel.setBackground(Color.WHITE); panel.setVisible(true); mainView.mainWindow.add(panel); } public JPanel getPanel() { return this.panel; } } The way I'm drawing shapes (it works, shapes are displaying on my panel): private void drawCircle(double radius) { if(Math.signum(radius) == -1) throw new NumberFormatException(); if(turtleModel.isShown()) { Graphics2D g = ((Graphics2D) panelView.getPanel().getGraphics()); g.setColor(turtleModel.getPenColor()); g.draw(new Ellipse2D.Double(turtleModel.getPosX() - radius, turtleModel.getPosY() - radius, 2*radius, 2*radius)); } } The way I'm trying to save my image: try { BufferedImage image = new BufferedImage(panelView.getPanel().getWidth(), panelView.getPanel().getHeight(), BufferedImage.TYPE_INT_RGB); Graphics graphics = image.getGraphics(); panelView.getPanel().paint(graphics); ImageIO.write(image, ext, new File(path)); } catch(IOException exc) { exc.printStackTrace(); } Again, thank You for help! If You need addition…
has answer: http://stackoverflow.com/a/25651842
tagged with: bufferedimage
has title: Java - saving JPanel as an image
accepted answer: http://stackoverflow.com/a/25651842
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25651640
score: -2

http://stackoverflow.com/q/25635748
answer count: 1
tagged with: tomcat7
tagged with: xslt
has answer: http://stackoverflow.com/a/25639398
has title: What libraries are used by Tomcat 7 and Websphere v8.5 for compiling xslt?
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25639398
tagged with: websphere-6.1
has body: We notice significant differences in performance between Tomcat 7 and Websphere 6 in our web application. Same war file was deployed in these two web containers. The bottleneck in Websphere is when it compiles the stylesheets (seen in logs as "XL TXE-J compiling stylesheet: jstl"). It takes about 2 to 3 seconds in Websphere and a few milliseconds in Tomcat. The answer will help us identify our next step to fix the slow XML codes. Thanks in advance!

http://stackoverflow.com/a/25600588
has comment: http://stackoverflow.com/comment/39997622
downvote count: 0
has comment: http://stackoverflow.com/comment/39992363
upvote count: 2
has comment: http://stackoverflow.com/comment/39997993
has body: @dave try adding @MapKeyColumn(name = "dashletdata_dashlet_id") on the property dashletData instead on getter
type: Answer
has comment: http://stackoverflow.com/comment/39991428
score: 2
has comment: http://stackoverflow.com/comment/39990533
has comment: http://stackoverflow.com/comment/39991528
has comment: http://stackoverflow.com/comment/40019561
answers question: http://stackoverflow.com/q/25600244
has comment: http://stackoverflow.com/comment/39992435

http://stackoverflow.com/q/25668116
has comment: http://stackoverflow.com/comment/40113107
duplicate of: http://stackoverflow.com/q/19963581
has comment: http://stackoverflow.com/comment/40113016
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/40112485
tagged with: java
has comment: http://stackoverflow.com/comment/40113246
tagged with: string
linked to: http://stackoverflow.com/q/6700374
has comment: http://stackoverflow.com/comment/40112646
type: Question
has comment: http://stackoverflow.com/comment/40112836
has title: android text animation in textview
linked to: http://stackoverflow.com/q/19963581
type: UnansweredQuestion
tagged with: android
has body: i have one question.i have one textview and one String and i try to show this text in texview(i can show it).but i have one option: for example ,i have String "Android example".i want to settext my texview each Letters runtime A An And and etc String text = "Android example"; char[] chartext = new char[text.length()]; for (int i = 0; i &lt; chartext.length; i++) { StringBuffer sb = new StringBuffer(); sb.append(text); try { Thread.sleep(20); txt.setText(sb.toString()); } catch (InterruptedException e) { e.printStackTrace(); } } i wrote some code but i can show string in textview but i have not recive same as result such as i told. how i can solve my problem if anyone knows solution please help me
tagged with: stringbuffer

http://stackoverflow.com/q/25620749
type: Question
has title: Generate a combination of possible words based on specific letter rule substitutions in Java
has answer: http://stackoverflow.com/a/25624957
has answer: http://stackoverflow.com/a/25625370
linked to: http://stackoverflow.com/q/18165937
has body: I'm having a little difficulty figuring the best way to go about about generating combinations for specific letters recursively. Presently, I have a method which would changes a String and alters certains characters to create a single substitution of a word. However, this isn't going to satisfy for the different combinations for the word. For example, if I have the word kjng commonly mistaken printer characters such as: [j=&gt;i, i=&gt;j, v=&gt;u, u=&gt;v, s=&gt;f, f=&gt;s, uu=&gt;w, vv=&gt;w] (map lookup, "=&gt;" this is symbolic for key, value representation to make it extra clear) Based on this method, the word would then become king. That's fine for a word with only one possibility. However along comes murdir which should generate the following: murdir mvrdjr mvrdir murdjr A little advice on this would be great, presently I'm unsure of how best to go manage this scenario. For instance, how to keep track of the changes, do it in chunks of characters (1, then 2, then 3, etc).
has comment: http://stackoverflow.com/comment/40034859
tagged with: recursion
has comment: http://stackoverflow.com/comment/40032336
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40033711
accepted answer: http://stackoverflow.com/a/25626862
possible better answer: http://stackoverflow.com/a/25624957
has comment: http://stackoverflow.com/comment/40034919
has comment: http://stackoverflow.com/comment/40033167
answer count: 3
has answer: http://stackoverflow.com/a/25626862
tagged with: java

http://stackoverflow.com/comment/40044957
type: QuestionComment
comment on: http://stackoverflow.com/q/25630640
has text: At a guess, because the earlier JAVA_HOME\bin value is already in the PATH and appears first.
score: 2
type: Comment

http://stackoverflow.com/q/25667864
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/40112370
has comment: http://stackoverflow.com/comment/40112962
has comment: http://stackoverflow.com/comment/40113100
has comment: http://stackoverflow.com/comment/40112184
has title: In what occasions can we get a NullPointerException("Name is null"); error?
accepted answer: http://stackoverflow.com/a/25669055
downvote count: 4
type: AnsweredQuestion
score: 3
tagged with: nullpointerexception
has body: Besides, the valueOf() method of Java's Enum class API, does anyone know, if any other Java API class throws that same exception, i.e., NullPointerException("Name is null");?
upvote count: 7
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40111987
has answer: http://stackoverflow.com/a/25669055
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40112915

http://stackoverflow.com/comment/40108175
score: 1
has text: Logcat will surely help. The question is if you know how to read it. Post it here, and we can help you. And post relevant code!
comment on: http://stackoverflow.com/q/25665964
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25576484
has answer: http://stackoverflow.com/a/25576593
has body: I am writing a program for a recursive binary search. I have an input file with a series of sorted numbers, which I added to an ArrayList. The program searches to see if a key given by user input is in the ArrayList. public static int binarySearch(int key, int median){ if(key == (int)array.get(median)){ return key; }else if(key &lt; (int)array.get(median)){ binarySearch(key,median-1); }else if(key &gt; (int)array.get(median)){ binarySearch(key,median+1); } return -1; } For example, let's say the key is 90. I debugged and placed watches at key and array.get(median). After stepping through the program, I discovered that even when key and array.get(median) are equal to 90, the program continues through the loop without ever returning the key. I know that recursion isn't ideal for this, but it's what I need to use.
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/39945874
has comment: http://stackoverflow.com/comment/39945971
has answer: http://stackoverflow.com/a/25576574
upvote count: 1
has answer: http://stackoverflow.com/a/25577119
has answer: http://stackoverflow.com/a/41757999
favorite count: 0
type: Question
tagged with: binary-search
tagged with: recursion
answer count: 5
has title: Binary Search using Recursion in java
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25576540

jenkins-plugins
tags question: http://stackoverflow.com/q/25650361
tags question: http://stackoverflow.com/q/25563603
tags question: http://stackoverflow.com/q/25618573
tags question: http://stackoverflow.com/q/25623360
tag name: jenkins-plugins
tags question: http://stackoverflow.com/q/25661386
type: Tag

http://stackoverflow.com/comment/39983114
comment on: http://stackoverflow.com/q/25596830
type: Comment
type: QuestionComment
has text: when I added multiLineTextLabel to your layout, it works perfectly
score: 0

http://stackoverflow.com/q/25668945
tagged with: mysql
upvote count: 8
favorite count: 0
type: Question
tagged with: jakarta-ee
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25670220
tagged with: jpa
has title: JPA @GeneratedValue(strategy=GenerationType.AUTO) does not work on MySQL
answer count: 4
has answer: http://stackoverflow.com/a/48139644
has body: I have an entity that is supposed to get an id from the database automatically. I use MySQL so I would expect annotating that @GeneratedValue(strategy=GenerationType.AUTO) would resolve to IDENTITY behind the scenes and NOT SEQUENCE. However, when I try to persist a new entity it fails saying that hibernate_sequence was not found. It obviously use sequence strategy instead of identity. I have set the dialect in the persistence.xml to: org.hibernate.dialect.MySQL5InnoDBDialect Hibernate version 4.2.0.CR1 All sources that I read says that it should use identity when connecting to MySQL with auto as strategy.
score: 7
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25719735
downvote count: 1
has answer: http://stackoverflow.com/a/25669639

http://stackoverflow.com/q/25649790
accepted answer: http://stackoverflow.com/a/25649822
has answer: http://stackoverflow.com/a/25649822
tagged with: isenabled
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: javafx
answer count: 1
has body: In Swing we can do something like JButton button = new JButton("button") { public boolean isEnabled() { return ...condition...; } }; Since isDisable() / isDisabled() of a JavaFX Button is declared final - what is the equivalent for enabling or disabling a JavaFX button conditionally?
type: Question
has title: Swing to JavaFX - equivalent of overriding a button's isEnabled() method?
tagged with: swing

http://stackoverflow.com/comment/40104329
type: Comment
has text: How long does it take to download `grrrr`? Note that the command didn't error out - it hit a timeout.
type: QuestionComment
comment on: http://stackoverflow.com/q/25661784
score: 1

http://stackoverflow.com/q/25693024
has answer: http://stackoverflow.com/a/25693138
tagged with: bounded-wildcard
has answer: http://stackoverflow.com/a/25693093
linked to: http://stackoverflow.com/q/2723397
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25693080
score: 0
has comment: http://stackoverflow.com/comment/40159235
has answer: http://stackoverflow.com/a/25693806
tagged with: java
has comment: http://stackoverflow.com/comment/40158088
tagged with: generics
has title: A simple clarification about Wild Cards in Java
answer count: 4
type: Question
has body: I just read about Wild Cards in Java, and I'm looking at a case in which I have 2 classes, ParentClass and SubClass which inherits from it. (ParentClass, SubClass extends ParentClass) Now I write these lines. List&lt;? super ParentClass&gt; list1 = new ArrayList&lt;ParentClass&gt;(); list1.add(new SubClass()); I can't understand why this compiles and runs. Shouldn't line 2 cause a compilation error, since I'm trying to add a child of ParentClass to a list that is supposed to hold only fathers of ParentClass? Thank you!

http://stackoverflow.com/comment/39988885
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25599990
type: QuestionComment
has text: -1 title and logcat you gave are not enough constructive to solve your problem, fix it and give more information.

http://stackoverflow.com/q/25576558
tagged with: double
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/25576601
type: AnsweredQuestion
has body: First off, I want to say that I know this has been asked before at the following location (among others), but I have not had any success with the answers there: Create ArrayList from array What I am trying to do is the following: double[] FFTMagnitudeArray = processAudio.processFFT(audioData); List&lt;Double&gt; FFTMagnitudeList = Arrays.asList(FFTMagnitudeArray); audioData.setProperty("FFTMagnitudeList", FFTMagnitudeList); However, I get the error: "Type mismatch: cannot convert from List&lt;double[]&gt; to List&lt;Double&gt;" This makes no sense to me, as I thought the List was necessary and the Array.asList(double[]) would return a list of Double, not double[]. I have also tried the following, to no avail: List&lt;Double&gt; FFTMagnitudeList = new ArrayList&lt;Double&gt;(); FFTMagnitudeList.addAll(Arrays.asList(FFTMagnitudeArray)); List&lt;Double&gt; FFTMagnitudeList = new ArrayList&lt;Double&gt;(Arrays.asList(FFTMagnitudeArray)); And I keep getting the same error. So how do I create the List?
score: 2
tagged with: list
has answer: http://stackoverflow.com/a/25576607
answer count: 3
tagged with: java
linked to: http://stackoverflow.com/q/157944
possible better answer: http://stackoverflow.com/a/25576601
has answer: http://stackoverflow.com/a/25576881
favorite count: 0
accepted answer: http://stackoverflow.com/a/25576607
type: Question
upvote count: 2
has title: How to create a list of doubles out of an array of doubles

http://stackoverflow.com/q/25576845
accepted answer: http://stackoverflow.com/a/25577123
tagged with: android-camera
has answer: http://stackoverflow.com/a/25577123
tagged with: android
linked to: http://stackoverflow.com/q/9671546
type: AnsweredQuestion
score: 0
tagged with: textureview
tagged with: java
tagged with: multithreading
answer count: 1
has body: Am using Textureview.getBitmap() to grab frames every second from a Camera preview. it works perfectly except that it causes the main Ui thread to be Sluggish and sometimes even crash. please what do i need to do??.thanks Here is my Code: mCountDownTimer=new CountDownTimer(7000,500) { @Override public void onTick(long millisUntilFinished) { Log.v("Log_tag", "Tick of Progress"+ i+ millisUntilFinished); i++; mProgressBar.setProgress(i); Bitmap bmps = mTextureView.getBitmap(); ByteArrayOutputStream out = new ByteArrayOutputStream(); bmps.compress(Bitmap.CompressFormat.JPEG , 0, out); rev.add(bmps); } @Override public void onFinish() { //Do what you want i++; mProgressBar.setProgress(i); mCountDownTimer.cancel(); } };
has title: Textureview.getBitmap() making Main Ui thread sluggish
type: Question

http://stackoverflow.com/comment/40002769
has text: Tipycal of Struts1: messing with easy things just to make them complicated. BTW that is not a "feature", that is a hack, even on Struts1. If it is not working on S2, it probably means that you need another hack on top of that. You can probably hack the way parameters are sent to match your setter in a S2 compliant way, but you are bypassing OGNL and the framework mechanisms, and I still don't understand why would this be cheaper or cleaner than rewriting the tags. You still have to write code for this to work, even more. Is writing action code cheaper than writing JSP code ?
comment on: http://stackoverflow.com/a/25601611
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/100194833
comment on: http://stackoverflow.com/a/25636097
score: 0
type: Comment
type: AnswerComment
has text: I've tried every solution you posted and in the end the one that worked was using this Launcher.class.getResource() where Launcher is my main.

http://stackoverflow.com/comment/40077261
score: 2
type: Comment
has text: @Gus No, it shouldn't. The test is whether the length of the input is divisible by 3, and `dome` contains the length of the input.
type: QuestionComment
comment on: http://stackoverflow.com/q/25648180

http://stackoverflow.com/comment/40084431
has text: Like this? Foo[] array = list.toArray(new Foo[list.size()]);
comment on: http://stackoverflow.com/a/25652523
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25612744
type: Answer
answers question: http://stackoverflow.com/q/25612668
type: AcceptedAnswer
downvote count: 0
has body: You are getting 404 error meaning page not found. It looks like though the connection was established package manager could not download the tar.gz file. If it is some internal error from oracles site retry should so it. However if you are behind some proxy that is not allowing this transfer there is not much you can do. Either way try doing wget http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-.tar.gz?AuthParam=1409603301_59d736536b051796a298904fd90f70bd and see if you can download the file.
upvote count: 1
has comment: http://stackoverflow.com/comment/40011859
accepted answer of: http://stackoverflow.com/q/25612668
score: 1

http://stackoverflow.com/a/25613814
answers question: http://stackoverflow.com/q/25613694
type: Answer
upvote count: 2
has body: It depends on the driver implementation, some drivers wrap all their set methods around setObject so setObject does less work. However I would normally expect setDate to do less work than setObject. However if setObject is doing what you want then use it. If you have performance issues with databases then swapping setObject with setDate will only fix them if the type was an issue. For instance recently I had a problem with the database wanting me to use setDate instead of setTimestamp. This made a 200ms query take 250 seconds to complete. Swapping setObject for setDate will add less than 1ms to your query. Where setDate has a definite benefit over setObject. Is readability the code is saying I need a Date here rather than saying anything is good.
downvote count: 0
score: 2

http://stackoverflow.com/q/25647528
upvote count: 1
tagged with: variables
has answer: http://stackoverflow.com/a/25647547
possible better answer: http://stackoverflow.com/a/25647547
downvote count: 1
has comment: http://stackoverflow.com/comment/40074970
has body: public class arryTable { public static void main(String[] args) { System.out.println("Index\tValue"); int paco[]={1,2,3,4,5}; for(int counter = 0; counter &lt; paco.length; counter++); System.out.println(counter + "\t" + paco[counter]); } } I get "counter cannot be resolved to a variable". Has the last "counter" underlined. Thank you
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25647585
has answer: http://stackoverflow.com/a/25647645
accepted answer: http://stackoverflow.com/a/25647544
score: 0
has title: "Counter" cannot be resolved to a variable error?
tagged with: java
answer count: 4
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25647544

http://stackoverflow.com/a/25669862
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25669788
has body: Shouldn't this solve your problem? public class GameState { private int planets; public void addPlanets(int amount) { this.planets += amount; } } public class Ship { private int planetsAmount; public void addPlanets(GameState gameState) { gameState.addPlanets(planetsAmount); } } (Edit: good point) You need to have some sort of global variable that keeps track of the number of planets. For this I used the class GameState. So in the start of your program you should make an instance of GameState. You can pass this object if you need the game state to be changed. Your current code doesn't work since you have a variable called planets which is not declared in your class.
accepted answer of: http://stackoverflow.com/q/25669788
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/25687176
has body: Interesting problem, this is my idea: (?m)^(?!.*([ACD]).*\1)(?!(?&gt;.*?B){3})(?&gt;[A-D] ){2}[A-D]$ Used (?m) MULTILINE modifier where ^ matches line start and $ line end. Test at regexplanet (click on Java); regex101 (non Java) If I understood it right, the available character-pot is A,B,B,C,D. A string should be valid, if it contains 0 or 1 of each [ACD] or 0-2 of B in your example. My pattern consists of 3 parts: (?!.*([ACD]).*\1) Used at line-start ^ a negative lookahead to assure, that [ACD] occurs at most one time, by capturing [ACD] to \1 and checking, it does not occur twice anywhere. (?!(?&gt;.*?B){3}) Using a negative lookahead, to assure, B occurs at most 2x. finally (?&gt;[A-D] ){2}[A-D]$ determines the total usable character set, assures the formatting, where each letter must be prededed by space or start and checks the length. This can be easily modified to other needs. Also see SO Regex FAQ
downvote count: 0
has comment: http://stackoverflow.com/comment/40146816
answers question: http://stackoverflow.com/q/25683816
has comment: http://stackoverflow.com/comment/40148970
type: Answer
has comment: http://stackoverflow.com/comment/40146851
score: 2
has comment: http://stackoverflow.com/comment/40148400
has comment: http://stackoverflow.com/comment/40146928
upvote count: 2
has comment: http://stackoverflow.com/comment/40148353

http://stackoverflow.com/a/25697881
upvote count: 1
answers question: http://stackoverflow.com/q/25697842
downvote count: 1
score: 0
has body: If you want to manipulate views or data on the selection of item in Spinner you need to implement ItemSelectedListener to the particular Spinner. Sample Code: // in onCreate() or where you want to bind this Views with XML views { spinner1 = (Spinner) findViewById(R.id.spinner1); spinner3 = (Spinner) findViewById(R.id.spinner3); // mItemSelectedListener Object of OnItemSelectedListener to handle Item Selection to Spinners. spinner1.setOnItemSelectedListener(mItemSelectedListener); spinner3.setOnItemSelectedListener(mItemSelectedListener); } // Creating an Object of Anonymous Class so no need to create another instance for same class // OutSide of onCreate() method. OnItemSelectedListener mItemSelectedListener = new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { switch (view.getId()) { case R.id.spinner1: // Manipulates Views at selection of item in Spinner1 break; case R.id.spinner3: // Manipulates Views at selection of item in Spinner3 break; } } @Override public void onNothingSelected(AdapterView&lt;?&gt; parent) {} };
type: Answer

http://stackoverflow.com/q/25560415
has title: Is there a Linux command to print the current stack of a running Java process
type: AnsweredQuestion
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25560602
has body: Situation: I have a Java1.7 process running in CentOS6 with multiple threads. The process currently halts (i.e., stuck in some kind of loop or waiting function). Due to the complexity nature of the program, it is difficult to do a routine debug in, for instance, Eclipse (more explanation in the background section below). Therefore, I'd like to debug the code by tracing the current running stack. Question: Is there a Linux command that would allow me to print the stack to identify the thread/method that is currently running such that I can find which method is causing the halt? Background: The reasons for not being able to debug in Eclipse: It is a MapReduce program typically run on multiple computers. Even if I use run on one computer, it still involves multiple threads running simultaneously. Most importantly, the "halting bug" occurs randomly (i.e., not being able to reproduce). So my best shot is to identify the current running method that caused the bug. P.S. My approach may be completely wrong, so feel free to correct me and point me in the right direction. Thanks for your help.
tagged with: stack-trace
has answer: http://stackoverflow.com/a/25560436
accepted answer: http://stackoverflow.com/a/25560436
type: Question
tagged with: debugging
tagged with: linux
tagged with: java
possible better answer: http://stackoverflow.com/a/25560602

http://stackoverflow.com/comment/40024812
type: QuestionComment
has text: In Java, `"String" != "Another String"` does not do what you think.
comment on: http://stackoverflow.com/q/25619849
score: 1
type: Comment

http://stackoverflow.com/comment/136803954
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/57840064
score: 0
has text: Context.xml has nothing to do with compilation errors.

http://stackoverflow.com/comment/40184028
has text: I will use Java to generate the time and never rely on the DBMS for the time.
comment on: http://stackoverflow.com/a/25707266
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25646963
answers question: http://stackoverflow.com/q/25646835
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25646835
score: 1
has body: The problem is that str has the value " 2", and the leading space is not legal syntax for parseInt(). You need to either skip the white space between the two numbers in the input or trim the white space off of str before parsing as an int. To skip white space, do this: input.skip("\\s*"); String str = input.nextLine(); To trim the space off of str before parsing, do this: int temp2 = Integer.parseInt(str.trim()); You can also get fancy and read the two pieces of the line in one go: if (input.findInLine("(\\d+)\\s+(\\d+)") == null) { // expected pattern was not found System.out.println("Incorrect input!"); } else { // expected pattern was found - retrieve and parse the pieces MatchResult result = input.match(); int temp1 = Integer.parseInt(result.group(1)); int temp2 = Integer.parseInt(result.group(2)); int total = temp1+temp2; System.out.println(total); }
type: Answer

http://stackoverflow.com/comment/40076772
score: 0
has text: The problem is with the if statement and the loop changes nothing in respect to the if statement.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25648495

http://stackoverflow.com/comment/40098626
score: 0
comment on: http://stackoverflow.com/q/25660300
has text: I dont know if all ParserTask are finished. And if they are not finished in arrayList are not all results.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40112501
score: 1
type: Comment
type: QuestionComment
has text: the requirements as i read them [digits must be 0 or 1, digits must not be reused, there must be at least 5 digits] are not possible in union. this is probably just a phrasing issue, but your question is unclear. did you mean that generated numbers should not repeat?
comment on: http://stackoverflow.com/q/25668144

jakarta-ee
tags question: http://stackoverflow.com/q/25638151
tags question: http://stackoverflow.com/q/25553338
tags question: http://stackoverflow.com/q/25627990
tags question: http://stackoverflow.com/q/25592893
tags question: http://stackoverflow.com/q/25567806
tags question: http://stackoverflow.com/q/25703706
tags question: http://stackoverflow.com/q/25629547
tags question: http://stackoverflow.com/q/25615144
type: Tag
tags question: http://stackoverflow.com/q/25613082
tags question: http://stackoverflow.com/q/25625641
tags question: http://stackoverflow.com/q/25615834
tags question: http://stackoverflow.com/q/25640633
tags question: http://stackoverflow.com/q/25656693
tags question: http://stackoverflow.com/q/25599468
tags question: http://stackoverflow.com/q/25673433
tags question: http://stackoverflow.com/q/25668945
tags question: http://stackoverflow.com/q/25612903
tags question: http://stackoverflow.com/q/25645462
tags question: http://stackoverflow.com/q/25590435
tags question: http://stackoverflow.com/q/25712772
tags question: http://stackoverflow.com/q/25685416
tags question: http://stackoverflow.com/q/25579818
tags question: http://stackoverflow.com/q/25612096
tags question: http://stackoverflow.com/q/25676873
tags question: http://stackoverflow.com/q/25700311
tags question: http://stackoverflow.com/q/25588596
tags question: http://stackoverflow.com/q/25628317
tags question: http://stackoverflow.com/q/25564206
tags question: http://stackoverflow.com/q/25695518
tags question: http://stackoverflow.com/q/25663499
tags question: http://stackoverflow.com/q/25660400
tags question: http://stackoverflow.com/q/25647545
tags question: http://stackoverflow.com/q/25706770
tags question: http://stackoverflow.com/q/25605968
tags question: http://stackoverflow.com/q/25705278
tags question: http://stackoverflow.com/q/25711726
tags question: http://stackoverflow.com/q/25705557
tags question: http://stackoverflow.com/q/25580464
tags question: http://stackoverflow.com/q/25659054
tags question: http://stackoverflow.com/q/25597592
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/25622170
tags question: http://stackoverflow.com/q/25612524
tags question: http://stackoverflow.com/q/25649918
tags question: http://stackoverflow.com/q/25613579
tags question: http://stackoverflow.com/q/25622625
tags question: http://stackoverflow.com/q/25708706
tags question: http://stackoverflow.com/q/25628407
tags question: http://stackoverflow.com/q/25627817
tags question: http://stackoverflow.com/q/25606959
tags question: http://stackoverflow.com/q/25574597
tags question: http://stackoverflow.com/q/25599017
tags question: http://stackoverflow.com/q/25614662
tags question: http://stackoverflow.com/q/25668490
tags question: http://stackoverflow.com/q/25642494
tags question: http://stackoverflow.com/q/25659838
tags question: http://stackoverflow.com/q/25709788

http://stackoverflow.com/a/25630419
has body: It seems that you lost the connection to Maven central half way during the transfer. The problem is that your artifacts could become out of sync with Maven cache. If your local Maven repository is relatively small I would suggest to delete entire repository folder under .m2 and try to rebuild again from the command line (mvn clean install)
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25630172
score: 0
answers question: http://stackoverflow.com/q/25630172

http://stackoverflow.com/a/25711039
type: Answer
answers question: http://stackoverflow.com/q/25710876
score: 2
upvote count: 2
has body: The custom Application injection is driven by the AndroidManifest.xml, so if it's not your application class being instantiated, that could be due to the AndroidManifest.xml being incorrect. Can you check how it looks like in Android Studio, or even in the APKs that the two IDEs generated? There should be an attribute on the &lt;application&gt; tag something like android:name="om.tc.tools.RiddlesHolder".
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40190792
accepted answer of: http://stackoverflow.com/q/25710876

http://stackoverflow.com/a/25586675
has body: Good approach is to seperate visual and reality model. It means deep in the program, you have your "physics rules" and all objects and based on that model, you draw it. You can start with creating class like this public class ObjectInMyGame{ private int posx; private int posy; private int width; private int height; private Image image; private int movingX; private int movingY; //Note that it is good to use Point or something like that, instead of posx, posy. } Then it is good to have some kind of "game controller", which is running your whole world. public class GameController{ List&lt;ObjectInMyGame&gt; objects; public updateGame(){ for (ObjectInMyGame object : objects){ object.doSomething(); //sometimes it is good idea to let objects itself do something } } } So for example, when you move object, you can check, if he collide or not and then decide what to do.
type: Answer
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25586571
accepted answer of: http://stackoverflow.com/q/25586571

http://stackoverflow.com/comment/40176731
comment on: http://stackoverflow.com/q/25702939
type: Comment
type: QuestionComment
score: 0
has text: ok let me see @PrasadKhode

http://stackoverflow.com/a/25562742
upvote count: 5
type: Answer
has body: put the test file in src/test/resources and that will take precedence in classpath while executing tests
answers question: http://stackoverflow.com/q/25561418
score: 5
has comment: http://stackoverflow.com/comment/39920987
accepted answer of: http://stackoverflow.com/q/25561418
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39921012

http://stackoverflow.com/q/25591476
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25591512
downvote count: 0
has answer: http://stackoverflow.com/a/25591657
favorite count: 0
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/39973135
has body: I always use one ActionListenr for a button, but I find that one component can be assigned multiple action listeners. How we can do that and what is use of it Thanks in advance
type: UnansweredQuestion
upvote count: 5
score: 5
tagged with: swing
has title: use of multiple actionlistener for a button

http://stackoverflow.com/a/25696227
score: 1
has comment: http://stackoverflow.com/comment/40164305
has body: You create a new CPU variable in the method setCPU, which gets destroyed when the method ends. It should instead change the instance variable Cpu, so that the information is retained.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25696211

http://stackoverflow.com/q/25706878
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25706886
has answer: http://stackoverflow.com/a/25706886
tagged with: java
type: Question
has body: I have a hashtable with contains the a unique identifier as the key and an object as the value. I'm trying to go through all the values in the hashtable and print out the object's values, but Eclipse is telling me that the object's members cannot be resolved. My code looks like this: Enumeration&lt;myobj&gt; items = myhashtable.elements(); while (items.hasMoreElements()) { System.out.println(items.X + " - " + items.Y.Z()); items.nextElement(); } X is a String and Y is another object within the main object, its method Z returns a string.
answer count: 1
has title: Cannot access members of an object within an enum
has comment: http://stackoverflow.com/comment/40183342

http://stackoverflow.com/a/57270100
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25636632
has body: This worked for me new BigDecimal(cell.getNumericCellValue()).toPlainString()

http://stackoverflow.com/comment/40005399
has text: @Xhulio check out in my answer what FatalError tried to say
comment on: http://stackoverflow.com/q/25608827
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25635953
has body: I have a Computer Programming-K course at my high school, and we use Java as our language. I noticed that you seem to NEED to have the public *static* void main(String[] args) at the beginning of every script. Our main structure is this: public class ( void main() void input() void process() void output() ) And we have to make all void methods static, to be able to call one another, because we can't use a non-static main. Why? What does static mean in Java?
tagged with: void
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25636183
has answer: http://stackoverflow.com/a/25635989
possible better answer: http://stackoverflow.com/a/25635989
score: 0
accepted answer: http://stackoverflow.com/a/25636183
has answer: http://stackoverflow.com/a/25636060
answer count: 3
tagged with: java
has title: Why the need to call static voids from other static voids?
type: Question
tagged with: static

http://stackoverflow.com/comment/40077452
comment on: http://stackoverflow.com/a/25648841
type: AnswerComment
type: Comment
score: 1
has text: (And set it back to `false` after. Best effort.)

http://stackoverflow.com/comment/40196152
has text: @Ben performing changes on document: If done via EDT has the same GUI freeze problem as originally reported. If done out of EDT essentially becomes the same solution I originally proposed - the only difference being that my proposed solution performs the pre document insert actions (code in setText and read described above) outside of the EDT.
type: Comment
comment on: http://stackoverflow.com/a/25705034
type: AnswerComment
score: 0

http://stackoverflow.com/a/25712648
has body: cast error textview to edittext and you cannot settext(integervalue) -> settext(String.valueof(integer)) @Override public void onClick(View v) { // TODO Auto-generated method stub int min = 1; int max = 6; Random r = new Random(); int i1 = r.nextInt(max - min + 1) + min; random.setText(String.valueOf(i1)); } });
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25712498

http://stackoverflow.com/comment/40154293
type: Comment
score: 0
has text: @coffeeaddict I just figured out the mistake.! in my operand class I have a method getValue() which returns the value of the operand. But it is set to the last element that I push. I have kept the variable static that is why it was giving me that error. Thank you!
comment on: http://stackoverflow.com/q/25690499
type: QuestionComment

http://stackoverflow.com/q/25589152
score: 52
answer count: 9
has comment: http://stackoverflow.com/comment/39971079
has answer: http://stackoverflow.com/a/25594234
tagged with: intellij-idea
upvote count: 52
has answer: http://stackoverflow.com/a/42804266
has title: IntelliJ IDEA cannot resolve import javax.servlet.*;
has answer: http://stackoverflow.com/a/50878026
possible better answer: http://stackoverflow.com/a/46764296
has answer: http://stackoverflow.com/a/66941662
has answer: http://stackoverflow.com/a/46764296
tagged with: servlets
has comment: http://stackoverflow.com/comment/39976274
has comment: http://stackoverflow.com/comment/39970773
has comment: http://stackoverflow.com/comment/39976444
type: AnsweredQuestion
has body: So I had my project working perfectly and I decided to install a new hard drive (SSD) and now I cannot get it to run correctly. I am using Intellij and am having all of these imports have issues. import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; They are saying cannot resolve symbol. Also in my web.xml I have this. LoginFilter com.mkyong.LoginFilter it states com.mkyong.LoginFilter is not assignable to javax.servlet.Filter Im going to include my web.xml just in case someone needs it. <?xml version="1.0" encoding="UTF-8"?> JavaServerFaces MySQL Datasource example jdbc/mkyongdb javax.sql.DataSource Container javax.faces.PROJECT_STAGE Development faces/default.xhtml Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet /faces/* Faces Servlet *.jsf Faces Servlet *.faces Faces Servlet *.xhtml LoginFilter com.mkyong.LoginFilter LoginFilter /secured/* secured/welcome.xhtml This is the error I am getting now. javax.servlet.ServletException: Servlet.init() for servlet Faces Servlet threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:534) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:277) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2381) org.apache.tomcat.util.net.A…
accepted answer: http://stackoverflow.com/a/25590217
has comment: http://stackoverflow.com/comment/39977021
has comment: http://stackoverflow.com/comment/39968805
has answer: http://stackoverflow.com/a/63711654
has answer: http://stackoverflow.com/a/25590217
has comment: http://stackoverflow.com/comment/39969979
tagged with: java
downvote count: 0
tagged with: tomcat
has answer: http://stackoverflow.com/a/74394504
has comment: http://stackoverflow.com/comment/39976608
has comment: http://stackoverflow.com/comment/39976329
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39969700
has answer: http://stackoverflow.com/a/59654598

http://stackoverflow.com/a/25712209
score: 1
type: Answer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25712029
has body: int n = 9; for (int i = 0; i < n; i++) { for (int k = n - 1; k > i; k--) { System.out.print(" "); } for (int j = 0; j < 2 * i + 1; j++) { System.out.print("*"); } System.out.println(""); } for (int j = 0; j < n - 1; j++) { for (int k = j; k >= 0; k--) { System.out.print(" "); } for (int i = 2 * (n - j - 1) - 1; i > 0; i--) { System.out.print("*"); } System.out.println(""); } Output: * *** ***** ******* ********* *********** ************* *************** ***************** *************** ************* *********** ********* ******* ***** *** *

http://stackoverflow.com/q/25653229
favorite count: 0
type: Question
has title: Is reclassing exceptions good practice?
score: 3
linked to: http://stackoverflow.com/q/9229991
tagged with: exception
tagged with: java
has body: Sometimes I reclass an exception like this: try{ methodA(param1); }catch(ExceptionType1 ex){ throw new ExceptionType2(ex); } An example of when I do this is when methodA's params should be safe and will not throw exceptions, so the ExceptionType1 is really indicative of a different problem (something like ExceptionType2). This is not reclassing from checked exception to unchecked.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25653310
possible better answer: http://stackoverflow.com/a/25653369
answer count: 2
has answer: http://stackoverflow.com/a/25653369
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40085811
accepted answer: http://stackoverflow.com/a/25653310

http://stackoverflow.com/comment/40212461
comment on: http://stackoverflow.com/a/25656595
has text: thank you for your another suggestion, but I think I'll just stick around with the first solution you gave me, an index as the entry point for my pages
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/a/25653794
has comment: http://stackoverflow.com/comment/40090066
has comment: http://stackoverflow.com/comment/40087281
has comment: http://stackoverflow.com/comment/40092233
has comment: http://stackoverflow.com/comment/40113737
answers question: http://stackoverflow.com/q/25653702
score: 1
has comment: http://stackoverflow.com/comment/40111983
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25653702
has body: Tonga, The first thing that comes to my mind is to ensure that the ScheduledExecutor is properly being invoked and running when you expect it to run. I would first try to confirm this by changing your DELETE statement into a "INSERT" statement, and if you want, put in some output to your logger. Once you have verified this, I would try to run your query through MySQL workbench with the parameters you desire. Once this clears, I would try to log the parameters that are being fed to your ScheduledExecuter, and make sure they are as expected. Once you have verified all of these, your query should be executing as expected! :-) Another way of approaching this problem is by using scheduled procedural calls. What you can do is have the procedure you've described above ported to your MySQL's PL, and have it run every n seconds. You'll be loosing visibility of the code by doing this, but it's also another neat way of running procedures every n seconds. The advantage to this, is that the ScheduledExecutor can have concurrency issues if it starts to become complex, and it's simply easier and more straight forward to use a MySQL procedure for this instead. You can use mysql scheduler to run it each 5 seconds. You can find samples at http://dev.mysql.com/doc/refman/5.1/en/create-event.html You can schedule a stored procedure in MySQL in the following manner: CREATE EVENT myevent ON SCHEDULE EVERY 5 SECOND DO delete_rows_links(); Please let me know if you have any questions!
has comment: http://stackoverflow.com/comment/40119493
has comment: http://stackoverflow.com/comment/40091738
has comment: http://stackoverflow.com/comment/40090046
has comment: http://stackoverflow.com/comment/40110326
has comment: http://stackoverflow.com/comment/40092275
has comment: http://stackoverflow.com/comment/40090238
has comment: http://stackoverflow.com/comment/40087071
has comment: http://stackoverflow.com/comment/40115784
has comment: http://stackoverflow.com/comment/40087471
downvote count: 0
has comment: http://stackoverflow.com/comment/40087963
type: Answer
has comment: http://stackoverflow.com/comment/40092323
upvote count: 1
has comment: http://stackoverflow.com/comment/40116108
has comment: http://stackoverflow.com/comment/40117746

http://stackoverflow.com/comment/40097048
type: Comment
has text: @maaartinus you are right i should have said codereview (not enough coffee)
comment on: http://stackoverflow.com/q/25659045
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40046954
type: Comment
has text: Also, your question has examples where you want space and `:` in the result, but your `leftRegEx` and `rightRegEx` patterns won't allow that because space and `:` won't match `\\w`.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25631530

http://stackoverflow.com/comment/40183746
type: Comment
comment on: http://stackoverflow.com/q/25707051
type: QuestionComment
has text: see answer below. why you have created separate StudentList class instead of using LinkedList directly?
score: 0

http://stackoverflow.com/comment/39978772
type: Comment
comment on: http://stackoverflow.com/a/25590562
type: AnswerComment
has text: I need to check the total number of values in the drop down and verify that 'Tourism' is selected in the drop down, If 'Tourism' is selected, output will be 'tourism is present'.
score: 0

http://stackoverflow.com/a/25641729
has comment: http://stackoverflow.com/comment/40101281
score: 0
has comment: http://stackoverflow.com/comment/40102908
answers question: http://stackoverflow.com/q/25640838
type: Answer
has body: The best way is to use a serialization "scheme" (for lack of better word) to serialize your POJO into a serialized stream that can be demarshalled by Android. The most common format used in modern day programming technology is JSON, so using JSON in mind, you can create a service that will render your POJO to a JSON Object and your Android app will deserialize it from JSON to POJO. A service can be a Restful Web Service or you can create a custom service that renders your POJO to JSON. Java 7 now includes JSR-353, JSON Processing (JSON-P for short) and this gives your various functionalities and classes to provide JSON marshalling and unmarshalling. A simple tutorial can be found here. In your Android app, you can then use GSON to do JSON unmarshalling. I hope this help.

http://stackoverflow.com/comment/39915982
has text: Yeah I like how C# uses `as`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25560726
type: Comment

http://stackoverflow.com/comment/40169383
score: 0
has text: Please explain that a bit. I always thought the `+` operator was the concatenation operator. Also AFAIK it's the only way to make a concatenation happen at compile time (concatenation of constant expressions). Therefore it would be better to write a bit more than "it's syntactic sugar".
type: Comment
comment on: http://stackoverflow.com/a/25697642
type: AnswerComment

http://stackoverflow.com/comment/40149323
comment on: http://stackoverflow.com/q/25688642
type: Comment
has text: You should pass `Class<T> clazz` as argument to your method.
type: QuestionComment
score: 2

http://stackoverflow.com/comment/40155210
type: AnswerComment
has text: yes that works. But it is not convenient to add the path every time I run it. Can I put the jar to where these standard library jars files are located?
comment on: http://stackoverflow.com/a/25691466
type: Comment
score: 0

http://stackoverflow.com/a/25595937
has comment: http://stackoverflow.com/comment/39981565
has body: The condition (boolean &amp;&amp; boolean) only returns true if both values are true. So true &amp;&amp; false -> false. So one of them may be null. Use || instaed of &amp;&amp;, this will return true if one of the conditions is true.
has comment: http://stackoverflow.com/comment/39981613
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39981599
upvote count: 1
answers question: http://stackoverflow.com/q/25595843
type: Answer
has comment: http://stackoverflow.com/comment/39981406
has comment: http://stackoverflow.com/comment/39981438

http://stackoverflow.com/comment/40182469
type: QuestionComment
score: 4
has text: `Employee:”Timothy Jones” and Job:”Senior Management” and Hired:”2003”` is not a valid string in Java. Please format your code and fix it so that it compiles before you post it.
comment on: http://stackoverflow.com/q/25706385
type: Comment

http://stackoverflow.com/q/25663801
tagged with: webview
upvote count: 1
favorite count: 0
has title: Android Webview app not downloading successful
has body: My Android app has a Webview to access to my website. I noticed in the server that when a file is downloaded by the app the bandwidth used is less than when is downloaded by another device or browser. In method onDownloadStart I call to an AsyncTask class: protected String doInBackground(String... sUrl) { try { URL url = new URL(sUrl[0]); //Getting directory to store the file //Connection handler HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.connect(); //Obtaining filename File outputFile = new File(directory, filename); InputStream input = new BufferedInputStream(connection.getInputStream()); OutputStream output = new FileOutputStream(outputFile); byte buffer[] = new byte[1024]; int bufferLength = 0; int total = 0; while ((bufferLength=input.read(buffer))!=-1) { total += bufferLength; output.write(buffer, 0, bufferLength); } connection.disconnect(); output.flush(); output.close(); input.close(); } catch (Exception e) { e.printStackTrace(); } return null; } Files downloaded are empty altough their filename and format are correct and I receive HTTP 200 message from the server; also execution does not enter into the while loop. I have tried to change buffer size and the problem is not solved.
score: 1
tagged with: android
tagged with: java
type: Question
answer count: 0
type: UnansweredQuestion
downvote count: 0

http://stackoverflow.com/a/25561008
upvote count: 1
score: 1
has body: for(int i = 1; i &lt; 101; i++;) { if (i % inputValue != 0) { System.out.println(i); } }
type: Answer
answers question: http://stackoverflow.com/q/25560876
downvote count: 0

http://stackoverflow.com/comment/39950275
has text: It hangs (on my side) because it can not open socket to `10.30.56.70:8080`. When I try to `telnet 10.30.56.70 8080` from command line it hangs as well.
comment on: http://stackoverflow.com/q/25563430
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40158820
comment on: http://stackoverflow.com/q/25693347
type: Comment
has text: @MarkW Oops, any idea on how I would achieve that?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40189681
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25706794
has text: What about using the second solution in your link, to use say JNA to call the Windows Kerna32 function SetErrorMode prior to running your process, but then remembering to turn it back to baseline in a finally block?
score: 0

http://stackoverflow.com/comment/40026613
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25620852
has text: better ask the user to select installation folder and check for the presence of the C&C game structure there
score: 0

http://stackoverflow.com/a/25589201
score: 3
has body: This error seems to typically be caused, literally, by an empty mapping element in the hibernate.cfg.xml file. To fix this, open the hibernate.cfg.xml file, and remove any mapping element that is empty, that is, any element that looks like &lt;mapping /&gt;. Source: http://www.mohanarun.com/mapping-element-in-configuration-specifies-no-attributes-error-in-hibernate/
answers question: http://stackoverflow.com/q/25589167
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25589167
downvote count: 0
type: Answer

http://stackoverflow.com/comment/126868277
type: AnswerComment
comment on: http://stackoverflow.com/a/59530311
type: Comment
score: 0
has text: This doesn't work for me. I've edited this and then try and run ES from services and it starts, and stops about 5 seconds later. If I update the JAVA_HOME variable then it does run.

http://stackoverflow.com/q/25595342
has comment: http://stackoverflow.com/comment/39980127
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25595455
downvote count: 1
has comment: http://stackoverflow.com/comment/39980139
favorite count: 0
has answer: http://stackoverflow.com/a/25595455
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/39980146
has comment: http://stackoverflow.com/comment/39980105
score: -1
has body: I have two classes HighScoreDialog and HighScoreTableModel I need to modify the HighScoreDialog constructor so that it takes a single HighScoreTableModel argument. I also need to modify the rest of the method to use this model rather than creating a new one. This is the relevant code of the two classes with my attempt. public class HighScore_Dialog extends JDialog { private static final long serialVersionUID = 1L; public HighScore_Dialog(Class HighScoreTableModel) { JTable table = new JTable(HighScoreTableModel); public class HighScoreTableModel implements TableModel{ It obviously does not work I have also tired Class &lt;T&gt; but that didn't work either
tagged with: class
type: AnsweredQuestion
has title: How to use Java Class as parameter in a constructor of another class

http://stackoverflow.com/comment/91492477
score: 0
type: Comment
has text: @Holger I find `boolean[] flag = { false };` makes a reasonable non thread safe mutable boolean.
type: AnswerComment
comment on: http://stackoverflow.com/a/25570609

http://stackoverflow.com/q/25680206
has body: Apologize if you cannot understand my question by the question title but let me elaborate more: I have a Project A which I use maven to create a war file. Project A depends on another Project B. The project B is an old project and it tightly depends on hibernate 3. Project A is the one what I am currently working on and I would like its code use Hibernate 4. I add Hibernate 4 dependency into project A's maven POM file so in the generated WAR file, I have both hibernate 3 and Hibernate 4 jars. However when I launch project A, the hibernate 3 code is always automatically used by code in project A. The result I am after is that code in project A uses hibernate 4 jar automatically while hibernate 3 jar is still included and used by code of project B. Can I use Maven to achieve this? or what tools to use to do this? Any suggestions are welcome
type: UnansweredQuestion
tagged with: maven
score: 0
has answer: http://stackoverflow.com/a/25680303
tagged with: java
tagged with: hibernate
answer count: 1
has comment: http://stackoverflow.com/comment/40134383
type: Question
has title: Can Maven specify different dependencies for different modules in a war?

http://stackoverflow.com/comment/40103154
comment on: http://stackoverflow.com/q/25662956
score: 0
type: Comment
has text: Show the full stack trace.
type: QuestionComment

http://stackoverflow.com/a/25603055
answers question: http://stackoverflow.com/q/25601119
type: Answer
has body: It is because your count variable is null you can avoid it by String count=request.getParameter("ItemCount"); if(count.length()&gt;0){ int cnt=Integer.parseInt(count.trim()); // other logic } else{ //do nothing }
score: 0

http://stackoverflow.com/comment/40089179
has text: Activate ***Net*** panel, reload the page and then submit your request. There should be an entry for your submission in the Net panel, expand it and then check the ***POST/Params*** tab there and you should see your submission and their name=value ..... http://www.w3schools.com/jquery/ajax_post.asp (just an example)
score: 0
comment on: http://stackoverflow.com/q/25654455
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25676893
tagged with: arraylist
type: AnsweredQuestion
has title: JTextField - separation of numbers (ArrayList)
score: 0
tagged with: java
answer count: 2
tagged with: swing
tagged with: jtextfield
has body: Is there any way to take several different numbers using JTextField? For example, following numeric values are given: 2.0, 3.0, 4.0. I would like to put them into ArrayList separately. How to handle incorrect input data ​​in order to continue the typing? //in this case the resulst is "arList: 1.92239991" textField = new JTextField("1.9, 223, 9991"); textField.addActionListener(this); ArrayList&lt;Double&gt; arList = new ArrayList&lt;&gt;(); String str = textField.getText(); String result = str.replaceAll("\\s+",""); String otherResult = result.replaceAll(",",""); double d = Double.parseDouble(otherResult); System.out.println(d); arList.add(d); for (Double anArList : arList) { System.out.println("arList: " +anArList); }
type: Question
accepted answer: http://stackoverflow.com/a/25676973
has answer: http://stackoverflow.com/a/25676973
possible better answer: http://stackoverflow.com/a/25676964
has answer: http://stackoverflow.com/a/25676964

http://stackoverflow.com/comment/40141869
type: Comment
type: QuestionComment
score: 0
has text: Please refrain from changing the question so that it renders valid answers invalid. Changing the source code with the corrected version is not right.
comment on: http://stackoverflow.com/q/25684334

http://stackoverflow.com/q/25711088
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25711205
answer count: 2
has body: my name is Gab. I'm making a program that will make vanish one page for an other by clicking a button. The thing is, I can't pass the appropriate datas from my two classes. It may sounds weird like this, but here's my code: My first class (class1): import javax.swing.*; import java.awt.*; import java.util.Scanner; public class class1 { public static void main(String[] args) { JPanel panel = new JPanel(); JFrame frame = new JFrame(); GridBagLayout gridBag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); contenu.setLayout(gridBag); boolean start = false; JLabel label1 = new JLabel( " The Number's Genius (version 1.4) "); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.gridheight = 1; c.gridwidth = 4; c.ipadx = 500; panel.add(label1, c); JLabel xxx = new JLabel(""); c.gridx = 0; c.gridy = 4; c.gridwidth = 3; c.fill = GridBagConstraints.HORIZONTAL; c.ipadx = 550; panel.add(xxx, c); JButton start = new JButton(" Start "); c.gridx = 3; c.gridy = 4; c.gridwidth = 1; c.ipadx = 1; c.anchor = GridBagConstraints.LINE_END; panel.add(start, c); JLabel msg1 = new JLabel( " Click on Start to begin. "); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 1; c.gridheight = 3; c.gridwidth = 4; panel.add(msg1, c); JLabel msg2 = new JLabel( " Ok, let's begin. First question: Is your number even? "); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 1; c.gridheight = 3; c.gridwidth = 4; panel.add(msg1, c); Moteur moteur = new Moteur(); start.addActionListener(moteur); frame.setContentPane(contenu); frame.setSize(700, 300); frame.setVisible(true); frame.setResizable(false); } } You might notice that the second class has some text in french, but don't worry, it's not important. Here's my second class: import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Moteur implements ActionListener { public void actionPerformed(ActionEvent e) { msg1.setVisible(fa…
tagged with: java
has comment: http://stackoverflow.com/comment/40191083
linked to: http://stackoverflow.com/q/2036970
accepted answer: http://stackoverflow.com/a/25711205
type: Question
has title: Cannot access data from another class
tagged with: actionlistener
possible better answer: http://stackoverflow.com/a/25711218
has answer: http://stackoverflow.com/a/25711218

http://stackoverflow.com/a/25606517
accepted answer of: http://stackoverflow.com/q/25605638
has comment: http://stackoverflow.com/comment/40001860
answers question: http://stackoverflow.com/q/25605638
type: Answer
has body: I've read much about initialization but still haven't come across in what order inner classes are initialized. Class initialization is about the initialization of a classes static fields and execution of static initializer blocks. However, an inner class in Java is not allowed to have any static fields or static initializers. (See JLS 8.1.3.) Hence (real) class initialization for inner classes is moot. It makes no difference when it happens ... 'cos there is nothing in an inner class to initialize. The real problem here is that while you have a static field, its actual initialization (to a non-null value) is not done during static initialization. Rather, it would happen when some part of your code explicitly calls BaseClass.main(). However, none of your code does that ... and hence myClass is going to be null when you try to use it. Again ... I stress ... this is not an issue of how static initialization works, because your code doesn't use static initialization to initialize the field in question.
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/40190643
has text: In general I would favor this approach. Just note that if the list you're manipulating is (or could be) a list of child `Node`s in a `Pane`, then this will break as there will be duplicated nodes in the list while you are processing the loop. In this case, you can apply the permutation to the copy with `copy.set(newIndex - from, dest.get(oldIndex));` inside the loop. Then when you are done replace the elements of `dest` with `dest.subList(from, to).clear();` and `dest.addAll(from, copy);`.
comment on: http://stackoverflow.com/a/25707323
score: 3
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39992117
comment on: http://stackoverflow.com/q/25601759
type: Comment
has text: http://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#i1847
type: QuestionComment
score: 0

http://stackoverflow.com/q/25618204
score: 1
upvote count: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/2399590
has title: Need explantation about basic java operator :
tagged with: operators
tagged with: conditional-operator
favorite count: 0
type: Question
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2399590
has body: /** * Returns all Comments of the given review * @param reviewId * @return Returns all Comments as Collection or an empty Collection, if no Comments exist */ protected ArrayList&lt;Comment&gt; getComments(String reviewId) { ArrayList&lt;Comment&gt; result = new ArrayList&lt;Comment&gt;(); HashMap&lt;String, TreeMap&lt;Integer, Comment&gt;&gt; authorMap = commentDB.get(reviewId); if (authorMap != null) { for (TreeMap&lt;Integer, Comment&gt; x : authorMap.values()) { result.addAll(x.values()); } } return result; In the following code, I am not understanding what is the use of : in the line for (TreeMap&lt;Integer, Comment&gt; x : authorMap.values()) I know : is a conditional operator, but don't know what conditional operator it is and what is its use. I searched java operators in google but did not found this operator.
answer count: 0
downvote count: 0

http://stackoverflow.com/q/25614662
type: UnansweredQuestion
tagged with: intellij-idea
tagged with: maven
tagged with: tomcat
has title: Intellij: How to hot swap the external libraries (Multi module maven)
score: 2
answer count: 0
tagged with: java
downvote count: 0
favorite count: 0
type: Question
tagged with: jakarta-ee
has body: Just started exploring Intellij features and was wondering how we do this? We have multi module maven projects with Spring MVC upto 3 levels i.e we have a parent maven multi module projects Say A, Say B and my final multi module project which we run is Say C We have dependencies and overlays setup in such a way that C uses or overlays the artifacts from A and B When running C, Iam getting all my dependencies from A and B as external libraries. Now I wish to do changes in A and B and wish to see that changes in C (Another window on Intellij) automatically. How can I get it ? Please Note: At the moment I need to do maven build on A and then B and then on C to see the changes pushed to my Tomcat server. If I just build A or B, my intelliJ editor sees the changes but that changes are not flowing to the tomcat untill i build C Any help around would be great ? PS: IN eclipse i use to have all the projects A and B and C in single window and when I deploy C, Eclipse used to automatically identify the artifacts that are open from A and B and links to that directly. Iam hoping there should be something equivalent in intellij.So.. please ?
upvote count: 2

http://stackoverflow.com/q/25638099
possible better answer: http://stackoverflow.com/a/25665613
has comment: http://stackoverflow.com/comment/40105247
has comment: http://stackoverflow.com/comment/40105691
has body: To restrict node access to user(using principalbased.ACL), tried with following snippet, but turns ineffective: Map&lt;String, Value&gt; restrictions = new HashMap&lt;String, Value&gt;(); //Apply privilege to user to have read only access to root folder restrictions.put("rep:nodePath", valueFactory.createValue(ROOT, PropertyType.PATH)); restrictions.put("rep:glob", valueFactory.createValue("")); accessControlList.addEntry(userPrincipal, privileges, true , restrictions); accessControlManager.setPolicy(accessControlList.getPath(), accessControlList); Is there any other way to set rep:glob property to ""? When I provide access to root('/'), it should access only that. Instead all the nodes under root are accessible to user.
has comment: http://stackoverflow.com/comment/40095565
tagged with: jcr
has answer: http://stackoverflow.com/a/25780053
has title: Creating empty string for 'rep:glob'
type: AnsweredQuestion
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25665613
tagged with: java
tagged with: jackrabbit
accepted answer: http://stackoverflow.com/a/25780053
has comment: http://stackoverflow.com/comment/40075366
type: Question

http://stackoverflow.com/a/25572658
has comment: http://stackoverflow.com/comment/39939234
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25572146
has body: In your driver main() you have: hider.revealLetter(guessedLetter.toLowerCase()); if (hider.revealLetter(guessedLetter)== 0) That's why you get one successful call then second time round there is nothing to do. There's a few stylistic issues I could highlight, but one big one is: if (letter.length() &lt; 1 || letter.length() &gt; 1) { correctChars = 0; return correctChars; } else { Why not just letter.length() != 1, and since correctChars is already initialised to zero you don't need to do it again, so the whole "then" part can be dropped and the if becomes letter.length() == 1. Also: tempString += Character.toString(hiddenWord.charAt(i)); And: tempString += partiallyFoundWord.charAt(i); Both do the same thing, so choose one style or the other.
has comment: http://stackoverflow.com/comment/39940118
type: Answer
has comment: http://stackoverflow.com/comment/39940448
answers question: http://stackoverflow.com/q/25572146
has comment: http://stackoverflow.com/comment/39938878
upvote count: 4
score: 4
has comment: http://stackoverflow.com/comment/39939864
downvote count: 0

http://stackoverflow.com/a/25704300
accepted answer of: http://stackoverflow.com/q/25704278
has body: When debugging it pauses where you told it to and continue it you can either hit step in, step over, step out, or resume to continue your program. There are many tutorials on how to use the debugger.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25704278
type: AcceptedAnswer

http://stackoverflow.com/a/25622307
upvote count: 1
type: Answer
has body: You only need to use one frame (you are creating 255 of them) Don't use a while loop to try and change the background. Use a Swing Timer instead. See How to Use Swing Timers Run all your Swing apps on the Event Dispatch Thread. See Initial Threads Here's your code refactored with those three points import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.Timer; public class Frame1 { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { final JFrame frame = new JFrame(); frame.getContentPane().setBackground( new Color(0, 0, 0)); Timer timer = new Timer(10, new ActionListener() { int num = 0; public void actionPerformed(ActionEvent e) { if (num &gt; 255) { ((Timer) e.getSource()).stop(); } else { frame.getContentPane().setBackground( new Color(num, num, num)); num++; } } }); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); timer.start(); } }); } }
answers question: http://stackoverflow.com/q/25620975
accepted answer of: http://stackoverflow.com/q/25620975
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25675011
possible better answer: http://stackoverflow.com/a/49321848
answer count: 2
score: 1
has answer: http://stackoverflow.com/a/49321848
accepted answer: http://stackoverflow.com/a/25675826
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 0
has answer: http://stackoverflow.com/a/25675826
upvote count: 1
favorite count: 0
type: Question
tagged with: serialization
linked to: http://stackoverflow.com/q/9112900
has title: Jackson: how to prevent field serialization (while keeping deserialization)
has body: I'd like to go further on what this question was about, I've been roaming SO for a solid hour now without finding anything. Basically, what I'm trying to do is having a property properly instanciated through Jackson internal reflection algorithm during deserialization but having this same property not serialized when it comes to serialization. I know about @JsonIgnore and @JsonIgnoreProperties but apparently I can't seem to use them right : either my property is correctly deserialized when I feed Jackson a proper map of properties but it also appears in the serialized results, either (when using @JsonIgnore) it is not serialized (which is wanted) but also not deserialized (not wanted). Example : public class Foo { /* This is the property I want to be instanciated by Jackson upon deserialization * but not serialized upon serialization */ private final Object bar = null; public Object getBar() { return bar; } } To make things worse, as you can see, the property is final (this is why I'm keen on using Jackson reflection ability upon Foo instanciation through deserialization). I've read on potential solution about annotating the setter and the getter differently but I'd like to keep this property final if possible. If not possible, I'd settle for a non-final property. I would appreciate answers not suggesting custom serializer/deserializer, my code base is currently free of such and if the solution could be of minimal impact, that would be perfect. Again, I'm no Jackson expert so if what I'm asking is not possible I'll obviously accept alternative answers. I've also read this thread on github but none of the suggested ways of implementation have actually been implemented at the moment. Thanks EDIT : to make things clearer public class Foo { private final String bar = null; public String getBar() { return bar; } @Override public String toString() { return bar; } } public void testMethod() throws IOException { String json = "{\"bar\":\"Value\"}"; ObjectMapper mapper = new…
tagged with: jackson
type: AnsweredQuestion

libgdx
tags question: http://stackoverflow.com/q/25712384
tags question: http://stackoverflow.com/q/25633056
tags question: http://stackoverflow.com/q/25632914
tags question: http://stackoverflow.com/q/25598607
tags question: http://stackoverflow.com/q/25588570
tags question: http://stackoverflow.com/q/25596392
tags question: http://stackoverflow.com/q/25584170
tags question: http://stackoverflow.com/q/25590777
tags question: http://stackoverflow.com/q/25570311
tags question: http://stackoverflow.com/q/25560535
tags question: http://stackoverflow.com/q/25698550
tags question: http://stackoverflow.com/q/25620774
tag name: libgdx
tags question: http://stackoverflow.com/q/25666882
tags question: http://stackoverflow.com/q/25587370
tags question: http://stackoverflow.com/q/25577327
tags question: http://stackoverflow.com/q/25632881
tags question: http://stackoverflow.com/q/25588708
tags question: http://stackoverflow.com/q/25567309
tags question: http://stackoverflow.com/q/25688200
tags question: http://stackoverflow.com/q/25693571
tags question: http://stackoverflow.com/q/25655218
tags question: http://stackoverflow.com/q/25596836
tags question: http://stackoverflow.com/q/25587415
tags question: http://stackoverflow.com/q/25675571
tags question: http://stackoverflow.com/q/25648386
tags question: http://stackoverflow.com/q/25570989
tags question: http://stackoverflow.com/q/25573953
tags question: http://stackoverflow.com/q/25650911
tags question: http://stackoverflow.com/q/25666630
tags question: http://stackoverflow.com/q/25553166
tags question: http://stackoverflow.com/q/25673309
type: Tag
tags question: http://stackoverflow.com/q/25700181

http://stackoverflow.com/q/25560332
type: Question
answer count: 2
has title: Java String Replace '&' with &amp; but not &amp; to &amp;amp;
downvote count: 0
has comment: http://stackoverflow.com/comment/39915187
tagged with: string
score: 19
has comment: http://stackoverflow.com/comment/39915253
favorite count: 0
type: AnsweredQuestion
upvote count: 19
tagged with: ampersand
possible better answer: http://stackoverflow.com/a/37273957
tagged with: java
accepted answer: http://stackoverflow.com/a/25560407
has answer: http://stackoverflow.com/a/37273957
tagged with: regex
has body: I have a large String in which I have &amp; characters used available in following patterns - A&amp;B A &amp; B A&amp; B A &amp;B A&amp;amp;B A &amp;amp; B A&amp;amp; B A &amp;amp;B I want to replace all the occurrences of &amp; character to &amp;amp; While replacing this, I also need to make sure that I do not mistakenly convert an &amp;amp; to &amp;amp;amp;. How do I do that in a performance savvy way? Do I use regular expression? If yes, please can you help me to pickup the right regular expression to do the above? I've tried following so far with no joy: data = data.replace(" &amp; ", "&amp;amp;"); // doesn't replace all &amp; data = data.replace("&amp;", "&amp;amp;"); // replaces all &amp;, so &amp;amp; becomes &amp;amp;amp;
has answer: http://stackoverflow.com/a/25560407
tagged with: replace

http://stackoverflow.com/comment/39964547
comment on: http://stackoverflow.com/q/25586435
score: 0
type: QuestionComment
type: Comment
has text: No, my code doesn't work. The problem is how to read properties in json format and wite them into some component bean.

http://stackoverflow.com/q/25664296
has comment: http://stackoverflow.com/comment/40105213
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40106098
answer count: 1
tagged with: console
has answer: http://stackoverflow.com/a/25664609
type: Question
has title: How can i allow three threads accessing three different consoles in java?
score: 0
has body: So i am trying to build a simple application to show concurrency in java. I wanna open 3 console windows so that i can get input output from all of them. How can do this? Edit:I have 3 threads, each thread has its own set of cache. I wanna run 3 consoles separately in java. i opened command prompt using Runtime class and tried attaching input and outputstream to it. But failed writing or reading from that newly opened console.
tagged with: java

http://stackoverflow.com/comment/40147430
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25686662
has text: I've add this line "System.out.println(rgb);" and it return this value multiple times: -131072

http://stackoverflow.com/a/25703657
has body: A byte in Java is a signed type with a value of -128 to 127. The most significant bit is used to indicate the sign. For example, 0111 1111 == 127, and 1000 0000 == -128. I looked up your character (’) in an ANSI table and found that it has a value of 146 (which is of course greater than 127). The binary representation is 1001 0010, and so interpreting this as a signed value will yield -110. To reproduce what you are seeing: String s = new String("’"); // ’ is ansi character 146 byte[] bytes = s.getBytes(); System.out.println( (int)bytes[0] ); // prints -110 To convert the byte value to an unsigned representation: char c = (char)(bytes[0] &amp; 0xFF); System.out.println( (int)c ); // prints 146
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25702553

http://stackoverflow.com/comment/40049987
has text: Updated... any ideas?
type: Comment
comment on: http://stackoverflow.com/q/25630589
score: 0
type: QuestionComment

http://stackoverflow.com/q/25572947
tagged with: java
has answer: http://stackoverflow.com/a/25574480
has body: I'm using JPA 2.0, Eclipselink 2.0, maven and weblogic 10.3.6. Here's my persistence.xml <?xml version="1.0" encoding="UTF-8"?> org.eclipse.persistence.jpa.PersistenceProvider jdbc/com/ni/ds_edata_soa_nontx com.ni.apps.engineering.certification.entities.NicdsCliCertificationStg com.ni.apps.engineering.certification.entities.NicdsCliCertificationStgPK com.ni.apps.engineering.certification.entities.NicdsCliUpMapping <property name="javax.persistence.jdbc.password" value="ni"/> <property name="javax.persistence.jdbc.user" value="NI"/> <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/> <property name="eclipselink.logging.level.sql" value="FINE"/> This is my facade package com.ni.apps.engineering.certification.controller; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.PersistenceUnit; import javax.persistence.TypedQuery; import com.ni.apps.engineering.certification.entities.NicdsCliCertificationStg; import com.ni.apps.engineering.certification.exception.CertificationException; import com.ni.apps.engineering.certification.utils.CertificationConstants; public class CertificationFacade { @PersistenceUnit(unitName = "certifications") private EntityManagerFactory emf; public List<NicdsCliCertificationStg> getCertificationsByUpId(String upId) throws CertificationException { String stringQuery = new StringBuilder( "select c from NicdsCliCertificationStg c where c.id.contactsId = 1234").toString(); //.append(upId).toString(); try { emf = Persistence.createEntityManagerFactory("certifications"); EntityManager em = emf.createEntityManager(); TypedQuery<NicdsCliCertificationStg> query = em .createQuery(stringQuery, NicdsCliCertificationStg.class); return query.getResultList(); } catch (Exception e) { throw new CertificationException( CertificationConstants.INTERNAL_ERROR_MESSAGE, e); } } } When I try to run the app, this is the…
type: Question
answer count: 2
has title: JPA can't find table
has comment: http://stackoverflow.com/comment/39939741
possible better answer: http://stackoverflow.com/a/25574480
tagged with: jpa
has comment: http://stackoverflow.com/comment/39940879
has comment: http://stackoverflow.com/comment/39940295
has answer: http://stackoverflow.com/a/25576796
has comment: http://stackoverflow.com/comment/39940932
accepted answer: http://stackoverflow.com/a/25576796
has comment: http://stackoverflow.com/comment/39941871
has comment: http://stackoverflow.com/comment/39940759
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39939678
tagged with: eclipselink
has comment: http://stackoverflow.com/comment/39940276

http://stackoverflow.com/q/25636510
answer count: 0
linked to: http://stackoverflow.com/q/2770321
tagged with: java
has body: I have a simple AVL tree implementation with a public method getMax() like so: public class AVLTree &lt;Data extends Comparable&lt;Data&gt;&gt; { public AVLTree() { this.root = null; } public Data getMax() { return getMaxNode(root).data; } ... } When I form the tree using Integer inputs, I cannot use the getMax() method without casting the result to Integer, which seems strange to me. Here's an example: AVLTree avltree = new AVLTree(); avltree.insert(10); Integer i = (Integer)avltree.getMax(); &lt;-- Here System.out.println(avltree.getMax().getClass()); // Test If I delete (Integer), the IDE says "incompatible types: Comparable cannot be converted to Integer". What's strange is that the output for getClass() is class java.lang.Integer. So my question is: why do I have to cast the output to Integer in this case when the return type seems to be an Integer?
type: Question
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/2770321
has comment: http://stackoverflow.com/comment/40055453
has title: Generic return type for a public method
has comment: http://stackoverflow.com/comment/40055389
score: 0

http://stackoverflow.com/comment/40173252
has text: Here's the API documentation for [*OrthoCachedTiledMapRenderer*](http://bit.ly/1rk0RGk); you might be using an older version of LibGDX. Also, you should know that you are, in fact, using two *SpriteBatch* instances because the renderer creates its own. I'm not saying this would fix your problem, but if you wanted the renderer to not create its own *SpriteBatch*, [you can pass one in its constructor](http://bit.ly/1qvJvtO).
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25693571

http://stackoverflow.com/comment/40483539
comment on: http://stackoverflow.com/q/25581314
has text: Solved the issue. I'm guessing the problem was with the JDK in my machine. I installed the latest Oracle 64 bit JDK and everything started working.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40471414
comment on: http://stackoverflow.com/a/25606446
has text: seeing the other answers makes the actual problem clear. And yeah i messed up abit, sorry for this.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/25647078
has comment: http://stackoverflow.com/comment/40074468
type: Answer
has comment: http://stackoverflow.com/comment/40074515
has comment: http://stackoverflow.com/comment/40074301
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25646801
has body: I don't have enough reps to comment on Elliot's post. I just added an end condition to his code, so that we can prevent an infinite loop and once you type "end", the process of taking input finishes and it computes the result. package Mean; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Mean { public static void main(String[] args) { List&lt;Double&gt; numbers = new ArrayList&lt;&gt;(); // &lt;-- List and Diamond Operator Scanner in = new Scanner(System.in); while (in.hasNextDouble()) { // &lt;-- hasNextDouble() Double input = in.nextDouble(); // &lt;-- get the next double numbers.add(input); //if (numbers.equals("end")) (revision : unnecessary, type any non double to stop loop) // break; } } // in.close(); // &lt;-- Wraps System.in, don't do this. Double sum = 0.0; // &lt;-- initialize as double for (Double element : numbers) { sum += element; // &lt;-- add the values. } System.out.println(sum / numbers.size()); } }

http://stackoverflow.com/a/25571643
has body: This program explains the multiplication of two given matrices. The output is passed to a Consumer&lt;String&gt;. In this example, this consumer only prints the string to the console. You may change this to be a consumer that inserts the given strings into a document, or ... whatever. import java.util.Locale; interface Consumer&lt;T&gt; { void accept(T t); } public class MatMulExplainer { public static void main(String[] args) { test2x2_2x2(); test3x2_2x4(); } private static void test2x2_2x2() { double A[][] = { { 1, 2 }, { 4, 3 }, }; double B[][] = { { 6, 9 }, { -8, -5 }, }; double C[][] = explain(A, B, console()); } private static void test3x2_2x4() { double A[][] = { { 1, 2 }, { 4, 3 }, { 5, 6 }, }; double B[][] = { { 6, 9, -3, 8}, { -8, -5, -1, 7}, }; double C[][] = explain(A, B, console()); } private static Consumer&lt;String&gt; console() { return new Consumer&lt;String&gt;() { @Override public void accept(String t) { System.out.println(t); } }; } private static double[][] explain( double A[][], double B[][], Consumer&lt;String&gt; consumer) { consumer.accept("Multiply\n"+toString(A)); consumer.accept("and\n"+toString(B)); int rA = A.length; int cA = A[0].length; int cB = B[0].length; double C[][] = new double[rA][cB]; for (int r=0; r&lt;rA; r++) { for (int c=0; c&lt;cB; c++) { float sum = 0; StringBuilder sb = new StringBuilder(); sb.append("C"+r+","+c+" = "); for (int n=0; n&lt;cA; n++) { sb.append(toString(A[r][n])+" * "+toString(B[n][c])); sum += A[r][n] * B[n][c]; if (n &lt; cA - 1) { sb.append(" + "); } } sb.append(" = "+toString(sum)); consumer.accept(sb.toString()); C[r][c] = sum; } } consumer.accept("Result:\n"+toString(C)); return C; } private static String toString(double A[][]) { StringBuilder sb = new StringBuilder(); for (int r=0; r&lt;A.length; r++) { for (int c=0; c&lt;A[r].length; c++) { sb.append(toString(A[r][c])+" "); } sb.append("\n"); } return sb.toString(); } private static String toString(double d) { final String format = "%6.2f"; retur…
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25554137
type: Answer
answers question: http://stackoverflow.com/q/25554137

http://stackoverflow.com/a/25600615
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39989870
has body: It simply declares a field called instance whose type is ConnectionManager and initializes it to null (which is redundant because that would be its default value anyway). Most likely the class is a singleton class (only one instance is allowed from them) judging by the instance field declaration and by the name of the class.
answers question: http://stackoverflow.com/q/25600575
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/39989901

http://stackoverflow.com/comment/39994640
type: Comment
score: 0
has text: Did I understand it right? You have a clear button that clears the input fields? But when clicking it in the designer view, it shows the above code?
type: QuestionComment
comment on: http://stackoverflow.com/q/25603194

http://stackoverflow.com/comment/40036451
type: Comment
has text: Weightsum is a LinearLayout param, not a ListView param.
comment on: http://stackoverflow.com/a/25625344
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40147526
has text: That is exactly the reason why you should prefer generics over raw types. The generic code guarantees you type-safety in this case, the raw code doesn't.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25687617
type: Comment

http://stackoverflow.com/q/25646754
possible better answer: http://stackoverflow.com/a/25647153
has body: I thought dependencyManagement from parents were transitive aren't they? Never see that explicitely in the doc, but it seemed obvious to me... Here's what i have: +-----------------------+ | Parent 1 | |-----------------------| | dependencyManagement: | | lib1: 1.0.0 | +-----------------------+ ^ | | +-----------+-----------+ | Parent 2 | |-----------------------| | dependencyManagement: | | lib2: 1.0.0 | +-----------------------+ ^ | +-----------+-----------+ | Project A | |-----------------------| | dependencies: | | lib1 | | lib2 | +-----------------------+ When i try to mvn install Project A, i get: [ERROR] 'dependencies.dependency.version' for lib1-digester:jar is missing. @ line XX, column YY I also tried to add an entry of Parent 1 in the dependencyManagement of Parent 2 with the import scope, with no success.. How can my Project A have versions managed by all it's parent hierarchy?
has answer: http://stackoverflow.com/a/25647153
has answer: http://stackoverflow.com/a/25649558
downvote count: 0
tagged with: maven
score: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40074752
accepted answer: http://stackoverflow.com/a/25649558
answer count: 3
has title: Maven parent hierarchy + dependencyManagement not transitive?
tagged with: java
has answer: http://stackoverflow.com/a/25647620
favorite count: 0
has comment: http://stackoverflow.com/comment/40074084
type: Question
upvote count: 4

http://stackoverflow.com/q/25697151
upvote count: 2
type: UnansweredQuestion
tagged with: encryption
downvote count: 0
has body: Hi I read this post on how to implement salt and hashing to the password and I am stuck on specified code underneath the website I specified above. private static String toHex(byte[] array) { BigInteger bi = new BigInteger(1, array); String hex = bi.toString(16); int paddingLength = (array.length * 2) - hex.length(); if(paddingLength &gt; 0) return String.format("%0" + paddingLength + "d", 0) + hex; else return hex; } My question is that why did they calculate the paddingLength and implement it to the hex if the result paddingLength is greater than zero?
score: 2
has answer: http://stackoverflow.com/a/25697347
tagged with: java
favorite count: 0
has title: What is the purpose to add padding to hex?
type: Question
tagged with: hex
answer count: 2
has answer: http://stackoverflow.com/a/25697512

http://stackoverflow.com/comment/39958393
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25583493
type: AnswerComment
has text: Thus, I should annotate the service as `@Scope("session")`, right?

http://stackoverflow.com/q/25633508
has answer: http://stackoverflow.com/a/25633817
accepted answer: http://stackoverflow.com/a/25633817
linked to: http://stackoverflow.com/q/17357226
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25633623
has body: On startup, an async class is executed which scrapes a website for information. The screen is left blank during this time, before the gathered information is populated to a listview. Is there any way to add a loading screen during this time? I looked at this (Add the loading screen in starting of the android application) but I don't think it's what I need because I don't know how long the request will take. Thanks for your time. After seeing some of the answers, I revised my code, but neither became visible. here is my xml file for activity main. there is also a textview layout xml file for the default textview element in a listview. &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"&gt; &lt;ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/progressBar" style="?android:attr/progressBarStyleLarge" android:layout_centerInParent="true"/&gt; &lt;ListView android:layout_width="match_parent" android:layout_height="507dp" android:id="@+id/listView" android:smoothScrollbar="true" /&gt; &lt;/RelativeLayout&gt; And here is the main activity's code: package adam.example.com.stockexample; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import a…
tagged with: android
tagged with: java
tagged with: httpwebrequest
type: Question
score: 0
answer count: 2
has title: Load screen while under async http request
has answer: http://stackoverflow.com/a/25633623

http://stackoverflow.com/q/25658772
tagged with: classpath
has answer: http://stackoverflow.com/a/25658870
type: Question
has title: Get resource(jar) path in java
downvote count: 0
has comment: http://stackoverflow.com/comment/40095907
upvote count: 1
score: 1
tagged with: window
tagged with: executable-jar
has body: I have a class XYZ in application that is executed as jar in any directory. I want to find the current directory path in which jar is executing for this I have used following code. String path = this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath() I write this code in public constructor of XYZ class but it is not working though I am using it since long time it works fine, but now it is not returning the current directory path. please mark and suggest what is going wrong in this.
favorite count: 0
has answer: http://stackoverflow.com/a/25658964
accepted answer: http://stackoverflow.com/a/25658964
type: AnsweredQuestion
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25658976
possible better answer: http://stackoverflow.com/a/25658870
has comment: http://stackoverflow.com/comment/40096013

http://stackoverflow.com/q/25676068
tagged with: java
has comment: http://stackoverflow.com/comment/40152765
type: Question
has title: Spring beans from external spring context on classpath are not loading
has comment: http://stackoverflow.com/comment/40126901
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/40126892
has body: In my spring application config I am importing another spring application's config XML file. I am doing this by using the import tag: &lt;import resource="classpath*:**/app-context.xml"/&gt; When wiring it up, my IDE (using IntelliJ 13) looks like it knows what to do. However when running the app, I get the NoSuchBeanDefinitionException. I have gone over this many times and I can't seem to find where I am going wrong. I have made sure the the jar file in which the app-context.xml file is in my classpath, and it is! I have tried looking at other posts on here and nothing describes or solves what I am going through.
score: 0
answer count: 0

http://stackoverflow.com/q/25615312
has comment: http://stackoverflow.com/comment/40017726
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24836499
tagged with: alpha-beta-pruning
upvote count: 3
tagged with: java
has body: I've made a negamax algorithm for a chess-like game and I want to know how to use the final board value result. I understand the final return of the negamax algorithm represents what the board value will be after the player takes his best possible move, but that isn't exactly useful information. I need to know what that move is, not what it's worth. Here's the code: public int negamax(Match match, int depth, int alpha, int beta, int color) { if(depth == 0) { return color*stateScore(match); } ArrayList&lt;Match&gt; matches = getChildren(match, color); if(matches.size() == 0) { return color*stateScore(match); } int bestValue = Integer.MIN_VALUE; for(int i = 0; i != matches.size(); i++) { int value = -negamax(matches.get(i), depth-1, -beta, -alpha, -color); if(value &gt; bestValue) { bestValue = value; } if(value &gt; alpha) { alpha = value; } if(alpha &gt;= beta) { break; } } return bestValue; } public void getBestMove(Match match, int color) { int bestValue = negamax(match, 4, Integer.MIN_VALUE, Integer.MAX_VALUE, color); // What to do with bestValue??? } I thought of re-evaluating the children of the current match state after bestValue is determined. Then I iterate through them and find which of those children has a stateScore equal to bestValue. But that wouldn't work because a lot of them will have the same stateScore anyway, it's what they can lead to which counts...
answer count: 1
downvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25616243
tagged with: algorithm
tagged with: negamax
has answer: http://stackoverflow.com/a/25616243
has title: Negamax chess algorithm: How to use final return?

http://stackoverflow.com/q/25640217
linked to: http://stackoverflow.com/q/19733877
score: 1
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/15985378
favorite count: 0
type: Question
has body: If I don't write a custom query the @Autowired FirstnameRepository object is null, therefore I tried to write a custom query, but this produces the following error. java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List FirstnameRepository.findByNation(Nation)! Since the query looks correct to me, I think it has something to do with my classstructure or incorrect annotations. FirstnameRepo public interface FirstnameRepository extends JpaRepository&lt;Firstname, String&gt;{ @Query("SELECT fn FROM Firstname fn WHERE fn.nation = :nation") List&lt;Firstname&gt; findByNation(@Param("nation")Nation nation); } Firstname Model @Entity @Table(name = "Firstnames") public class Firstname extends Name implements Serializable { private static final long serialVersionUID = 1L; @Basic(optional = false) @Column(name = "gender") private short gender; @JoinColumn(name = "nation", referencedColumnName = "id") @ManyToOne(optional = false) private Nation nation; public Firstname() {} } Since there is also a Lastname model class I extend a class named Name to save Firstname and Lastname in the same Map. Name has no table in the database and both classes only inherit the ID property. Name class @MappedSuperclass public abstract class Name { @Id @Basic(optional = false) @Column(name = "name") private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } If I comment the findByNation() method out, the server starts without a problem. I hope this is all you need, the server configuration is more or less copied from a working project, but if I should include something let me know. thanks EDIT The Problem was a incorrect configuration. I changed alot of stuff before testing it again, but seems like the main issue was a wrong version of in the web.xml.
answer count: 2
possible better answer: http://stackoverflow.com/a/25641417
has comment: http://stackoverflow.com/comment/40064589
tagged with: jpa
downvote count: 0
upvote count: 1
has title: JPQL validation error
has answer: http://stackoverflow.com/a/25643334
tagged with: spring
accepted answer: http://stackoverflow.com/a/25643334
has comment: http://stackoverflow.com/comment/40063665
type: AnsweredQuestion
tagged with: spring-data-jpa
has answer: http://stackoverflow.com/a/25641417
has comment: http://stackoverflow.com/comment/40063568

http://stackoverflow.com/comment/40037470
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25624317
has text: I suspect that reason may be similar to why `if(flase){dead code}` is allowed when `while(false){dead code}` is not - it can help in simple debugging.

http://stackoverflow.com/comment/40183207
comment on: http://stackoverflow.com/q/25706679
score: 0
has text: I'm asking for help as i don't have the time to learn about my logcat. this project is due tomorrow and this is the last step. also added the logcat errors
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40129201
comment on: http://stackoverflow.com/q/25677143
type: Comment
type: QuestionComment
score: 0
has text: @MichałSchielmann I'd like to know a way to ORDER this list, increasing and decreasing.

http://stackoverflow.com/comment/40152300
type: Comment
type: QuestionComment
has text: You haven't asked for clarification at all in this question - I've explained that you're looking at the size of the underlying byte array in the ByteBuffer. Why would you assume that that is going to be *exactly* the same size as the final encoded text? If you're going to ask for more information, you need to give more details in the question or comment, not just repeat what's already been asked.
comment on: http://stackoverflow.com/q/25688907
score: 0

http://stackoverflow.com/q/25594101
accepted answer: http://stackoverflow.com/a/25594117
tagged with: text
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25594117
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/25595478
has answer: http://stackoverflow.com/a/25595478
type: Question
has title: Read text and input file text to JTextArea
answer count: 2
has body: What's wrong with my code? I'm trying to read text file and then put the text to JTextArea, but its input only consists of the last line of text. What's wrong? Code: public void read() { int returnVal = fc.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); pavadinimas = file.getName(); try { FileInputStream fstream = new FileInputStream(fc.getCurrentDirectory() + "/" + pavadinimas); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { tekstas.setText(strLine); } in.close(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } } }
tagged with: jtextarea

http://stackoverflow.com/a/25702316
has comment: http://stackoverflow.com/comment/40174814
answers question: http://stackoverflow.com/q/25702166
type: Answer
has comment: http://stackoverflow.com/comment/40174761
has comment: http://stackoverflow.com/comment/40175320
has body: I found out that it was my mistake that I was explicitly calling hashCode() in toString() method which created this confusion. Nonetheless the conclusion is , For TreeMap it follows the Comparable Interface implementation and does not follow hashCode and equals implementation.
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/25697513
answer count: 1
has comment: http://stackoverflow.com/comment/40167663
tagged with: string
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25698063
type: UnansweredQuestion
tagged with: android
has title: Android reference string from strings.xml without importing package R.java
has body: In order to reference a string from strings.xml I do this: import com.mypackage.myapp.R; getString(R.string.mystring) It works for a particular project, but that project is a template which I create for other projects. When I do that, my project name is changed hence import com.mypackage.myapp.R; becomes invalid as the package name changes too. So, I wonder is there a way to reference a string of the project within the same project without importing project by package name? EDIT: In other words I need a package name independent way of obtaining a string resource from strings.xml files which is located in the same package.
downvote count: 0
has comment: http://stackoverflow.com/comment/40166443
score: 1
upvote count: 1
tagged with: java

http://stackoverflow.com/comment/40001563
score: 0
has text: bro! you can check this; already discussed many places http://stackoverflow.com/a/18480297/3819810... There are some ref links as well, you can check in detail :)
type: Comment
comment on: http://stackoverflow.com/a/25606826
type: AnswerComment

http://stackoverflow.com/comment/54654332
type: Comment
has text: Somehow javax.xml.bind.JAXBContext in C:\Java64\jdk1.8.0_60\jre\lib\rt.jar is not working correctly. The solution is to use an earlier version of xerces in the CLASSPATH. In pom.xml, insert the above-mentioned xerces 2.11.0 dependency on top of all other <dependency> so it has the higher priority to be picked up by Java 8.
type: AnswerComment
comment on: http://stackoverflow.com/a/27949008
score: 1

http://stackoverflow.com/q/25688046
has body: I want to understand this: ParentClass p=new ChildClass(); //Here ChildClass extends ParentClass Is p object of ParentClass or of ChildClass?
tagged with: polymorphism
accepted answer: http://stackoverflow.com/a/25688084
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25688084
possible better answer: http://stackoverflow.com/a/25688122
answer count: 5
has answer: http://stackoverflow.com/a/25688122
has answer: http://stackoverflow.com/a/25688178
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25688126
has title: Polymorphism in java resolving Parent class and Child class objects
tagged with: class
has comment: http://stackoverflow.com/comment/40148217
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40148333
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40151492
has comment: http://stackoverflow.com/comment/40148140
has answer: http://stackoverflow.com/a/25688158

http://stackoverflow.com/comment/40161219
comment on: http://stackoverflow.com/a/25676973
score: 1
type: Comment
type: AnswerComment
has text: You could use a DocumentFilter to limit what the user enters, but they can still enter nonuse like 1.2.3.4 which is meaningless

http://stackoverflow.com/comment/40145659
score: 0
comment on: http://stackoverflow.com/q/25686132
type: Comment
type: QuestionComment
has text: Then I'm out of ideas :(

http://stackoverflow.com/q/25597527
score: -1
has title: Storing Methods in an Enum?
has comment: http://stackoverflow.com/comment/39984354
answer count: 2
linked to: http://stackoverflow.com/q/16029704
has comment: http://stackoverflow.com/comment/39984233
has answer: http://stackoverflow.com/a/25597544
upvote count: 0
has comment: http://stackoverflow.com/comment/39984263
tagged with: java
has comment: http://stackoverflow.com/comment/39984268
downvote count: 1
duplicate of: http://stackoverflow.com/q/16029704
favorite count: 0
type: Question
tagged with: enums
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39984264
has comment: http://stackoverflow.com/comment/39984326
has answer: http://stackoverflow.com/a/25597577
has body: Right now, I have an enum for a variety of values, and I was wondering if there is any way I would be able to store a method in an enum. For example: public enum myEnum{ one("first", callFirstMethod), two("second", callSecondMethod), three("last", callThirdMethod); public String message; public Method met; myEnum(String m, Method meth){ message = m; met = meth; } } public class myMethods{ public void callFirstMethod(){ System.out.println("First!"); } public void callSecondMethod(){ System.out.println("Second!"); } public void callThirdMethod(){ System.out.println("Third!"); } } Then by using something like: Method method = myEnum.one.callFirstMethod(); To call the method. Is something like this possible? I've tried playing around/looking around on google, and nothing is really turning up. Thank you for the help!

declarative-services
tags question: http://stackoverflow.com/q/25657257
type: Tag
tag name: declarative-services

http://stackoverflow.com/q/25583113
has body: hello i am working on java and MySQL. My implementation are as follows : import javax.swing.JFrame; import javax.swing.JLabel; import java.sql.*; import java.util.Scanner; public class BankingSystem extends JFrame { public static void main(String[] args) throws Exception{ int ur=0; int PIN; String ID; Scanner s=new Scanner(System.in); Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://localhost:3306/BankingSystem"; String user = "root"; String pass=""; Connection con = DriverManager.getConnection(url,user,pass); Statement st = con.createStatement(); System.out.println("Enter Your 4 digit PIN"); PIN=s.nextInt(); ResultSet rs=st.executeQuery("select * from customerinformation where pin ="+PIN); //checking for existance of user entered pin if((rs.getString(1)).equals("")){System.out.println("Invalid PIN");} while(rs.next()) { System.out.println(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3)+" "+rs.getString(4)); } } } but this code is not working. Giving some sort of exception error but when i remove the line containing if statement then it work fine.How do i check whether the pin is valid or not. it giving following exception: Exception in thread "main" java.sql.SQLException: Before start of result set at com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:3624) at com.mysql.jdbc.ResultSet.getString(ResultSet.java:1762) at BankingSystem.main(BankingSystem.java:22)
accepted answer: http://stackoverflow.com/a/25583150
has title: Java checking whether the value exists in database
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25583150
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39957727
has answer: http://stackoverflow.com/a/25583271
tagged with: java
tagged with: jdbc
tagged with: mysql
type: Question
possible better answer: http://stackoverflow.com/a/25583271

http://stackoverflow.com/q/25682401
tagged with: semantic-web
score: 0
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40148499
has comment: http://stackoverflow.com/comment/40152871
type: Question
has comment: http://stackoverflow.com/comment/40169911
has title: SPARQL query fails
type: UnansweredQuestion
has body: I am using jena to make SPARQL query over the Yago vocabulary. I use a loop with a set of elements that replace the SPARQL. So for example I have a file from which I get the class names. It looks like this: wordnet_aircraft_102686568 wordnet_airline_102690081 wordnet_airport_102692232 wordnet_album_106591815 wordnet_ambassador_109787534 wikicategory_American_football_leagues_in_the_United_States wikicategory_National_Football_League_teams wordnet_amphibian_102704792 wordnet_body_part_105220461 The SPARQL generated looks like: SELECT ?entity WHERE { ?entity rdf:type &lt;http://yago-knowledge.org/resource/wordnet_album_106591815&gt; } The query runs fine for 3 or 4 elements, but then it blocks at wordnet_album_106591815 and it returns an HttpException: 500 . I deleted that value from the file, and the query went forward for a few more elements and then got stuck again. I copied the query to a SPARQL endpoint (http://lod2.openlinksw.com/sparql), it works sometimes, but sometimes I get Error S1T00 SR171: Transaction timed out What are the possible reasons behind this behavior?
tagged with: jena
has comment: http://stackoverflow.com/comment/40160191
has comment: http://stackoverflow.com/comment/40160404
has comment: http://stackoverflow.com/comment/40144178
tagged with: sparql
has comment: http://stackoverflow.com/comment/40147014
has comment: http://stackoverflow.com/comment/40155028
has comment: http://stackoverflow.com/comment/40156899

http://stackoverflow.com/comment/40161672
has text: Glad to know it, I'll take into account if I face the same problem.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25693973

http://stackoverflow.com/comment/40141602
comment on: http://stackoverflow.com/q/25684352
score: 0
type: QuestionComment
has text: Your while loop doesn't have brackets so the next line is the only line in the loop and it never exists the loop.
type: Comment

http://stackoverflow.com/q/25709506
has comment: http://stackoverflow.com/comment/40187955
answer count: 6
has answer: http://stackoverflow.com/a/25709544
favorite count: 0
type: Question
type: AnsweredQuestion
downvote count: 3
has answer: http://stackoverflow.com/a/25709595
has comment: http://stackoverflow.com/comment/40189655
tagged with: java
has body: I been searching for the logic of Math.random through book, however I can't get to understand ((char)('A' + Math.random() * 27)) What does 27 means? I tried to replace with 100, the results is it generates some special characters like !@#$%^&amp;*(( I'd appreciate if you could give me more info about this. TQ
has title: Java Math.random
score: -1
accepted answer: http://stackoverflow.com/a/25709544
has comment: http://stackoverflow.com/comment/40188017
has comment: http://stackoverflow.com/comment/40188147
upvote count: 2
has answer: http://stackoverflow.com/a/25709534
possible better answer: http://stackoverflow.com/a/25709534
tagged with: random
has answer: http://stackoverflow.com/a/25709575
has answer: http://stackoverflow.com/a/25709585
has answer: http://stackoverflow.com/a/25709536

http://stackoverflow.com/q/25592330
has title: upload Image to blob-store
accepted answer: http://stackoverflow.com/a/25606242
tagged with: java
answer count: 1
type: Question
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/25606242
has body: i have uploaded an image to blob-store by applying the example here https://developers.google.com/appengine/docs/java/blobstore/ and it worked just fine.. but when i removed the (index.jsp) file and used a formPanel and (com.google.gwt.user.client.ui.FileUpload) to upload my file it appeared on the datastore Viewer but couldn't see it on screen.help?? another issue that if i want to view the uploaded image on another view of my project, how can i handle that.. I'm very new to web-application field and need alittle explanation please.. thanks .
tagged with: gwt
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/40030126
type: QuestionComment
comment on: http://stackoverflow.com/q/25622712
score: 0
has text: @VinayVeluri Java entity classes. I am adding changes and running the application in tomcat
type: Comment

findbugs
tags question: http://stackoverflow.com/q/25643327
type: Tag
tag name: findbugs

http://stackoverflow.com/comment/40169340
comment on: http://stackoverflow.com/a/25693065
score: 0
type: Comment
has text: i agree, mid way started typing the string thing and then forgot to remove first part
type: AnswerComment

http://stackoverflow.com/comment/39931054
type: Comment
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/25568639
has text: don't you think there is just one switch? the second switch is for the conditional return.

http://stackoverflow.com/a/25589399
type: Answer
has body: Given that I don't intend to use testjv class elsewhere but in this executed file ? To plainly answer this yes if you donot intend to put the operations on data variables inside a method then you can either put them in constructor or you can put it inside a initialization block (both end in the same thing) eg for initialization block :- { driver = new FirefoxDriver(profile); baseUrl = "http://www.google.com"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } Now the reason why OOP languages donot allow operations on data variables outside a method is assume a scenario where in when you construct an object of this class you donot want your above lines of code to run automatically as in above case. How would you prevent this? So if these lines of code are in method then you have the control over the operations performed within the class on the data variables. You can even override these operations and define your own operations. You can even restrict other classes from calling your data modification operations by declaring your method private which is encapsulation.
answers question: http://stackoverflow.com/q/25589309
score: 0

http://stackoverflow.com/a/25591732
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25590777
has body: 2. It really slows everything down This is caused by the large size of your map: 1920 x 1080 blocks. With each of your tiles at 120 x 120 pixels, this is as much as 230,400 x 129,600 pixels. Rendering all of them is not a problem for OpenGL, since it will automatically clip everything not visible, and OpenGL is efficient in determining visibility. But before you send it off to the batch renderer, you are already doing a whole lot of work that can easily be avoided. (The following code snippets may not be proper Java.) Do not use if -- or even the better switch -- inside the inner drawing loop. Create an indexed lookup array: Texture textures[] = { dirt, stone, grass }; and then inside the loops use: game.batch.draw(textures[map[x][y]], x*120, y*120); Do not draw the entire map. Calculate the current viewport (the part of the map that shows up on your screen) and only draw that. Maintain a coordinate pair mapx,mapy that holds the top left coordinates of your map on screen. Moving this coordinate pair will make the map move around on your screen. If you want your "player" to always stay in the exact center of the screen, it can be as simple as mapx = (player_x - screen_width/2). Take care to check for out-of-range values. The part of the map that will be visible starts at int tile_xoffset = floor (mapx/120); int tile_yoffset = floor (mapy/120); rounding down, because if mapx is 119 you will still see a one-pixel strip of map[0][y]. (Minor note: floor is actually unnecessary. Java automatically rounds down when converting a float to integer.) The width (and similar, the height) of the visible part in 120x120 map blocks can be calculated as screen_width/120 but that is only the number of whole map blocks that is visible. You need to draw a 'border' as well, of blocks that are only partially visible. A more accurate calculation should be this (warning: untested!): int vis_width = (screen_width + (mapx % 120) + (120-(screen_width % 120)))/120; A good general principle is …
type: Answer
upvote count: 2

http://stackoverflow.com/comment/40134062
comment on: http://stackoverflow.com/q/25679354
score: 0
type: Comment
type: QuestionComment
has text: In my XML-files all tegs start with an uppercase letter...

http://stackoverflow.com/comment/40148885
type: QuestionComment
comment on: http://stackoverflow.com/q/25687660
score: 0
has text: Without seeing more code, it suggest poor design. Poor in the sense you are making all your components static so you can access them from other classes. That is not the correct way to communicate between components/classes
type: Comment

http://stackoverflow.com/q/25703056
has answer: http://stackoverflow.com/a/25703093
tagged with: java
has answer: http://stackoverflow.com/a/25703137
answer count: 4
score: 8
has answer: http://stackoverflow.com/a/25703228
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/56328724
downvote count: 0
possible better answer: http://stackoverflow.com/a/25703137
has title: How to create expandable panels using swing?
tagged with: swing
accepted answer: http://stackoverflow.com/a/25703228
has body: I would like to create a list of expandand/collapse panels, like on this image: I haven't found any swing component for this, so I began to create something like this. I tried to put buttons one under the other, which fill the available width, but doesn't really works. I can only see the last added one. JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(new JButton("Delphi Projects"), BorderLayout.NORTH); panel.add(new JPanel(), BorderLayout.NORTH); // hidden panel panel.add(new JButton("Delphi Projects | Delphi Files"), BorderLayout.NORTH); panel.add(new JPanel(), BorderLayout.NORTH); // hidden panel panel.add(new JButton("Other Files"), BorderLayout.NORTH); panel.add(new JPanel(), BorderLayout.NORTH); // hidden panel panel.add(new JButton("C++ Builder Projects | C++ Builder Files"), BorderLayout.NORTH); panel.add(new JPanel(), BorderLayout.NORTH); // hidden panel JScrollPane scroll = new JScrollPane(panel);
linked to: http://stackoverflow.com/q/15149565
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40176295
tagged with: expand
upvote count: 8

http://stackoverflow.com/comment/40018525
type: Comment
has text: @user3157090 Please don't put code in comments. Edit it into your question. You didn't try what I suggested. You added generics. If you're going to try and deserialize into a generic type, you're going to have to use a `TypeReference`. See my edit.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25615985

http://stackoverflow.com/a/25610569
has body: I would personally use a java.util.Scanner. If this is outside the scope of your school, find a new school! import java.util.Scanner; public class Example { public static void main(String[] args) { String sentence = "Hello world of overflowing stacks"; Scanner sc = new Scanner(sentence); while (sc.hasNext()) { System.out.println(sc.next()); } } } The output: Hello world of overflowing stacks
downvote count: 0
has comment: http://stackoverflow.com/comment/40008838
type: Answer
has comment: http://stackoverflow.com/comment/40007946
score: 2
has comment: http://stackoverflow.com/comment/40008259
upvote count: 2
answers question: http://stackoverflow.com/q/25610521

http://stackoverflow.com/comment/39912762
score: 0
has text: As your app is turning nanohttpd off, your app could copy those files just before closing. Why not? I suppose that there will be three files if you do three uploads?
comment on: http://stackoverflow.com/q/25555283
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25599051
type: UnansweredQuestion
tagged with: last.fm
has body: What I tried to do was use the last.fm API and track.getSimiliar to find 100 similiar songs to cher - believe. then find 10 similar songs to each of those 100 songs. when I try to find the 10 similar songs I am using the function call inside a while loop and iterating through the collection returned. this works till the 7th call and then it errors out. import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.Collection; import de.umass.lastfm.*; public class question { public static void main(String args[]) throws FileNotFoundException { Caller.getInstance().setUserAgent("tst"); String key = "6d1b1a7cbcc442e70b3bffcfb163c9a0"; // this is the key used // in the Last.fm // API examples String user = "dgupta33"; PrintStream outFile = new PrintStream(new File("output_trackNames.txt")); PrintStream outFile2 = new PrintStream(new File("output_Artist.txt")); Collection&lt;Track&gt; tracks = Track.getSimilar("Cher", "Believe", key); int num = 1; for (Track track : tracks) { if (track.getMbid() != "" &amp;&amp; num &lt;= 100) { outFile.println(track.getName()); outFile2.println(track.getArtist()); num++; } else if (num &gt; 100) break; } outFile.close(); outFile2.close(); } } the error that I am getting: [Fatal Error] :2025:48: XML document structures must start and end within the same entity. Exception in thread "main" de.umass.lastfm.CallException: org.xml.sax.SAXParseException; lineNumber: 2025; columnNumber: 48; XML document structures must start and end within the same entity. at de.umass.lastfm.Caller.call(Caller.java:268) at de.umass.lastfm.Caller.call(Caller.java:189) at de.umass.lastfm.Track.getSimilar(Track.java:369) at initiate.Main.main(Main.java:29) Caused by: org.xml.sax.SAXParseException; lineNumber: 2025; columnNumber: 48; XML document structures must start and end within the same entity. at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257) at com.sun.org.apache.xerces.internal.jaxp.D…
tagged with: http://stackoverflow.com/tag/xml
score: 2
answer count: 0
upvote count: 2
tagged with: java
has title: Querying last.fm API with java
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39987303

http://stackoverflow.com/q/25646985
has answer: http://stackoverflow.com/a/25647343
accepted answer: http://stackoverflow.com/a/25651720
has body: i want to send a file in attachment using java. I have two classes, one where the file location is specified and the second class is used as utility class to send the email So when i execute the first class it does not send the email. First class: public class SendFile { private static String[] args; public static void sendEmail(File filetosend) throws IOException, Exception{ //public static void main(String[] args) throws IOException { final String username = "email0@gmail.com"; final String password = "password"; Properties props = new Properties(); props.put("mail.smtp.auth", true); props.put("mail.smtp.starttls.enable", true); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress("email0@gmail.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("email0@gmail.com")); message.setSubject("Attach file Test from Netbeans"); message.setText("PFA"); MimeBodyPart messageBodyPart = new MimeBodyPart(); Multipart multipart = new MimeMultipart(); messageBodyPart = new MimeBodyPart(); //String filetosend = ("c:\\file.txt"); DataSource source = new FileDataSource(filetosend); System.out.println("The filetosend is ="+filetosend); messageBodyPart.setDataHandler(new DataHandler(source)); System.out.println("The source is ="+source); messageBodyPart.attachFile(filetosend); System.out.println("The file name is ="+messageBodyPart.getFileName()); multipart.addBodyPart(messageBodyPart); System.out.println("The message body part is ="+messageBodyPart); message.setContent(multipart); System.out.println("The message multi part is ="+multipart); System.out.println("Sending"); Transport.send(message); System.out.println("The message is ="+message); Sys…
linked to: http://stackoverflow.com/q/16117365
linked to: http://stackoverflow.com/q/3177616
type: Question
has comment: http://stackoverflow.com/comment/40074726
answer count: 2
has answer: http://stackoverflow.com/a/25651720
has title: Java send email with file in attachment
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40076195
score: 0
tagged with: jakarta-mail
tagged with: java
possible better answer: http://stackoverflow.com/a/25647343

http://stackoverflow.com/comment/40135269
comment on: http://stackoverflow.com/q/25645082
has text: That is the case of *A picture is worth a thousand words*. :) You have some datagrid.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/25694184
has comment: http://stackoverflow.com/comment/40160303
has answer: http://stackoverflow.com/a/25694220
possible better answer: http://stackoverflow.com/a/25694220
type: AnsweredQuestion
score: 0
has body: I was wondering why one can't use this as a generic while in a class in Java. For example say we have a class User and we want to have a static ArrayList of User. Why can't I use it like this: class User{ private ArrayList&lt;this&gt; listOfUsers = new ArrayList&lt;this&gt;(); } I really wonder why I have to specify User as generic and can't refer with this.
has comment: http://stackoverflow.com/comment/40160397
answer count: 3
accepted answer: http://stackoverflow.com/a/25694245
tagged with: java
has comment: http://stackoverflow.com/comment/40160293
has comment: http://stackoverflow.com/comment/40160233
has comment: http://stackoverflow.com/comment/40160332
has answer: http://stackoverflow.com/a/25694292
type: Question
has title: Why can't one use this as generic in ArrayList<this>?
has comment: http://stackoverflow.com/comment/40160295
has answer: http://stackoverflow.com/a/25694245
has comment: http://stackoverflow.com/comment/40160242

http://stackoverflow.com/comment/40128411
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25676911
has text: I understand, JosEdu, but I'd like to know how to go about trying it since I've heard that reflection might be needed. If that's what I need to do (or any other method you have in mind) please let me know and I will do further research on it.

http://stackoverflow.com/q/25663063
has title: How is it possible to upload files using MBean?
type: Question
type: UnansweredQuestion
tagged with: jmx
tagged with: upload
has body: Do you now if there is any way of uploading files using MBean? In particular, I want to be able to upload a file which is stored on my local machine to the application which is running on the remote server. I couldn't find any info source having this information unfortunately. Ideally it should be BROWSE button which you can click and specify file you'd like to upload. The other alternative I was thinking about is to copy and paste the content of the file into the TextArea of the MBean but it looks like you can't have a TextArea for some reason... just an ordinary input text field :/ Hence the length is very limited and the content is not readable.
tagged with: mbeans
score: 0
has answer: http://stackoverflow.com/a/25666800
tagged with: java
answer count: 1
tagged with: file

paypal-subscriptions
tags question: http://stackoverflow.com/q/25636414
tag name: paypal-subscriptions
type: Tag

http://stackoverflow.com/q/25557906
has title: @Autowire failure for JPA Repository in multi-module project
has comment: http://stackoverflow.com/comment/39924658
tagged with: spring
score: 2
has answer: http://stackoverflow.com/a/25563919
has body: I have a 3 module maven project, Model, Service and Web. In Model I am defining JPARepositories and my @entity classes. I actually have 2 entity managers and 2 transaction managers in the Model project so I can connect to multiple databases (I dont need distributed transactions). But I am getting errors on the injection of a JPARepository in my service layer. No qualifying bean of type [com.mycompany.rd.repository.misf.ProjectRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=projectRepository)} In web.xml I have this: contextConfigLocation classpath:/appContext-demo.xml, classpath*:/appContext-services.xml org.springframework.web.context.ContextLoaderListener appContext-demo.xml is in the web module and looks like this: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"> </beans> In my service module, appContext-services.xml looks like this: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation…
tagged with: java
has answer: http://stackoverflow.com/a/25572625
downvote count: 0
tagged with: spring-data
favorite count: 0
type: Question
answer count: 2
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/25650476
upvote count: 0
tagged with: junit
has title: How to execute Junit test and generate HTML result file just using one command line (use Maven surefire Plugin)
answer count: 1
tagged with: maven
downvote count: 1
favorite count: 0
has body: Now, to get HTML result file from Maven Surefire Report Plugin, I have to execute 2 command lines: mvn test -Dtest=classname mvn surefire-report:report Is there any solution to combine these two command lines into one command line? I just need to make a shorter way instead of executing 2 commands as now. Thanks
type: Question
has answer: http://stackoverflow.com/a/25650507
type: UnansweredQuestion
tagged with: java
score: -1

http://stackoverflow.com/comment/40111063
has text: Execuse me. Somehow I checked my junit version is 4.11 and thought it is smaller than 4.4, thus I loaded powermock-module-junit4-legacy. It was a mistake. I corrected that and got it run. I saw it in the log "javax.xml.parsers.ParserConfigurationException: Simulated ex" at XmlFileWriter.createCompleteExportXml(XmlFileWriter.java:35) at XmlFileWriterTestWithPowerMock.testCreateCompleteExportXmlThrowsParserConfigurationException(XmlFileWriterTestWithPowerMock.java:86). But the problem now is, the test is not reported by surefire. I did not see it in target/surefire-report. Do you know why?
type: AnswerComment
comment on: http://stackoverflow.com/a/25645897
score: 0
type: Comment

http://stackoverflow.com/q/25661123
tagged with: android
has answer: http://stackoverflow.com/a/25661434
has answer: http://stackoverflow.com/a/25661391
type: AnsweredQuestion
has title: Android activity produces black screen because of the content
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40100108
has body: I have 2 activities. ActivityA starts activityB from a button click. When the button is clicked i create a new dialog and display an image as a kind of cut down loading screen (not bothered with progress bars). when activityB starts the dialog from ActivityA is killed and i immediately start a new one at the top of oncreate. My oncreate for activityB does quite a few things. Creates an adview, some text for the main view and creates a GLsurface renderer. The problem is that when activityB's oncreate is called i get a 4 second black screen between my two dialogs. I would like to try and reduce this as much as i can. So is there anyway to have the dialog in activity B run immdeiately rather than waiting for the rest of the onCreate to finish doing what it is doing. Will provide code if need be UPDATE. it is the creation of my glsurface renderer that is causing the black screen for so long. Here is the Activity B code public class ActivityB extends BaseGameActivity { /** Hold a reference to our GLSurfaceView */ private MyGLSurfaceView mGLSurfaceView; public GamePlay GamePlay; public GoogleApiClient mGoogleApiClient = null; private AdView adView; private static final String AD_UNIT_ID = "******************************"; private Button RotateButton; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // load screen dialog Dialog loader_dialog = new Dialog(this,android.R.style.Theme_Black_NoTitleBar_Fullscreen); loader_dialog.setContentView(R.layout.loading_screen); loader_dialog.show(); // Create an ad. adView = new AdView(this); adView.setAdSize(AdSize.SMART_BANNER); adView.setAdUnitId(AD_UNIT_ID); // Add the AdView to the view hierarchy. The view will have no size // until the ad is loaded. RelativeLayout layout = new RelativeLayout(this); layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); // Create an ad request. Check logcat output for the hashed device ID to // get test ads on a…
accepted answer: http://stackoverflow.com/a/25661434
tagged with: java
tagged with: android-activity
type: Question
possible better answer: http://stackoverflow.com/a/25661391

http://stackoverflow.com/q/25700074
accepted answer: http://stackoverflow.com/a/25700354
has comment: http://stackoverflow.com/comment/40171059
tagged with: android
has comment: http://stackoverflow.com/comment/40171018
tagged with: datetime
has body: I am having some problem when trying to get last week, month and year record from SQLite database. My database table: I only managed to get the record for today, yesterday, this week, this month and this year. For this week: SELECT SUM(amount) AS Total, (substr(date, 7, 4) || '-' || substr(date, 4, 2) || '-' || substr(date,1, 2)) AS currentDate FROM TransactionRec WHERE currentDate BETWEEN DATE('now', '-7 days') AND Date('now') GROUP BY currentDate For this month: SELECT SUM(amount) AS Total, (substr(date, 7, 4) || '-' || substr(date, 4, 2) || '-' || substr(date,1, 2)) AS currentDate FROM TransactionRec WHERE currentDate BETWEEN DATE('now', 'start of month') AND Date('now') GROUP BY currentDate For this year: SELECT SUM(amount) AS Total, (substr(date, 7, 4) || '-' || substr(date, 4, 2) || '-' || substr(date,1, 2)) AS currentDate FROM TransactionRec WHERE currentDate BETWEEN DATE('now', '-1 year') AND Date('now')GROUP BY currentDate But I have no idea how to alter the SQL statement to get last week, month and year. Any ideas? Thanks in advance.
has comment: http://stackoverflow.com/comment/40171089
has answer: http://stackoverflow.com/a/25700354
has title: SQL Statement to get last week, month and year records
has comment: http://stackoverflow.com/comment/40171000
type: AnsweredQuestion
score: 0
tagged with: sql
tagged with: java
tagged with: sqlite
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/40171128

http://stackoverflow.com/comment/72029681
type: AnswerComment
score: 0
has text: I needed to delete the .snap File in the .metadata/.plugins/org.eclipse.core.resources/ dir see @Gert 's answer
type: Comment
comment on: http://stackoverflow.com/a/28697722

equality
tags question: http://stackoverflow.com/q/25655404
tag name: equality
type: Tag

http://stackoverflow.com/a/25662138
has comment: http://stackoverflow.com/comment/40102175
has comment: http://stackoverflow.com/comment/40102769
score: 0
answers question: http://stackoverflow.com/q/25661562
type: Answer
has body: Yes. It's all TCP. Blocking/non-blocking/asynchronous are properties of the API, not of the protocol.

http://stackoverflow.com/q/25685993
has comment: http://stackoverflow.com/comment/40145051
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40145306
has comment: http://stackoverflow.com/comment/40145089
has answer: http://stackoverflow.com/a/25686569
tagged with: android-intent
favorite count: 0
has comment: http://stackoverflow.com/comment/40144400
has answer: http://stackoverflow.com/a/25686580
score: 3
has body: How to pass context to a service with putExtra? The problem is : android.os.Application cannot be cast to java.io.Serializable How to solve this problem? // main activity public void btnGetLocate() { Intent intent = new Intent(this, Sleeper.class); intent.putExtra("context", (Serializable) getApplicationContext()); startService(intent); } // another file public class MyService extends IntentService { public Sleeper() { super("MyService"); } protected void onHandleIntent(Intent intent) { Context context = (Context) intent.getExtras().getSerializable("context"); // make Error, main problem MyClass mc = new MyClass(context); ... } public void onDestroy() { super.onDestroy(); Toast.makeText(this, "destroyed"), Toast.LENGTH_SHORT).show(); } }
answer count: 3
has answer: http://stackoverflow.com/a/25686544
tagged with: android
tagged with: java
has title: Pass context to service with putExtra
has comment: http://stackoverflow.com/comment/40144917
has comment: http://stackoverflow.com/comment/40144435
has comment: http://stackoverflow.com/comment/40144972
has comment: http://stackoverflow.com/comment/40144486
linked to: http://stackoverflow.com/q/6446221
tagged with: service
type: Question
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/40152404
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25688088
has text: @MonaD I added an example to my answer

http://stackoverflow.com/comment/40080645
comment on: http://stackoverflow.com/q/25607282
type: QuestionComment
type: Comment
score: 0
has text: JOGL takes into account the position and the limit of a buffer.

http://stackoverflow.com/a/25659062
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25658930
has body: Yes. There is a happens-before relationship for a volatile statement: Please consider this stackoverflow question: Does Java volatile variables impose a happens-before relationship before it is read? A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. Also you can read section 3.1.3 (Locking and visbility) in the great book called "Java Concurrency in Practice". There is a relevant explanation there about a similar visibility issue and the outline is this: Locking is not just about mutual exclusion; it is also about memory visibility.To ensure that all threads see the most up to date values of shared mutable variables, the reading and writing threads must synchronize on a common lock In your code the lock is the volatile variable

http://stackoverflow.com/q/25695582
has answer: http://stackoverflow.com/a/25696142
tagged with: java
type: Question
answer count: 2
has body: I am trying to include rss feed parsing in my app engine application, but I have run into a roadblock. I understand that not all API's are supported on appengine: Exception in thread "Thread-4" com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'urlfetch' or call 'Fetch()' was not found. at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:113) at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:38) at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.fetchResponse(URLFetchServiceStreamHandler.java:417) at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getInputStream(URLFetchServiceStreamHandler.java:296) at java.net.URL.openStream(URL.java:1037) at com.aggieupdates.bo.RSSFeedParser.read(RSSFeedParser.java:197) Line 197 is: return url.openStream(); url is in java.net.URL package Is there an easy fix for this issue?
tagged with: rss
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25696023
has title: RSS Feed Parser in Google App Engine
score: 0
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/40169714

http://stackoverflow.com/comment/50328807
type: Comment
score: 2
type: AnswerComment
has text: @nawfal: that does even work with parameters, e.g. `Foo::new` instead of `(x,y)->new Fo(x,y)` and with arrays, so the stream API allows something like: `Foo[] array =myList.stream().toArray(Foo[]::new);`. Even more fancy, within an instance method, you can bind a `super`-invocation to a function, e.g. `list.forEach(super::doSometing);` to call a superclass method for each element…
comment on: http://stackoverflow.com/a/25567047

http://stackoverflow.com/q/25711008
has comment: http://stackoverflow.com/comment/40190733
has comment: http://stackoverflow.com/comment/40193139
favorite count: 0
has comment: http://stackoverflow.com/comment/40191904
has title: Confusion with Java packages
has comment: http://stackoverflow.com/comment/40190668
answer count: 4
has answer: http://stackoverflow.com/a/25711134
has comment: http://stackoverflow.com/comment/40195291
has answer: http://stackoverflow.com/a/39395900
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/25711393
has comment: http://stackoverflow.com/comment/40190672
tagged with: final
tagged with: package
linked to: http://stackoverflow.com/q/10546720
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/25711126
has comment: http://stackoverflow.com/comment/40190686
has body: So I thought I understood packages, but turns out I don't. Classes inside a package: I have this folder structure: mypackage/mysubpackage. Inside mysubpackage folder I have 2 classes: package mypackage.mysubpackage; public class Class1 {...} and package mypackage.mysubpackage; public class Class2 {...} However, when I compile Class1 (which uses methods from Class2) using javac Class1.java inside the directory mypackage/mysubpackage, it can't see Class2: Class1.java: error: cannot find symbol Class2 c = new Class2(); ^ symbol: class Class2 location: class Class1 It works fine if I run javac Class1.java in the directory that contains mypackage/mysubpackage. Shouldn't the compilation work inside mysubpackage folder? Classes in another package: Now, I have another class with methods that I want to be accesible to all the subpackages, so I create a final Commons.java inside mypackage/commons: package mypackage.commons; public final class Commons { public static double method() {...} ... } And then I update Class2 importing that class so that I can use its methods inside the class: package mypackage.mysubpackage; import mypackage.commons.*; public class Class2 {...} Now it doesn't find the method I defined in the final class: ./mypackage/mysubpackage/Class2.java: error: cannot find symbol double var = method(); ^ symbol: method method() location: class Class2 Shouldn't if find it? I think I'm importing it correctly, the methods are static and the class is final. Why doesn't it recognize it? Cheers!
downvote count: 1
has comment: http://stackoverflow.com/comment/40190720
tagged with: class
has comment: http://stackoverflow.com/comment/40190727
tagged with: static
tagged with: java

http://stackoverflow.com/a/25637424
type: Answer
accepted answer of: http://stackoverflow.com/q/25633477
has comment: http://stackoverflow.com/comment/79092722
answers question: http://stackoverflow.com/q/25633477
downvote count: 0
has comment: http://stackoverflow.com/comment/40086102
upvote count: 17
score: 17
has comment: http://stackoverflow.com/comment/40083259
has comment: http://stackoverflow.com/comment/134116970
type: AcceptedAnswer
has body: Per the docs you have disabled the spring boot autoconfig in the first example by using @EnableWebSecurity, so you would have to explicitly ignore all the static resources manually. In the second example you simply provide a WebSecurityConfigurer which is additive on top of the default autoconfig.

http://stackoverflow.com/comment/40115836
comment on: http://stackoverflow.com/q/25669990
type: Comment
has text: What kind of MQ are you using? Do you have an API jar?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39944037
score: 0
comment on: http://stackoverflow.com/a/25575498
type: Comment
has text: I don't think it's really fair to count the internal threads.. but it does add another perspective.
type: AnswerComment

http://stackoverflow.com/comment/39988341
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25599827
has text: use different attribute name for `currentStatus` in your get method.

http://stackoverflow.com/a/25578932
has comment: http://stackoverflow.com/comment/39950458
score: 0
answers question: http://stackoverflow.com/q/25578887
type: Answer
has comment: http://stackoverflow.com/comment/39950423
has body: No other question has addressed this, that I've been able to find. Please check this Android ListView in fragment example and Create listview in fragment android example. There are lots of examples if you write "fragment with list views" on Google Check this: https://www.google.co.in/?gfe_rd=cr&amp;ei=uU0BVJzYIsHN8geZ8IBI&amp;gws_rd=ssl#q=fragment+with+list+views

http://stackoverflow.com/comment/40151830
type: Comment
type: QuestionComment
has text: Thank you @Bruno for the suggestion. I added the keystore infos on the client, relaxed the costraint to wantClientAuthentication, but certificate does not seems to be sent from the client ( I have a filter on the servlet and request.getClientInfo().getCertificates(); returns an empty list
comment on: http://stackoverflow.com/q/25683948
score: 0

http://stackoverflow.com/q/25611144
upvote count: 0
type: UnansweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/40008961
downvote count: 2
answer count: 1
tagged with: django
has body: I am trying to create a simple application using Java and Servlets. In my app, there are users, and each one should have his/her own page. I think the URLs for this page should look like: www.myapp.com/users/john www.myapp.com/users/paul ... and so on. In Django, there are ways to capture parts of the URL. For example, for what I would like to do above, you would create a URL entry like url(r'^articles/([a-z])/$', views.userpage) How do you do this with Java servlets, web.xml, etc?
has answer: http://stackoverflow.com/a/25611398
tagged with: url-mapping
tagged with: java
has title: How do you create a RESTful API with Java servlets?
tagged with: servlets
favorite count: 0
type: Question
tagged with: web.xml

http://stackoverflow.com/q/25555540
has answer: http://stackoverflow.com/a/25555888
has title: create global unique object from interface
score: 0
has body: this is more of an architectural question. I'd like to have a global object in my project which is accessible to every class, that needs it but without creating an instance of it every time. The object itself is a composition of different services. My first approach was to define an interface in which the object is instantiated and then can be injected into each class by just saying implements. What I want to know is, if this approach is clean or kinda hacky or really gross. Here is my implementation so far: public final class SystemServices { private final SecurityService securityService; private final PersistencyService persistencyService; private final RecordService recordService; private final DispatcherService dispatcherService; private SystemServices(Builder builder) { this.securityService = builder.securityService; this.persistencyService = builder.persistencyService; this.recordService = builder.recordService; this.dispatcherService = builder.dispatcherService; } public SecurityService getSecurityService() { return securityService; } public PersistencyService getPersistencyService() { return persistencyService; } public RecordService getRecordService() { return recordService; } public DispatcherService getDispatcherService() { return dispatcherService; } public static class Builder { private SecurityService securityService; private PersistencyService persistencyService; private RecordService recordService; private DispatcherService dispatcherService; public Builder setSecurityService(SecurityService securityService) { this.securityService = securityService; return this; } public Builder setPersistencyService(PersistencyService persistencyService) { this.persistencyService = persistencyService; return this; } public Builder setRecordService(RecordService recordService) { this.recordService = recordService; return this; } public Builder setDispatcherService(DispatcherService dispatcherService) { this.dispatcherService = dispatcherService; return this; } public…
tagged with: singleton
has answer: http://stackoverflow.com/a/25555677
tagged with: interface
tagged with: java
tagged with: architecture
type: Question
answer count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/25556854
score: 1
type: Answer
has body: you can use java.util.regex.Pattern and java.util.regex.Matcher This code will do what you ask for: public static void main(String[] args) { String[] testList = {"a1@b.com", "a2@b.com abcd efg", "x y z a3@b.com", "p q a4@b.com x z", "asd[a5@b.coom]gh"}; Pattern EMAIL_PATTERN = Pattern.compile("[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})"); for(String test : testList){ Matcher m = EMAIL_PATTERN.matcher(test); while (m.find()) { System.out.println(m.group(0)); } } }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25556132
upvote count: 1
answers question: http://stackoverflow.com/q/25556132

http://stackoverflow.com/comment/40068656
has text: Am I right in thinking that: a) All of the source arrays will have the same number of elements and b) Each unique index where 0 <= index < arrayLength must be used once and only once?
type: Comment
comment on: http://stackoverflow.com/q/25644020
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39950352
type: AnswerComment
score: 0
type: Comment
has text: Lemos Can you add an example.Thanks
comment on: http://stackoverflow.com/a/25577123

http://stackoverflow.com/q/25588685
type: Question
has comment: http://stackoverflow.com/comment/39968021
accepted answer: http://stackoverflow.com/a/25588690
has answer: http://stackoverflow.com/a/25588690
tagged with: swing
has comment: http://stackoverflow.com/comment/39967995
has title: How can i make a Jlist automatically scroll down after adding new elements
tagged with: text
type: AnsweredQuestion
score: 1
tagged with: java
downvote count: 0
answer count: 1
tagged with: file
upvote count: 1
has body: Just got a quick question, How can i make a JList automatically scroll to the new element that i've added. Heres an example if i add 4 new elements to a jList. It will just add. normally Then when i add a 5th element it just adds the element, dosen't scroll down to display it. Any tips? Thanks.
favorite count: 0

http://stackoverflow.com/a/25665912
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40108122
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25665663
has body: You would have to override equals() and hashcode() to accomplish that refer this link to accomplish that.

http://stackoverflow.com/comment/40166514
comment on: http://stackoverflow.com/a/25694157
type: AnswerComment
score: 0
has text: How can I be certain AuthenticationManagerBuilder.jdbcAuthentication() won't instantiate another JdbcUserDetailsManager?
type: Comment

http://stackoverflow.com/q/25711048
accepted answer: http://stackoverflow.com/a/25728540
upvote count: 6
has answer: http://stackoverflow.com/a/25728540
favorite count: 0
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/63628808
has comment: http://stackoverflow.com/comment/40190948
tagged with: java
has comment: http://stackoverflow.com/comment/40190758
has comment: http://stackoverflow.com/comment/40191773
downvote count: 1
has comment: http://stackoverflow.com/comment/40190976
has comment: http://stackoverflow.com/comment/40191099
possible better answer: http://stackoverflow.com/a/63628808
type: Question
has comment: http://stackoverflow.com/comment/40192375
tagged with: java-memory-model
has comment: http://stackoverflow.com/comment/40190854
has title: Understanding intra-thread semantics
has comment: http://stackoverflow.com/comment/40190716
tagged with: multithreading
has body: Could you explain in simple words what "the program satisfies intra-thread semantic" means? Is it possible to provide simple examples of programs which satisfy and which don't satisfy such semantics?
score: 5

http://stackoverflow.com/comment/40179598
has text: What is preventing you from doing so? If you have tried to do this, post your attempt. If not, go do that and then show us what you came up with. At the very least tell us what research you have done.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25704860

http://stackoverflow.com/q/25574797
accepted answer: http://stackoverflow.com/a/25574912
tagged with: java-memory-model
has comment: http://stackoverflow.com/comment/39947760
score: 3
has body: Imagine we have volatile int publisher = 0; volatile List&lt;String&gt; list = Arrays.asList("Buenos Aires", "Córdoba", "La Plata"); volatile String[] array = {"Buenos Aires", "Córdoba", "La Plata"}; As far as I understand. Initial values in list and array are published correctly and are visible to all the reading threads. All values added after the initialization are not safe-published. Still we can read and publish them safely using //in Thread 1 list.add("Safe City"); array[2] = "Safe city"; publisher = 1; //in Thread2 if(publisher == 1) { String city = list.get(3); city = array[2]; } Am I right?
has comment: http://stackoverflow.com/comment/39942618
has answer: http://stackoverflow.com/a/25577567
possible better answer: http://stackoverflow.com/a/25577567
tagged with: concurrency
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25574912
upvote count: 3
has comment: http://stackoverflow.com/comment/39942788
downvote count: 0
has answer: http://stackoverflow.com/a/25574896
has comment: http://stackoverflow.com/comment/39942634
tagged with: java
tagged with: volatile
has title: Using volatile collections and arrays in Java
has answer: http://stackoverflow.com/a/28437726
tagged with: collections
favorite count: 0
type: Question

http://stackoverflow.com/comment/39915307
type: Comment
score: 0
type: AnswerComment
has text: @Paldan An instance can always access static methods/data of its own class (and of other classes if the access modifiers allow). It's the other direction that doesn't work (accessing non-static data/methods from a static method).
comment on: http://stackoverflow.com/a/25560100

http://stackoverflow.com/comment/40061301
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25639845
has text: @TheLostMind I think it should be `index%3==2` ? java array is 0-based.
score: 1

http://stackoverflow.com/comment/40170517
has text: Steve, thanks for the changes. I tried them and it didn't help. I have the correct brackets further down in my code.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25699678
type: QuestionComment

http://stackoverflow.com/comment/40186898
has text: @JoshBoothe please post your manifest file as well, perhaps this is related to the theme set on the Activity.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25708825
score: 1

http://stackoverflow.com/q/25712606
has body: If orientation changes at runtime I want to show to fragments side to side. What I did is declare two framelayouts with the second size zero in terms of height and width. &lt;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"&gt; &lt;!-- As the main content view, the view below consumes the entire space available using match_parent in both dimensions. --&gt; &lt;FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;FrameLayout android:id="@+id/conversation_history" android:layout_width="0px" android:layout_height="0px"/&gt; &lt;!-- android:layout_gravity="start" tells DrawerLayout to treat this as a sliding drawer on the left side for left-to-right languages and on the right side for right-to-left languages. The drawer is given a fixed width in dp and extends the full height of the container. A solid background is used for contrast with the content view. --&gt; &lt;ListView android:id="@+id/left_drawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:choiceMode="singleChoice" android:divider="@android:color/transparent" android:dividerHeight="0dp" android:background="#111"/&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; and then when orientation changed I tried resizing the frame layouts. Instead of each fragment occupying half of the screen both overlap and occupy the whole screen. So why do both occupy the whole screen instead of occupying half of the screen? FrameLayout frame = (FrameLayout) findViewById(R.id.content_frame); int portraitWidth,portriatHeight; portraitWidth = frame.getWidth(); portriatHeight = frame.getHeight(); frame.getLayoutParams().width = portriatHeight/2; frame.getLayoutParams().height = portraitWidth/2; frame.setX(0); frame.setY(0); frame.requestLayout(); fram…
score: 1
tagged with: android
tagged with: java
favorite count: 0
type: Question
tagged with: android-framelayout
has title: how to change view size at Runtime
type: UnansweredQuestion
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25713064
upvote count: 1

http://stackoverflow.com/a/25593159
has comment: http://stackoverflow.com/comment/39976761
accepted answer of: http://stackoverflow.com/q/25593116
type: Answer
has body: You're creating MenuItem[] menu as a local variable and never storing it after the constructor. So not only can you not clone it, you can't ever access it again. Try using a field for the menu variable, like this: public class Menu implements Cloneable { final int MAX_ITEMS = 50; private MenuItem[] menu; public Menu(){ menu = new MenuItem[MAX_ITEMS]; } } Now any method within the Menu class can access the menu you set during construction. As for cloning, it depends how deeply you want to clone. If you just want a new Menu object that refers to the same menu array in memory, see cloneOne. If you want a new Menu object with a new menu array containing the same objects as the old menu array, see cloneTwo. If you want to go further than that, you'll have to put up some details for the MenuItem class: public class Menu implements Cloneable { final int MAX_ITEMS = 50; private MenuItem[] menu; public Menu(){ menu = new MenuItem[MAX_ITEMS]; } public Menu cloneOne(){ Menu a = new Menu(); a.menu = menu; return a; } public Menu cloneTwo(){ Menu a = new Menu(); a.menu = new MenuItem[menu.length]; for(int i = 0; i &lt; menu.length; i++) a.menu[i] = menu[i]; return a; }
has comment: http://stackoverflow.com/comment/39977028
score: 0
answers question: http://stackoverflow.com/q/25593116
type: AcceptedAnswer

http://stackoverflow.com/comment/40012636
comment on: http://stackoverflow.com/a/25613098
type: Comment
score: 0
type: AnswerComment
has text: No problem. In most cases, you only have `class Foo implements Comparable<Foo>` and then `ArrayList<Foo>`. The *mutually comparable* simply means that `foo` can be compared to another `foo`.

http://stackoverflow.com/a/25698298
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25698231
score: 3
accepted answer of: http://stackoverflow.com/q/25698231
type: Answer
has body: ...and java uses unicode format so it should read 2 byte with each .read() method... Unicode is not a 2-byte format. Indeed, as Biffen says, it's not a character encoding at all. There are several Unicode character encodings: A mostly-single-byte one called UTF-8 (but some characters will be 2, 3, or 4 bytes), a mostly-two-byte one called UTF-16 (but some characters will be four), and an always-four-byte one called UTF-32. There are also variations of these. Obligatory link: The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) When you create a FileReader the way you have, it uses the default encoding for your platform, which is likely to be Windows-1252, ISO 8859-1, or UTF-8. To specify the format, you can use an InputStreamReader constructed with a specific encoding.
upvote count: 3

http://stackoverflow.com/a/25650565
accepted answer of: http://stackoverflow.com/q/25598218
has body: Auto away is determined and set by the structure/thermostat itself using various algorithms based on signals such as presence among others. The Nest API only lets you read the status of auto-away. While writing, the only allowed valid values are either 'away' or 'home'
type: Answer
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25598218
has comment: http://stackoverflow.com/comment/40120668

http://stackoverflow.com/comment/40169285
has text: hes ... still with us. Lets all hope he stays for a few more decades, he created a truly marvelous language.
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25674424
type: AnswerComment

oop
tags question: http://stackoverflow.com/q/25599989
tags question: http://stackoverflow.com/q/25688796
tags question: http://stackoverflow.com/q/25590127
tags question: http://stackoverflow.com/q/25643906
tags question: http://stackoverflow.com/q/25635097
tags question: http://stackoverflow.com/q/25671384
tags question: http://stackoverflow.com/q/25611049
tags question: http://stackoverflow.com/q/25651185
tags question: http://stackoverflow.com/q/25630990
tags question: http://stackoverflow.com/q/25589309
tags question: http://stackoverflow.com/q/25698880
tags question: http://stackoverflow.com/q/25711828
tags question: http://stackoverflow.com/q/25587264
tags question: http://stackoverflow.com/q/25651066
tags question: http://stackoverflow.com/q/25675577
tags question: http://stackoverflow.com/q/25592573
tag name: oop
tags question: http://stackoverflow.com/q/25618184
tags question: http://stackoverflow.com/q/25617276
tags question: http://stackoverflow.com/q/25679700
tags question: http://stackoverflow.com/q/25705053
tags question: http://stackoverflow.com/q/25712458
tags question: http://stackoverflow.com/q/25703386
tags question: http://stackoverflow.com/q/25636108
tags question: http://stackoverflow.com/q/25688330
tags question: http://stackoverflow.com/q/25709948
tags question: http://stackoverflow.com/q/25586560
tags question: http://stackoverflow.com/q/25624672
tags question: http://stackoverflow.com/q/25559339
type: Tag
tags question: http://stackoverflow.com/q/25685105
tags question: http://stackoverflow.com/q/25600122

http://stackoverflow.com/comment/39929896
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25567294
has text: +1 guys, that could be the reason.. any idea how to remove those escape characters programmatic ally ?
type: AnswerComment

jna
type: Tag
tags question: http://stackoverflow.com/q/25628885
tags question: http://stackoverflow.com/q/25602109
tags question: http://stackoverflow.com/q/25624012
tag name: jna

crash
tags question: http://stackoverflow.com/q/25711431
type: Tag
tag name: crash
tags question: http://stackoverflow.com/q/25622002
tags question: http://stackoverflow.com/q/25688037
tags question: http://stackoverflow.com/q/25706794

http://stackoverflow.com/comment/39898402
score: 0
comment on: http://stackoverflow.com/a/25551240
has text: @user3331329 I don't know what you mean by "conversion". Both sides could expect time in the same time zone. Java provides methods to obtain the names of the available time zones and information about them. Since you're using JDK 1.5, I'd dig into the documentation for `Calendar` and `TimeZone` and the other associated classes.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40062536
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25640580
has text: and it is the OS before that; there are setters on System where the Java Runtime is setting instances of InputStream and PrintStream that wrap the underlying OS level streams. Unless ofcourse one goes and calls those setters themselves :)

http://stackoverflow.com/q/25706216
accepted answer: http://stackoverflow.com/a/25706217
has answer: http://stackoverflow.com/a/58322547
score: 556
has answer: http://stackoverflow.com/a/25706217
possible better answer: http://stackoverflow.com/a/29694504
has answer: http://stackoverflow.com/a/57840064
has answer: http://stackoverflow.com/a/54345388
has title: What does a "Cannot find symbol" or "Cannot resolve symbol" error mean?
has answer: http://stackoverflow.com/a/46075674
has answer: http://stackoverflow.com/a/64919970
answer count: 19
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/62995462
has body: Please explain the following about "Cannot find symbol", "Cannot resolve symbol" or "Symbol not found" errors (in Java): What do they mean? What things can cause them? How does the programmer go about fixing them? This question is designed to seed a comprehensive Q&A about these common compilation errors in Java.
tagged with: compiler-errors
upvote count: 563
has answer: http://stackoverflow.com/a/51904587
has answer: http://stackoverflow.com/a/57387214
has answer: http://stackoverflow.com/a/78504801
has answer: http://stackoverflow.com/a/34115842
has answer: http://stackoverflow.com/a/51114349
tagged with: java
tagged with: cannot-find-symbol
has answer: http://stackoverflow.com/a/70671459
has answer: http://stackoverflow.com/a/39751150
has answer: http://stackoverflow.com/a/29694504
has answer: http://stackoverflow.com/a/73193290
has answer: http://stackoverflow.com/a/37207223
has answer: http://stackoverflow.com/a/73960634
has answer: http://stackoverflow.com/a/35860058
downvote count: 7
favorite count: 0
type: Question

http://stackoverflow.com/q/25672921
has body: i want to create a very simple encrypt/decrypt project. but at first i want to read jpg file and write it to a file with a given password then read that file again and check the password in the file and the provided password but i get: Exception in thread "main" java.lang.IllegalArgumentException: im == null! at javax.imageio.ImageIO.write(Unknown Source) at javax.imageio.ImageIO.write(Unknown Source) at GSM.AES.deccryption(AES.java:105) at GSM.AES.main(AES.java:27) My codes: public static void main(String args[]) { myWrite(); String encryptedFilePath = System.getProperty("user.dir")+ "\\"+"Encrypted"+".mmlooloo"; String destinationFilePath = System.getProperty("user.dir") + "\\"; try { myRead(encryptedFilePath,destinationFilePath,"123456"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return; } My encrypt : public static void myWrite() { try { System.out.println("Plesase Enter Number Of Pages !!!!!"); BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in)); int numberOfPage = Integer.valueOf(bufferRead.readLine().toString()); String dirName= System.getProperty("user.dir")+"\\"; byte[] base64StringEnc; ByteArrayOutputStream baos=new ByteArrayOutputStream(1000); FileOutputStream myMatLabFileEnc = null; String filePath = System.getProperty("user.dir")+ "\\"+"Encrypted"+".mmlooloo"; myMatLabFileEnc = new FileOutputStream (filePath); String imagFileName; String imgPathString; String password = "123456"; myMatLabFileEnc.write(password.getBytes()); myMatLabFileEnc.write("\n".getBytes()); for(int i = 1 ; i&lt;=numberOfPage ;i++) { imagFileName = Integer.toString(i) +".jpg"; BufferedImage img=ImageIO.read(new File(dirName,imagFileName)); ImageIO.write(img, "jpg", baos); baos.flush(); myMatLabFileEnc.write(baos.toByteArray()); myMatLabFileEnc.write("\n".getBytes()); baos.reset(); imgPathString = dirName + imagFileName; File f = new File(imgPathString); f.delete(); } myMatLabFileEnc.close();…
has comment: http://stackoverflow.com/comment/40126251
has comment: http://stackoverflow.com/comment/40147036
has comment: http://stackoverflow.com/comment/40146092
favorite count: 0
type: Question
has title: image read and write java.lang.IllegalArgumentException
has comment: http://stackoverflow.com/comment/40145762
has comment: http://stackoverflow.com/comment/40143085
score: -1
has comment: http://stackoverflow.com/comment/40147477
has comment: http://stackoverflow.com/comment/40130011
tagged with: javax.imageio
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40126259
has comment: http://stackoverflow.com/comment/40146328
tagged with: file-io
accepted answer: http://stackoverflow.com/a/25687735
tagged with: java
downvote count: 2
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25687735

http://stackoverflow.com/a/25637776
has comment: http://stackoverflow.com/comment/40057684
has body: The src folder will not be exported into your Jar file. Thats just for you IDEs source code. You need to load the images as a resource: Image image = new Image(App2.display,this.getClass().getResourceAsStream("search.jpg"));
has comment: http://stackoverflow.com/comment/40057810
has comment: http://stackoverflow.com/comment/40057613
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25637406
has comment: http://stackoverflow.com/comment/40057506

http://stackoverflow.com/a/25702564
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40175446
answers question: http://stackoverflow.com/q/25702489
type: Answer
has comment: http://stackoverflow.com/comment/40175549
accepted answer of: http://stackoverflow.com/q/25702489
has body: First point, You are reading the content fully once, while((line=asd.readLine()) != null) { count++; //count how many lines } Without resetting the stream, however you can't really use it on the BufferedReader, because it can only reset back a certain number of bytes (the buffer size). if your file is bigger than that, it won't work, you try to read the file again. Which you will never be able to. Since the reader has already reached the end of the file. while((line=asd.readLine()) != null) { count++; //added now ----&gt; 1 String var[] = line.split("-"); names[j] = var[0]; timeInd[j]=Double.parseDouble(var[1]); scores[j] = var[2]; difficulty[j] = var[3]; j++; } So you could add the counting inside the second while loop. see the comments in the second while loop. Second point, Don't suppress the exception: catch(Exception e){}; Fixing the above two will help you debug your code. With respect to code review, you could make the below changes for a smooth run. create a class.structure to represent a single line read: class Data implements Comparable { String name; Double timeInd; String score; String difficulty; } when you iterate each line from the file, create a Data Object and populate its attributes. Once the loop is done, you will have a List. Write a comparator which compares two Data objects based on their timeid. http://www.tutorialspoint.com/java/java_using_comparator.htm Now use, Collections.sort(List,comparator), to sort the List. Iterate the sorted data list and write the attributes to a new file, whatever format you wish. Implementation note: This implementation is a stable, adaptive, iterative mergesort that requires far fewer than n lg(n) comparisons when the input array is partially sorted, while offering the performance of a traditional mergesort when the input array is randomly ordered.

http://stackoverflow.com/q/25604797
accepted answer: http://stackoverflow.com/a/25605249
has comment: http://stackoverflow.com/comment/39997825
has title: Passing String From Activity to Fragment
tagged with: android-fragments
has answer: http://stackoverflow.com/a/25605249
score: 1
tagged with: android
tagged with: java
tagged with: android-activity
has body: My Activty code snippet is which implements GooglePlayServicesClient.ConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener: @Override public void onConnected(Bundle bundle) { getCurrentLocation(); } public void getCurrentLocation() { if (this.servicesConnected()) { mLocationClient.requestLocationUpdates(mLocationRequest, this); mCurrentLocation = mLocationClient.getLastLocation(); ArrayList&lt;Address&gt; addresses = null; try { latitude = String.valueOf(mCurrentLocation.getLatitude()); longitude = String.valueOf(mCurrentLocation.getLongitude()); addresses = (ArrayList&lt;Address&gt;) gCoder. getFromLocation(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude(), 1); mLocationClient.disconnect(); } catch (IOException e) { e.printStackTrace(); } if (addresses != null &amp;&amp; addresses.size() &gt; 0) { Log.wtf("Arsnal", "" + addresses.get(0).getLocality()); } else { Toast.makeText(this, R.string.no_address_found, Toast.LENGTH_LONG).show(); } Log.wtf("Location", "Lat " + latitude + " - lon " + longitude); } } All I want is to get the String Latitude and longitude in my fragment ie @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.wtf("check","Inside OnCreate of Fragment!"); Log.wtf("check","Latitude"+((MyActivuty)getActivity()).latitude+ "Longitude"+((MyActivuty)getActivity()).longitude); } I am getting NPE in this line ie Log.wtf("check","Latitude"+((MyActivuty)getActivity()).latitude+ "Longitude"+((MyActivuty)getActivity()).longitude); because onComplete Method is called after fragment's OnCreate().HOw Can i solve this problem? Any help appreciated!Thanks
has comment: http://stackoverflow.com/comment/39997960
tagged with: google-play-services
type: AnsweredQuestion
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39998511
linked to: http://stackoverflow.com/q/25598696
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39997649
has comment: http://stackoverflow.com/comment/39997886

http://stackoverflow.com/comment/39977311
type: Comment
type: QuestionComment
has text: Please attach a full stacktrace so we can more easily help you
comment on: http://stackoverflow.com/q/25593788
score: 0

http://stackoverflow.com/q/25564485
type: Question
has body: i made custom Image View, where a simple line is drawn. This drawing is triggeed by a button. When triggered the onClicklistener isnt working anymore. But on the screen the button remains clickable, the buttons changes to a blueish color when clicked (default Android button). I think the problem might be in the "drawLine()" when the "setContentView(R.layout.activity_main);" is called, but not sure why and how to get rid of it. Hope you can help. MainActivity.java public class MainActivity extends ActionBarActivity implements OnTouchListener, OnClickListener { private int number; private Handler handler; private boolean Running = true; private int endX = 50; private int endY = 500; private int startX = 50; private int startY = 50; private int frames = 25; ImageView Line01; Button buttonLineDrawer; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Line01 = (ImageView) findViewById(R.id.Line01); Line01.setVisibility(View.GONE); Button buttonLineDrawer; buttonLineDrawer = (Button) findViewById(R.id.buttonLineDrawer); buttonLineDrawer.setOnClickListener(this); } @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub return false; } @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), "klick", Toast.LENGTH_LONG) .show(); Running = true; number = 0; drawLine(); } public void drawLine() { Line01.setVisibility(View.VISIBLE); handler = new Handler(); Runnable runnable = new Runnable() { @Override public void run() { while (Running) { try { Thread.sleep(40); } catch (InterruptedException e) { e.printStackTrace(); } handler.post(new Runnable() { @Override public void run() { int coordX = ((((endX - startX) / frames) * number)) + startX; int coordY = ((((endY - startY) / frames) * number)) + startY; number += 1; CustomDraw.setCoordinates(startX, startY, coordX, coordY); setContentView(R.layout.activity_main); if ((coordX - …
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39922930
score: 0
has title: Button only clickable once with Custom View
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25564693

http://stackoverflow.com/a/25626862
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40261619
score: 1
accepted answer of: http://stackoverflow.com/q/25620749
type: Answer
has comment: http://stackoverflow.com/comment/40261933
answers question: http://stackoverflow.com/q/25620749
has body: One changes a word at some position with some rule. And then recurses further. If the new word was already found stop for that case. So basically you iterate of wordIndex and ruleIndex. Recursive formulation is easiest, and can later be changed to iterative. You could make two level of recursion: walk rules, walk inside word. Okay, in java: public class Solver { public static void main(String[] args) { System.out.println("Solver"); Solver solver = new Solver("j=&gt;i", "i=&gt;j", "v=&gt;u", "u=&gt;v", "s=&gt;f", "f=&gt;s", "uu=&gt;w", "vv=&gt;w"); //Set&lt;String&gt; words = solver.determineAllWords("murdir"); Set&lt;String&gt; words = solver.determineAllWords("gigi"); words.forEach(System.out::println); System.out.println("Done"); } static class Rule { String from; String to; public Rule(String from, String to) { this.from = from; this.to = to; } } private final Rule[] rules; public Solver(String... tofroms) { this.rules = new Rule[tofroms.length]; for (int i = 0; i &lt; rules.length; ++i) { String[] tofrom = tofroms[i].split("=&gt;", 2); rules[i] = new Rule(tofrom[0], tofrom[1]); } } public Set&lt;String&gt; determineAllWords(String word) { Set&lt;String&gt; solutionWords = new TreeSet&lt;String&gt;(); // Could be a field too. solutionWords.add(word); int ruleIndex = 0; int wordIndex = 0; solveTryingRules(solutionWords, word, wordIndex, ruleIndex); return solutionWords; } private void solveTryingRules(Set&lt;String&gt; solutionWords, String word, int wordIndex, int ruleIndex) { if (ruleIndex &gt;= rules.length) { return; } Rule rule = rules[ruleIndex]; int wordIndexFound = word.indexOf(rule.from, wordIndex); if (wordIndexFound == -1) { // Next rule: solveTryingRules(solutionWords, word, 0, ruleIndex + 1); } else { // Keep at same rule, // Not applying rule to found word position: solveTryingRules(solutionWords, word, wordIndexFound + 1, ruleIndex); // Applying rule to found word position: String nextWord = word.substring(0, wordIndexFound) + rule.to + word.substri…
type: AcceptedAnswer

http://stackoverflow.com/comment/40073616
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25646614
has text: If you will look above code carefully you will see i applied @OrderBy annotation on setter method only.

http://stackoverflow.com/q/25617284
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25617498
has answer: http://stackoverflow.com/a/25617618
has comment: http://stackoverflow.com/comment/40020319
has answer: http://stackoverflow.com/a/25618683
upvote count: 5
tagged with: java
tagged with: generics
has answer: http://stackoverflow.com/a/25617447
has body: Given a simple class … public class Parent { private final String value; public Parent(String value) { this.value = value; } @Override public String toString() { return value; } } … and a subclass of it, … public class Child extends Parent { public Child(String value) { super(value); } } … the following program compiles and executes without errors or warnings: public class Main { public static void main(String[] args) { List&lt;? extends Parent&gt; items = getItems(); for (Parent p : items) { System.out.println(p.toString()); } } private static List&lt;? extends Parent&gt; getItems() { List&lt;Parent&gt; il = new ArrayList&lt;Parent&gt;(); il.add(new Parent("Hello")); il.add(new Child("World")); return il; } } But what about the return type of getItems()? It seems semantically wrong to me, since the result of the function does contain a Parent object which is not a subclass of Parent what I would expect from that method signature. Given this behaviour, I would have expected a simple List&lt;Parent&gt; as return type. However, since the compiler doesn’t complain, do I miss something? Is there any benefit from this implementation, aside from an (unnecessary) “write protection” for the result list? Or is this java style to write-protect result lists (not in this example, but, for example, to expose an object’s field list without needing to create a copy)? Or can this simply be considered “wrong” (in terms of teaching)? If so, why does neither the compiler nor even Eclipse complain about it, not even showing a hint?
answer count: 4
favorite count: 0
type: Question
has title: Is there a benefit for a List<? extends MyObject>?
has comment: http://stackoverflow.com/comment/40024079
score: 5
tagged with: extends
has comment: http://stackoverflow.com/comment/40023072

http://stackoverflow.com/a/25640580
has comment: http://stackoverflow.com/comment/40062536
has comment: http://stackoverflow.com/comment/50021699
has body: The Java runtime ("interpreter") itself is responsible for opening those handles before your code starts running. So they're available as soon as you enter main(). Unless you close them yourself, they'll stay open for the duration of the program.
has comment: http://stackoverflow.com/comment/49988806
answers question: http://stackoverflow.com/q/25640546
type: Answer
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/comment/39983755
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25597165
has text: This problem is a part of Binary tree generation , if see carefully the input cases are kind of binary tree string notation and the output is leve- order form of the input.
score: 0

http://stackoverflow.com/comment/39998808
type: AnswerComment
has text: when if multiple threads using same stub instance,Can each thread open different connection, pls look at my updated question above
score: 0
comment on: http://stackoverflow.com/a/25593279
type: Comment

http://stackoverflow.com/a/25591421
answers question: http://stackoverflow.com/q/25589881
type: Answer
accepted answer of: http://stackoverflow.com/q/25589881
downvote count: 0
score: 1
upvote count: 1
has body: please go through the below for numeric data types http://msdn.microsoft.com/en-in/library/ms187752.aspx
type: AcceptedAnswer

http://stackoverflow.com/q/25554239
answer count: 2
has comment: http://stackoverflow.com/comment/39903762
has answer: http://stackoverflow.com/a/25554491
score: 0
type: UnansweredQuestion
has body: I am running a tab pager adapter but I cannot seem to understand how to implement code not located in the Main Activity. Some codes that I made requires that I extend Activity making it impossible since I have already extended fragment. Can anyone enlighten me on this? public class Home extends Fragment{ ListView list; String url = "http://blog.compassion.com/living-in-the-philippines-rural-life/"; ProgressDialog mProgressDialog; public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { // TODO Auto-generated method stub TextView titlebutton = (TextView) getActivity().findViewById(R.id.TextView01); titlebutton.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { new Title().execute(); } }); return inflater.inflate(R.layout.home_fragment, container); } private class Title extends AsyncTask&lt;Void, Void, Void&gt; { String body; String title; @Override protected void onPreExecute() { super.onPreExecute(); mProgressDialog = new ProgressDialog(getActivity()); mProgressDialog.setTitle("Android Basic JSoup Tutorial"); mProgressDialog.setMessage("Loading..."); mProgressDialog.setIndeterminate(false); mProgressDialog.show(); } @Override protected Void doInBackground(Void... params) { try { Document document = Jsoup.connect(url).get(); Elements elements = document.select("p"); title = document.title(); for(Element elements123 : elements){ body+=elements123.text(); System.out.println(elements123.text()); } } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { TextView txttbody = (TextView) getActivity().findViewById(R.id.textView2); txttbody.setMovementMethod(new ScrollingMovementMethod()); txttbody.setText(title +"\n"+body); mProgressDialog.dismiss(); } }
type: Question
has answer: http://stackoverflow.com/a/25554342
tagged with: android-fragments
has title: my implementation of viewpager confused me a lot on fragment/activities
has comment: http://stackoverflow.com/comment/39903626
tagged with: android
tagged with: java
tagged with: android-activity
tagged with: android-asynctask

http://stackoverflow.com/comment/39924703
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25565412
type: Comment
has text: Does it solves your problem??

http://stackoverflow.com/comment/39986242
has text: @CommonsWare Please do you think you could give some ideas in this question : http://stackoverflow.com/questions/25598696/recommended-way-order-to-read-data-from-a-webservice-parse-that-data-and-inse
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25596116
type: Comment

http://stackoverflow.com/a/25701711
has comment: http://stackoverflow.com/comment/40173728
upvote count: 2
answers question: http://stackoverflow.com/q/25701605
score: 2
has comment: http://stackoverflow.com/comment/40174183
downvote count: 0
type: Answer
has body: Content-Type is a server header. You should send an Accept header, maybe you could try something generic like Accept: *.

http://stackoverflow.com/q/25699976
has comment: http://stackoverflow.com/comment/40171285
has title: My first java project
upvote count: 0
has answer: http://stackoverflow.com/a/25701768
tagged with: java
downvote count: 2
answer count: 1
tagged with: string
has body: I 'm making a project in Java for the university and I have an input like this : i 4 //that are the iteration a nissan car motor -1 // "a" means add operation "nissan" is the element and "car e motor" // are the tags associated to nissan a apple fruit iphone macbook -1 a peach fruit color -1 s fr -1 // "s" is the subtag that I have to find in the tag i 3 a soccer ball player -1 a volley ball shoes -1 s bal -1 END // "END" is the end of input Output : 2 2 Because at the first iteration it has find two elements that have tags that starts with "fr" and at the second iteration it has find two elements that have tags that starts with "bal". class main { private static boolean trovato; public static void main (String args [] ) throws IOException { HashMap&lt;String, HashSet&lt;String&gt;&gt; map = new HashMap &lt;String,HashSet&lt;String&gt;&gt; (); BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); HashSet&lt;String&gt; totale = new HashSet &lt;String&gt; () ; String line ; String numiter; Integer numiter2 = 0 ; String[] parts = null ; HashSet&lt;String&gt; hs = new HashSet&lt;String&gt; () ; HashSet&lt;String&gt; tmp = new HashSet&lt;String&gt; () ; Vector &lt;Integer&gt; conti = new Vector&lt;Integer&gt; (); boolean entrato = false ; line = stdin.readLine(); while (!line.equals("&lt;END&gt;")) { if (line.startsWith("i")) { map.clear(); hs.clear(); totale.clear(); } parts = line.split("[\\s\\-1]"); if (parts[0].equals("a")) { hs.add(parts[1]); for (int r = 2 ; r &lt; parts.length ; r++) { map.put(parts[r], hs); } } System.out.println("totale" + totale.size ()); if (parts[0].equals("s")) { entrato = false ; for (String key : map.keySet()) { if (key.startsWith(parts[1])) { entrato = true ; totale.addAll(map.get(key)); } } System.out.println(totale.size ()); } line = stdin.readLine(); } } } The code works but my teacher wants a more efficient way to do this.I don't know how to do it .Thanks in advance.
favorite count: 0
type: Question
tagged with: hashmap
type: UnansweredQuestion
score: -2

http://stackoverflow.com/q/25682302
favorite count: 0
has answer: http://stackoverflow.com/a/25682434
type: Question
possible better answer: http://stackoverflow.com/a/25682416
accepted answer: http://stackoverflow.com/a/25682565
has title: send HTML from servlet to JSP dynamically
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/25682565
has body: Is there an easy way to send HTML from a servlet to a JSP, using AJAX. I've already figured out how to make AJAX work with servlets dynamically, but now I want to press a button on a form and generate HTML based on text-input. Is it possible, and if so, how, to send just pieces of HTML to an existing HTML page? Example, I have a basic form where you can input your age, and based on the age the text has a different size/color. So, you send for example, 25 as your age to the servlet, and it send back a piece of HTML like this &lt;p STYLE="font-size: age;"&gt; to the page.
tagged with: servlets
type: AnsweredQuestion
answer count: 3
tagged with: dynamic
has answer: http://stackoverflow.com/a/25682416
score: 1
tagged with: java
downvote count: 0
tagged with: jsp
upvote count: 1

http://stackoverflow.com/a/25690224
score: 0
answers question: http://stackoverflow.com/q/25634150
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25634150
has body: I found a work around solution for the issue. Inside the IF statement, if I call the getter directly then it works &lt;s:property value="%{groupName}" /&gt; &lt;s:if test="%{#eventMap.containsKey(#currTime)}"&gt; &lt;s:property value="%{getGroupName()}" /&gt; &lt;/s:if&gt; No idea why i can reference the property directly above the IF statement but I can't inside, but I can't afford to spend anymore time on this and it works now. Though if anyone can provide a better solution or explanation i would love to hear it for future reference.
type: Answer

http://stackoverflow.com/comment/40146299
type: QuestionComment
has text: Converting to a Eclipse RCP is a substantial change, too large to cover in an answer here. An Eclipse RCP will look more like a 'normal' app on most platforms.
score: 0
comment on: http://stackoverflow.com/q/25686892
type: Comment

mime-message
type: Tag
tags question: http://stackoverflow.com/q/25622953
tag name: mime-message

http://stackoverflow.com/comment/39967433
type: Comment
comment on: http://stackoverflow.com/a/25588306
type: AnswerComment
score: 0
has text: can you please help in this.

http://stackoverflow.com/comment/39928665
type: AnswerComment
comment on: http://stackoverflow.com/a/25567439
score: 0
type: Comment
has text: Also before you draw your tiles, you should do something like this: `Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);`

http://stackoverflow.com/comment/39953335
type: Comment
type: QuestionComment
has text: Check if `pictureList[0] != null`?
comment on: http://stackoverflow.com/q/25580600
score: 0

http://stackoverflow.com/comment/40115124
type: AnswerComment
score: 0
has text: Okay, than just pass the onClickListener from your main activity class while initializing the custom view and set it to the textview, now the clicks over the textview will be catch under the onClick(View v) method of your main activity class.
comment on: http://stackoverflow.com/a/25644092
type: Comment

http://stackoverflow.com/comment/40180376
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25705112
has text: So how do you know which class the JSON represents?

http://stackoverflow.com/q/25679274
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40138476
accepted answer: http://stackoverflow.com/a/25679384
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/40133088
score: -1
has answer: http://stackoverflow.com/a/25679384
has comment: http://stackoverflow.com/comment/40132485
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40132479
has comment: http://stackoverflow.com/comment/40133655
downvote count: 2
answer count: 1
has body: I am trying to develop a java application which include finger print recognition. I need to store finger print to database.
upvote count: 1
has title: Biometrics FingerPrint Java

http://stackoverflow.com/q/25673770
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has title: Android get image to ImageView from web server not cashed copy
type: Question
has body: part of my android application display image on ImageView from web server(php). the name of the image on the server has the same IMEI phone number so that the phone would recognize which image belong to it example Imei is 33245576544535 then the image is www.example.uploads/33245576544535.jpg the problem is when the image change but still the same name the phone keep getting the old cashed copy of the image. how to get always the image from my server and not from cash server. here is the action code and thank you in advance package com.sunil.upload; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.os.Bundle; import android.telephony.TelephonyManager; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; public class see extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.look); String phoneNo; TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); phoneNo=telephonyManager.getDeviceId()+""; new DownloadImageTask((ImageView) findViewById(R.id.imageView1)) .execute("http://example.com/uploads/"+phoneNo+".jpg"); } private class DownloadImageTask extends AsyncTask&lt;String, Void, Bitmap&gt; { ImageView bmImage; public DownloadImageTask(ImageView bmImage) { this.bmImage = bmImage; } protected Bitmap doInBackground(String... urls) { String urldisplay = urls[0]; Bitmap mIcon11 = null; try { InputStream in = new java.net.URL(urldisplay).openStream(); mIcon11 = BitmapFactory.decodeStream(in); } catch (Exception e) { Log.e("Error", e.getMessage()); e.printStackTrace(); } r…
tagged with: android
tagged with: php
accepted answer: http://stackoverflow.com/a/25673918
has answer: http://stackoverflow.com/a/25673918

http://stackoverflow.com/comment/40130673
score: 0
type: QuestionComment
has text: I changed it to java 6 but that did not resolve the issue.
type: Comment
comment on: http://stackoverflow.com/q/25676873

http://stackoverflow.com/q/25563151
type: UnansweredQuestion
has body: I tried to run an android project in Cordova with self-build plugin, Heres the code in JS and java for the plugin var cordova = require('cordova'); var Carrier = function() {}; Carrier.prototype.getCarrierCode = function(success, error) { cordova.exec(success, error, 'CarrierPlugin', 'getCarrierCode', []); }; var carrier = new Carrier(); module.exports = carrier; this is the java code: import org.apache.cordova.CordovaPlugin; import org.apache.cordova.CallbackContext; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.Date; import android.app.Activity; import android.database.Cursor; import android.os.Bundle; import android.provider.CallLog; import android.content.ContentResolver; public class CarrierPlugin extends CordovaPlugin{ public static final String TAG = "CarrierPlugin"; public static final String ACTION_GET_CARRIER_CODE = "getCarrierCode"; //public TelephonyManager tm; @Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { // TODO Auto-generated method stub super.initialize(cordova, webView); } @Override public boolean execute(String action, CordovaArgs args, CallbackContext callbackContext) throws JSONException{ callbackContext.success("run it"); return true; } } the error I got is "cannot find symbol :" the strange thing is that, even if I change the code in the CarrierPlugin.java(delete the JSONException in line 16), it reported the same error.
score: 0
has answer: http://stackoverflow.com/a/25563520
tagged with: android
tagged with: java
answer count: 1
has title: Cordova cannot find symbol error when build android project with self-built plugin (call for native java code)
type: Question
tagged with: cordova

http://stackoverflow.com/comment/40094547
comment on: http://stackoverflow.com/a/25657963
has text: @AnandMishra - Then please upvote the answer. An upvote with a comment is better.
type: AnswerComment
score: 2
type: Comment

http://stackoverflow.com/q/25603450
accepted answer: http://stackoverflow.com/a/25603662
answer count: 1
downvote count: 0
has title: why spill failure happens for Custom Data Type in Hadoop
favorite count: 0
type: Question
has body: In hadoop I am writing my custom data type as below import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.hadoop.io.WritableComparable; public class Movie implements WritableComparable { String movieId; String movieTitle; public Movie(String movieId, String movieTitle) { super(); this.movieId = movieId; this.movieTitle = movieTitle; } public Movie(){ } public String getMovieId() { return movieId; } public void setMovieId(String movieId) { this.movieId = movieId; } public String getMovieTitle() { return movieTitle; } public void setMovieTitle(String movieTitle) { this.movieTitle = movieTitle; } @Override public void readFields(DataInput in) throws IOException { movieId = in.readLine(); movieTitle=in.readLine(); } @Override public void write(DataOutput out) throws IOException { // TODO Auto-generated method stub out.writeChars(movieId); out.writeChars(movieTitle); } @Override public int compareTo(Movie o) { return movieTitle.compareTo(o.movieTitle); } @Override public int hashCode(){ return movieId.hashCode(); } @Override public boolean equals(Object o){ Movie m=(Movie)o; return movieId.equals(m.movieId); } @Override public String toString(){ return movieTitle; } } Below is my mapper code import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.hadoop.filecache.DistributedCache; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; public class MovieMapper extends Mapper { Map> movieMap=new HashMap>(); @Override public void map(LongWritable key,Text value,Context ctx) throws IOException, InterruptedException{ String[] columns=value.toString().split("::"); if(columns.length!=4){ System.out.println("length not equal to 4"); return; } if(movieMap.containsKey(columns[1])){ Li…
upvote count: 2
type: AnsweredQuestion
score: 2
tagged with: hadoop
has answer: http://stackoverflow.com/a/25603662
tagged with: java

http://stackoverflow.com/comment/40188669
score: 0
has text: setCorner() helped, thanks!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25708734

http://stackoverflow.com/comment/40161175
comment on: http://stackoverflow.com/q/25687649
has text: I found in the REST API documentation : Overview MongoLab databases can be accessed by applications in two ways. The first method - the one we strongly recommend - is to connect using one of the available MongoDB drivers. You do not need to use our API if you use the driver. In fact, using a driver provides better performance, better security, and more functionality. The second method, documented in this article, is to connect via MongoLab’s RESTful API. Use this method only if you cannot connect using a MongoDB driver.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25630266
has body: I have a multi module java maven project, with one of the modules containing integration tests. I used the jacoco-maven-plugin and successfully generated the jacoco-it.exec in that module. But for some reason the html report is not created. Also sonar does not read this report. It works fine for unit tests, but not for the integration tests. Here is what I added to the pom.xml: org.jacoco jacoco-maven-plugin 0.7.1.201405082137 default-prepare-agent prepare-agent default-report prepare-package report default-check check BUNDLE COMPLEXITY COVEREDRATIO 0.1 default-prepare-agent-integration pre-integration-test target/jacoco-it.exec failsafe.argLine prepare-agent-integration default-report-integration post-integration-test report-integration org.apache.maven.plugins maven-failsafe-plugin 2.16 ${failsafe.argLine} default-integration-test integration-test verify verify
has title: Jacoco IT report created, but no html
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/29084761
type: Question
type: UnansweredQuestion
tagged with: maven
tagged with: jacoco

http://stackoverflow.com/comment/40160627
comment on: http://stackoverflow.com/a/25694178
type: Comment
type: AnswerComment
has text: I'm sorry, I meant before the left curly. I guess this means even the WhitespaceBefore wouldn't work for me if it did exist because I only want it in some cases not all. :(
score: 0

http://stackoverflow.com/q/25680733
answer count: 1
tagged with: richfaces
type: Question
has answer: http://stackoverflow.com/a/25682848
tagged with: components
has body: I'm trying to 'lazy-load' a richface component. Somehow i cant get it rendered without a page refresh. I would like to avoid a full page refresh. Situation: basic page loaded with: menuBean.java private MenuBarComponent getLazyMenuBarComponent() { if (lazyMenuBar != null) { return lazyMenuBar; } lazyMenuBar = new MainMenuBarLazy(); // no children return lazyMenuBar; } After pressing on the 'activate menu'-button: page.xhtml &lt;a4j:region id="main-menu-region"&gt; &lt;h:form id="mainMenu-form"&gt; &lt;rich:dropDownMenu binding="#{menuBarBean.menuBar}" id="HOOFDMENU" showEvent="mouseup" onclick="showMenu();" styleClass="menu-hdr-btn" hideDelay="3600000" showDelay="0" onshow="onMenuShow();" /&gt; &lt;a4j:jsFunction name="fetchMenu" action="#{menuBarBean.fetchMenu}" render="@region @form HOOFDMENU"&gt; &lt;!-- I THOUGHT THIS SHOULD WORK --&gt; &lt;/a4j:jsFunction&gt; &lt;/h:form&gt; &lt;/a4j:region&gt; &lt;a4j:jsFunction name="fetchMenu" action="#{menuBarBean.fetchMenu}"&gt; &lt;/a4j:jsFunction&gt; &lt;javascript&gt; function displayMenu(){ #{rich:component('HOOFDMENU')}.show(); } &lt;/javascript&gt; menuBean.java public String fetchMenu() { if(currentMenuBar.getChildrenSize() &gt; 1){ return ""; } showMenuBar = true; currentMenuBar = getMenuBarComponent(); // The component gets pointed to the full menu return "TRUE";// "RELOAD" triggers a full page refresh and shows the full menu; } public UIComponent getMenuBar() { if (currentMenuBar == null) { currentMenuBar = getLazyMenuBarComponent(); } menuBarComponent = currentMenuBar.build(); // Here the component gets builded. It is chosen to build it in the getter because in the build there is also a check of the users ROLE, which can be changed on the fly. return menuBarComponent; } Added after edit javascript.js function showMenu(){ // gets triggered when pressed on the dropdown component fetchMenu(); // triggers the build-full-menu action displayMenu(); // sets dropdownbox to show (the menu should show now), I only get the…
has title: Lazy loading of an richface component
accepted answer: http://stackoverflow.com/a/25682848
type: AnsweredQuestion
score: 0
tagged with: lazy-loading
tagged with: java

http://stackoverflow.com/comment/40138613
score: 0
type: AnswerComment
has text: Did you try to keep an alert in your function whether you are getting value in responseText?
type: Comment
comment on: http://stackoverflow.com/a/25682565

http://stackoverflow.com/comment/40143334
type: QuestionComment
type: Comment
has text: This is a prime example of a problem not being a problem unless you make it a problem. If you don't apply the word "waste", there is no problem here. More space is reserved than you use. So what? That happens under the hood whether you like it or not; research "memory alignment". Even if you use only 1 byte of memory, likely 8 bytes are actually used up in the process depending on the CPU architecture. http://stackoverflow.com/questions/381244/purpose-of-memory-alignment
comment on: http://stackoverflow.com/q/25684169
score: 0

http://stackoverflow.com/a/25570206
score: 3
type: AcceptedAnswer
downvote count: 0
has body: The value of 0xFF8E8F8A is &gt; Integer.MAX_VALUE. Since no overflow or underflow throws Exceptions by design, it will interpret your value as Integer.MIN_VALUE instead, because Integer.MAX_VALUE + 1 shifts to Integer.MIN_VALUE. So, Long.intValue will convert the value to int, which, with a given value of Integer.MAX_VALUE + x where x &gt; 0, will shift from Integer.MIN_VALUE, i.e. Integer.MIN_VALUE + x. However, from Integer javadoc: An exception of type NumberFormatException is thrown if any of the following situations occurs: The first argument is null or is a string of length zero. [...] The value represented by the string is not a value of type int. A value of 0xFF8E8F8A is not of type int, hence the NumberFormatException. As a side-note, I'm pretty sure ColorDrawable constructor takes an int because it takes an id instead of a numerical representation of your color, but to be honest the documentation isn't quite clear on that. See R.color documentation here. Final note - credit goes to OP on this one. You can use new ColorDrawable(Color.parseColor(yourHexString)) for a more convenient approach.
has comment: http://stackoverflow.com/comment/39934474
has comment: http://stackoverflow.com/comment/39934298
accepted answer of: http://stackoverflow.com/q/25570093
has comment: http://stackoverflow.com/comment/39935009
has comment: http://stackoverflow.com/comment/39934191
has comment: http://stackoverflow.com/comment/39934711
type: Answer
answers question: http://stackoverflow.com/q/25570093
has comment: http://stackoverflow.com/comment/39933758
upvote count: 3

http://stackoverflow.com/comment/40005371
score: 0
comment on: http://stackoverflow.com/a/25588447
type: Comment
has text: I don’t know for sure, because I didn't check the sources. But I think it has to do with the time that the Drawer performs some calculations. At the time onDrawerClosed is called, we’re good to resize it without affect its natural state.
type: AnswerComment

http://stackoverflow.com/q/25678222
has body: Hello I'm having an issue storing an ArrayList of Integers into an ArrayList of ArrayList of Integers. Here is the full code: public class SetZeroMatrix { public static void main(String [] args){ ArrayList&lt;ArrayList&lt;Integer&gt;&gt; zeroMatrix = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); ArrayList&lt;Integer&gt; insertionList = new ArrayList&lt;Integer&gt;(); try { FileReader in = new FileReader("matrixInput.txt"); BufferedReader br = new BufferedReader(in); Scanner matrixScanner = new Scanner(br); while(matrixScanner.hasNextLine()){ Scanner rowReader = new Scanner(matrixScanner.nextLine()); while(rowReader.hasNextInt()){ insertionList.add(rowReader.nextInt()); } //testing to see if insertionList is empty System.out.println("Arraylist contains: " + insertionList.toString()); zeroMatrix.add(insertionList); insertionList.clear(); } matrixScanner.close(); } catch(FileNotFoundException ex) { System.out.print("File not found" + ex); } //testing to see if zeroMatrix is empty ArrayList&lt;Integer&gt; testList = new ArrayList&lt;Integer&gt;(); testList = zeroMatrix.get(1); System.out.println("ArrayList contains: " + testList.toString()); } } This program is reading from a text file "matrixInput.txt" that contains: 34 20 The problem is after I added insertionList into zeroMatrix, zeroMatrix prints an empty ArrayList (during the last line of the code). I suspect its because I'm not inserting insertionList correctly into zeroMatrix? Or maybe I'm printing it incorrectly?
tagged with: arraylist
type: AnsweredQuestion
has title: Java ArrayList remains empty when I add an object containing Integers
possible better answer: http://stackoverflow.com/a/25678342
score: 0
answer count: 2
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/25678342
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25678245
has comment: http://stackoverflow.com/comment/40130693
has comment: http://stackoverflow.com/comment/40130703
accepted answer: http://stackoverflow.com/a/25678245

http://stackoverflow.com/comment/40047675
comment on: http://stackoverflow.com/q/25631839
type: Comment
type: QuestionComment
has text: sorry, have added the example
score: 0

http://stackoverflow.com/comment/40133088
score: 0
type: Comment
type: QuestionComment
has text: i want finger print details to database
comment on: http://stackoverflow.com/q/25679274

http://stackoverflow.com/comment/40019286
type: QuestionComment
comment on: http://stackoverflow.com/q/25616528
score: 0
has text: Please post a fully reproducible example along with the exception stack trace you get.
type: Comment

http://stackoverflow.com/q/25672157
score: 0
has comment: http://stackoverflow.com/comment/40119550
has body: I have Websphere AS running project which i am migrating to JBoss ESP 6.2. But at time of deployment in JBoss its giving issue related to initializing context for datasource. I am using following code for data source lookup from context Context ctx = null; DataSource dataSource = null; Properties p = new Properties(); try { ctx = new InitialContext(); return dataSource = (DataSource) ctx.lookup("jdbc/" + dataSourceStr); } catch (Exception e) { System.out.println(e.toString()); } Exception in Console : 23:15:56,959 WARNING [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 48) javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory com.ibm.ejs.ns.jndi.CNInitialContextFactory from classloader ModuleClassLoader for Module "deployment.SmartEAR.ear.Smarti.war:main" from Service Module Loader: javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory com.ibm.ejs.ns.jndi.CNInitialContextFactory from classloader ModuleClassLoader for Module "deployment.SmartEAR.ear.Smarti.war:main" from Service Module Loader at org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64) at javax.naming.spi.NamingManager.getInitialContext(Unknown Source) [rt.jar:1.7.0_21] at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) [rt.jar:1.7.0_21] at javax.naming.InitialContext.init(Unknown Source) [rt.jar:1.7.0_21] at javax.naming.InitialContext.&lt;init&gt;(Unknown Source) [rt.jar:1.7.0_21] at com.sun.faces.config.WebConfiguration.processJndiEntries(WebConfiguration.java:683) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.config.WebConfiguration.&lt;init&gt;(WebConfiguration.java:134) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.config.WebConfiguration.getInstance(WebConfiguration.java:194) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListene…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25674323
answer count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40119877
tagged with: jboss
tagged with: eclipse
has title: issue with JBOSS initializeContext()

http://stackoverflow.com/q/25565980
tagged with: java
has answer: http://stackoverflow.com/a/52619343
has answer: http://stackoverflow.com/a/25568905
tagged with: zk
has comment: http://stackoverflow.com/comment/39928175
answer count: 2
has body: I am trying to write a test-case without using a ZUL file for now. I have a very basic function with the following lines. Class to initialize Listbox: public class TestComposer { public void listboxTest(){ ListModelList model = new ListModelList(); Listbox lbOne = new Listbox(); lbOne.setModel(model); lbOne.setMultiple(true); System.out.println(lbOne); System.out.println(model); } } Test-case public class testSuit { static ZatsEnvironment env; @BeforeClass public static void init() { System.out.println("Setting server space."); env = new DefaultZatsEnvironment("/main/webapp/WEB-INF"); env.init("/main/webapp"); } @AfterClass public static void end() { env.destroy(); } @After public void after() { env.cleanup(); } @Test public void test() { TestComposer tc = new TestComposer(); tc.listboxTest(); } } This piece of code will produce a null pointer exception. It shows that lbOne is null. Is there a way to use listbox without calling/using a ZUL file? Stack trace: java.lang.NullPointerException at org.zkoss.zk.ui.event.Events.postEvent(Events.java:383) at org.zkoss.zk.ui.event.Events.postEvent(Events.java:432) at org.zkoss.zk.ui.event.Events.postEvent(Events.java:366) at org.zkoss.zul.Listbox.postOnInitRender(Listbox.java:2501) at org.zkoss.zul.Listbox.setModel(Listbox.java:2266) at test.TestComposer.listboxTest(TestComposer.java:12) at test.testSuit.test(testSuit.java:75) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.interna…
has comment: http://stackoverflow.com/comment/39930645
type: UnansweredQuestion
tagged with: listbox
has title: Listbox null pointer exception in zk
type: Question
score: 0

http://stackoverflow.com/q/25688017
has body: I began making a class and there was a warning with the generic type "T" in the subclass. public class SomeClass&lt;T&gt; { @SuppressWarnings("hiding") public class SomeInnerClass&lt;T&gt; { } } What is the following code warning be about exactly? Will it make any difference at all if I change the generic of the subclass to another letter?
has title: "hiding" warning. What does it mean in this case?
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25688085
answer count: 1
linked to: http://stackoverflow.com/q/25510454
tagged with: warnings
tagged with: generics
has comment: http://stackoverflow.com/comment/40148107
duplicate of: http://stackoverflow.com/q/25510454
type: Question
type: UnansweredQuestion
tagged with: subclass

http://stackoverflow.com/a/25700451
score: 2
answers question: http://stackoverflow.com/q/25699772
upvote count: 2
has comment: http://stackoverflow.com/comment/40241675
downvote count: 0
has comment: http://stackoverflow.com/comment/40201874
has comment: http://stackoverflow.com/comment/40264571
has comment: http://stackoverflow.com/comment/40204888
has comment: http://stackoverflow.com/comment/40237668
has comment: http://stackoverflow.com/comment/40269539
has comment: http://stackoverflow.com/comment/40279559
type: Answer
has comment: http://stackoverflow.com/comment/40258754
has comment: http://stackoverflow.com/comment/40258543
has body: take both the numbers as strings and store the signs into the sign string into the corresponding Numbers objects and call your method like System.out.println("Please enter the first number: "); firstNumber = kbd.nextString(); System.out.println("Next, enter the second number: "); secondNumber = kbd.nextString(); Number x = new Number (firstNumber.substring(1),firstNumber.charAt(0)); Number y = new Number (secondNumber.substring(1),secondNumber.charAt(0)); /*convert the firstNumber.substring(1) and secondNumber.substring(1) to doubles using Double.parseDouble()*/ public String doTheOperation(Number other){ if(this.sign.equals(otherNumber.sign)){ /*simply the double values and put the sign*/ in front of it and return it } else{ do the simple double subtraction and by looking at your code i believe you can find out the bigger double among them } }

http://stackoverflow.com/q/25555609
has body: I have a class A, with property of class B. The SQL table for A does not know anything about B. The SQL table for B contains a foreign key to A. How can I map (in hbm.xml) so that B is a property of A? I know how to do this with Sets: &lt;set name="b" table="B" cascade"all-delete-orphan"&gt; &lt;key column="a_id"&gt; &lt;composite-element class="B"&gt; &lt;property name="bProp" column="b_prop" type="string"/&gt; &lt;/composite-element&gt; &lt;/set&gt; Thing is, B is NOT a set of A. Rather just a single element. How might I go about mapping this? Edit: To clarify a bit, my use case is similar to http://docs.jboss.org/hibernate/orm/3.6/reference/en-US/html/associations.html#assoc-unidirectional-m21 except instead of: create table Person ( personId bigint not null primary key, addressId bigint not null ) create table Address ( addressId bigint not null primary key ) I have: create table Person ( personId bigint not null primary key ) create table Address ( personId bigint, addressId bigint not null primary key ) However, I would expect then that the actual Address Class does not contain any references to Person: class Person { Address address; } class Address { int id; }
has answer: http://stackoverflow.com/a/25572853
has comment: http://stackoverflow.com/comment/39936563
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/2452987
accepted answer: http://stackoverflow.com/a/25572853
has comment: http://stackoverflow.com/comment/39912905
has title: Hibernate: how do I map one to one where B is a property of A?
has comment: http://stackoverflow.com/comment/39937055
upvote count: 1
has comment: http://stackoverflow.com/comment/39946005
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/29855746
answer count: 2
tagged with: sql
score: 1
has answer: http://stackoverflow.com/a/29855746
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39908031
downvote count: 0

http://stackoverflow.com/a/37577545
type: Answer
answers question: http://stackoverflow.com/q/25635636
score: 1
downvote count: 0
has body: Unless you have to have you files in the jar, this is probably the simplest way of doing it: header = ImageIO.read(new File("./resources/header.jpeg")); header has to be an Image/BufferedImage. This goes to the folder that the runnable jar is within and looks for a folder called resources. https://i.sstatic.net/x8xtO.png
upvote count: 1

imagej
tags question: http://stackoverflow.com/q/25668904
tag name: imagej
type: Tag

http://stackoverflow.com/a/25676466
type: Answer
has body: Yes, that is correct. If the thread corresponding to the Thread object you called join on has already terminated, the method returns immediately.
accepted answer of: http://stackoverflow.com/q/25676455
has comment: http://stackoverflow.com/comment/40127552
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25676455

http://stackoverflow.com/comment/40062080
comment on: http://stackoverflow.com/q/25640364
type: Comment
type: QuestionComment
score: 0
has text: Show the whole stacktrace please.

http://stackoverflow.com/comment/122105507
type: AnswerComment
comment on: http://stackoverflow.com/a/25634505
has text: Excellent explanation!
score: 0
type: Comment

http://stackoverflow.com/comment/39947068
score: 0
type: AnswerComment
type: Comment
has text: I have a question MultipartEntityBuilder.create() .addPart("bin", bin) .addPart("comment", comment) .build(); What are these parts thats being added? Is that the parameters?
comment on: http://stackoverflow.com/a/25577115

http://stackoverflow.com/q/25554346
linked to: http://stackoverflow.com/q/4556896
has comment: http://stackoverflow.com/comment/39904212
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39903807
type: Question
duplicate of: http://stackoverflow.com/q/4556896
has comment: http://stackoverflow.com/comment/39903674
downvote count: 4
has title: Error trying to run .Jar file
upvote count: 0
type: UnansweredQuestion
has body: So I have had no problem running a .jar file in the past. And the .jar program has been running fine, playing music, displaying images etc. But recently I added in another music file (of the same format as the rest of them in there and slightly smaller size) and now, when I export to a .jar file, the .jar file wont run correctly, it just displays a white form. Any help would be awesome! :) EDIT: I ran the file using the command prompt and this error came up: java.io.IOException: mark/reset not supported at java.util.zip.InflaterInputStream.reset(Unknown Source) at java.io.FilterInputStream.reset(Unknown Source) at com.sun.media.sound.SoftMidiAudioFileReader.getAudioInputStream(Unknown Source) at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source) at Audio.AudioPlayer.&lt;init&gt;(AudioPlayer.java:14) at GameState.StateManager.&lt;init&gt;(StateManager.java:60) at Main.GamePanel.init(GamePanel.java:77) at Main.GamePanel.run(GamePanel.java:82) at java.lang.Thread.run(Unknown Source) Exception in thread "Thread-2" java.lang.NullPointerException at GameState.StateManager.update(StateManager.java:174) at Main.GamePanel.update(GamePanel.java:122) at Main.GamePanel.run(GamePanel.java:93) at java.lang.Thread.run(Unknown Source)
score: -4
answer count: 1
tagged with: jar
favorite count: 0
has answer: http://stackoverflow.com/a/25554685

http://stackoverflow.com/comment/39992435
has text: @dave see my answer [here](http://stackoverflow.com/questions/25473551/getting-ddl-before-updating-the-schema-in-hibernate-spring-applications/25473754#25473754) for turning SQL on
comment on: http://stackoverflow.com/a/25600588
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40116849
has text: `(?:P|I)` = `[IP]` ;-)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25670454
score: 1

http://stackoverflow.com/comment/40045230
comment on: http://stackoverflow.com/q/25630576
type: Comment
has text: My bet is because `thisSameAddress` is a detached entity at the time you `.setAddress` I think the code is behaving exactly how it should, (the single entry in `ADRESS` shows that `Cust c` has the address because it was persisted after b... If you want to see an exception, then commit the transaction on `em.persist(b)` and then do `em.persist(c)`
type: QuestionComment
score: 0

http://stackoverflow.com/a/25650321
downvote count: 0
has comment: http://stackoverflow.com/comment/40135868
has body: You're asking for a singleton but requiring two injection points @Inject private TransformerImpl&lt;ClazzAI, ClazzAO, MapperA&gt; transformerA; @Inject private TransformerImpl&lt;ClazzBI, ClazzBO, MapperB&gt; transformerB; for differently constructed objects. That doesn't make much sense. You now realize you need two beans. If you can't (don't want to) do it in a @Configuration class with @Bean factory methods, you'll need to declare (and scan) two separate @Component classes. (I made your parent constructor public here.) @Component class MapperATransformerImpl extends TransformerImpl&lt;ClazzAI, ClazzAO, MapperA&gt; { @Inject public MapperATransformerImpl(MapperA mapper) { super(mapper); } } @Component class MapperBTransformerImpl extends TransformerImpl&lt;ClazzBI, ClazzBO, MapperB&gt; { @Inject public MapperBTransformerImpl(MapperB mapper) { super(mapper); } } When processing the injection target @Inject private TransformerImpl&lt;ClazzAI, ClazzAO, MapperA&gt; transformerA; Spring will find the MapperATransformerImpl, which is of type TransformerImpl&lt;ClazzAI, ClazzAO, MapperA&gt; and inject that.
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/25648414
has comment: http://stackoverflow.com/comment/52926915
score: 5
has comment: http://stackoverflow.com/comment/40149097

http://stackoverflow.com/comment/40231074
type: Comment
has text: it runs on the same computer - the issue happens when I connect from one computer to another
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25729269

http://stackoverflow.com/comment/40075846
type: AnswerComment
has text: System.out.print(a) prints out null
comment on: http://stackoverflow.com/a/25647912
type: Comment
score: 0

http://stackoverflow.com/q/25619360
type: Question
possible better answer: http://stackoverflow.com/a/43733446
tagged with: jsoup
has answer: http://stackoverflow.com/a/43733446
downvote count: 0
score: 10
accepted answer: http://stackoverflow.com/a/25619651
has answer: http://stackoverflow.com/a/25619651
has body: Now I use this to create an element &lt;!-- language: lang-java --&gt; Document doc = Jsoup.parseBodyFragment("&lt;ol&gt;&lt;/ol&gt;"); Elements ols=doc.getElementsByTag("ol"); Element ol=ols.get(0); But this is too complex, because I create many dom in the program, if every use three line to create an element, it is not convenient. Can I create an element without using the document and elements? like this: &lt;!-- language: lang-js --&gt; var ol=$('&lt;ol&gt;&lt;/ol&gt;');
type: AnsweredQuestion
answer count: 2
tagged with: java
upvote count: 10
has title: In Jsoup, how to create an element without document?
favorite count: 0

http://stackoverflow.com/comment/40113629
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25662658
has text: *"Can I have sample for drawing such table in the Applet view itself"* I forgot to add:- SO is not a code generation machine. Voting to close.
type: Comment

http://stackoverflow.com/comment/40139954
comment on: http://stackoverflow.com/q/25679841
has text: Lol @DB instance, username and password in clear :D
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25554687
score: 1
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25565491
has body: I'd like to ask if what I'm doing is suitable or if there is a better/more efficient/simpler way. Scenario: User logs in with e-mail-address and password, gets routed to the login()-action If the user is already in the DB and has a password hashed, authenticate with the DB-user and return result-promise If user is not in the DB or has no password-hash, do a web-service request with the login-data and parse the status from the response -> return a Status-instance Check the status of the user and return a result-promise Code: public Promise&lt;Result&gt; login() { Promise&lt;User&gt; userPromise = Promise.promise(() -&gt; User.findByName(login.emailAddress)); return userPromise.flatMap(user -&gt; { if (user != null &amp;&amp; user.hasPassword()) { if (user.authenticate(login.password)) { return Promise.pure(ok("login successful"))); } // password did not match return Promise.pure(unauthorized()); } // user has no password-hash stored, so do a webservice-request instead final WSRequestHolder holderWithParams = getWSRequestHolderForUserStatus(login.emailAddress, login.password); final Promise&lt;Status&gt; statusPromise = holderWithParams.get().flatMap(this::parseStatusFromResponse); return statusPromise.flatMap(status -&gt; { if (status != null) { if (status.isValid()) { return Promise.pure(ok("login successful"))); } // not a valid status, return unauthorized return Promise.pure(unauthorized()); } return Promise.pure(badRequest("response parsing error"); }); }); } My questions: Am I doing anything wrong or unnecessary, and if yes: what is the correct, easier or more efficient way? Did I understand the use of Promises and flatMaps, am I using it correctly or "over-using" it?
type: Question
tagged with: promise
tagged with: nonblocking
has answer: http://stackoverflow.com/a/25565491
has title: Chaining of Promises via #flatMap() in Play Controller-Action
tagged with: java
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: playframework
answer count: 1
downvote count: 0

scroll
type: Tag
tag name: scroll
tags question: http://stackoverflow.com/q/25609566
tags question: http://stackoverflow.com/q/25667345
tags question: http://stackoverflow.com/q/25658672
tags question: http://stackoverflow.com/q/25561596

http://stackoverflow.com/q/25567639
has comment: http://stackoverflow.com/comment/39928446
has title: How to measure the execution time of a servlet's method from client side java code?
has answer: http://stackoverflow.com/a/25568103
has comment: http://stackoverflow.com/comment/39929242
tagged with: servlets
type: AnsweredQuestion
has body: I am writing a tool, which should be able to measure the execution time of a servlet's method from client side. Not the whole servlet's, only one method's. To measure the running time of the whole servlet, I set a start-time then created a URLConnection with the servlet's URL, opened the connection, got the inputstream, read the inputstream, closed the connection and then set an end-time and calculated the elapsed time with a subtraction. But this time I'd like to measure only one method of the servlet and avoid calculating parameter reading and checking and such thing. I guess it's only possible in the servlet itself, but I need the measured value sent back to the client side program. Is it possible somehow? Or am I on the wrong path? Thanks in advance!
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39929400
tagged with: java
accepted answer: http://stackoverflow.com/a/25567684
has comment: http://stackoverflow.com/comment/39928724
has answer: http://stackoverflow.com/a/25567684
tagged with: http
type: Question
tagged with: time
tagged with: measurement
possible better answer: http://stackoverflow.com/a/25568103

http://stackoverflow.com/comment/40030246
comment on: http://stackoverflow.com/q/25620774
has text: no it does not work anyway, you could help if I sent you the tiledmap?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25562077
accepted answer of: http://stackoverflow.com/q/25560535
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25560535
type: Answer
has body: I'm here to save you! To get width / height from a String drawn with your BitmapFont you can utilize this super nice method: game.font.getBounds(String string) And to use it in your case, it would be something like this: game.font.getBounds("Tap anywhere to begin!").width / 2; Cheers!
score: 1

http://stackoverflow.com/q/25593768
upvote count: 12
score: 12
downvote count: 0
has body: Ever since it was first introduced to replace Date I have been using the static method Calendar.getInstance() to get a new Calendar object. I have never had a problem but I just wondered for some reason if it were better to use the GregorianCalendar.getInstance() method instead. Is it possible my programs will run in some locale or some JVM somewhere where the superclass version will return an object class I wasn't expecting? Has there ever been an implementation of Calendar other than GregorianCalendar that ever made it into wide use? As I said I'm not having a problem at the moment but I am always looking to improve my practices.
has answer: http://stackoverflow.com/a/25593783
answer count: 1
tagged with: calendar
favorite count: 0
type: Question
has title: Difference between Calendar.getInstance() and GregorianCalendar.getInstance()
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25593783
linked to: http://stackoverflow.com/q/36771386
tagged with: java
has comment: http://stackoverflow.com/comment/39980207

http://stackoverflow.com/q/25658924
has answer: http://stackoverflow.com/a/25701229
has body: I have HTML like this: &lt;input data-errorqtip="" aria-invalid="false" id="checkbox-1371-inputEl" class="x-form-field x-form-checkbox x-form-cb" autocomplete="off" hidefocus="true" type="button"&gt; In UI it is showing like checkbox. How to check if it is selected? I am using bellow code but is not working. if (!field.isSelected()) { field.click(); }
type: Question
answer count: 2
type: UnansweredQuestion
tagged with: selenium
has title: Check button is selected using selenium
has comment: http://stackoverflow.com/comment/40105028
tagged with: selenium-webdriver
score: 0
has answer: http://stackoverflow.com/a/25659182
tagged with: java
has comment: http://stackoverflow.com/comment/40096147

http://stackoverflow.com/comment/40115813
type: Comment
type: AnswerComment
has text: @MichałSchielmann not sure what you mean, either way every loop creates an `Integer` when it's autoboxed to put it into the `Map`
comment on: http://stackoverflow.com/a/25663107
score: 0

http://stackoverflow.com/comment/40010695
type: QuestionComment
comment on: http://stackoverflow.com/q/25612096
has text: It's 4:50 am here, and I've been wrestling over this for last 5 hours going through books and similar questions on stackoverflow. I am going to bed for now. I will appreciate any inputs regarding the matter. Thank you
score: 0
type: Comment

http://stackoverflow.com/comment/91360003
comment on: http://stackoverflow.com/a/25627867
type: Comment
has text: link doesn't work, I keep getting HTTP 503. Also, can you explain how to query for these URI's please? Because I keep getting empty results - see my question here: https://stackoverflow.com/q/52205463/997940
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39934711
type: AnswerComment
comment on: http://stackoverflow.com/a/25570206
has text: Its so unintuitive because parseInt() has different semantics than the java language with regards to hexadecimal notation (0x87654321 is perfectly fine as a literal in code, but not as input for parseInt)
score: 1
type: Comment

http://stackoverflow.com/a/25769548
accepted answer of: http://stackoverflow.com/q/25640375
type: Answer
has body: This is the expected behaviour. From the Javadocs: Returns an iterator of the PHYSICAL rows. Meaning the 3rd element may not be the third row if say for instance the second row is undefined. If you look at the Apache POI documentation on iterating over rows and cells, you'll see that described in more detail, along with instructions on how to force the iteration over all rows in a range if that's what you really want. Your code will want to be something like (taken from the Apache POI docs) // Decide which rows to process int rowStart = Math.min(15, sheet.getFirstRowNum()); int rowEnd = Math.max(1400, sheet.getLastRowNum()); for (int rowNum = rowStart; rowNum &lt; rowEnd; rowNum++) { Row r = sheet.getRow(rowNum); if (r == null) { // Handle empty row continue; } int lastColumn = Math.max(r.getLastCellNum(), MY_MINIMUM_COLUMN_COUNT); for (int cn = 0; cn &lt; lastColumn; cn++) { Cell c = r.getCell(cn, Row.RETURN_BLANK_AS_NULL); if (c == null) { // The spreadsheet is empty in this cell } else { // Do something useful with the cell's contents } } }
answers question: http://stackoverflow.com/q/25640375
has comment: http://stackoverflow.com/comment/40417907
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40417715

tomcat
tags question: http://stackoverflow.com/q/25604094
tags question: http://stackoverflow.com/q/25708897
tags question: http://stackoverflow.com/q/25659381
tags question: http://stackoverflow.com/q/25689281
tags question: http://stackoverflow.com/q/25683974
tags question: http://stackoverflow.com/q/25623875
tags question: http://stackoverflow.com/q/25699923
tags question: http://stackoverflow.com/q/25593746
tags question: http://stackoverflow.com/q/25568767
tags question: http://stackoverflow.com/q/25573245
tags question: http://stackoverflow.com/q/25637433
tags question: http://stackoverflow.com/q/25701426
tags question: http://stackoverflow.com/q/25598273
tags question: http://stackoverflow.com/q/25712772
tags question: http://stackoverflow.com/q/25614662
tags question: http://stackoverflow.com/q/25588969
tags question: http://stackoverflow.com/q/25589132
tags question: http://stackoverflow.com/q/25615641
tags question: http://stackoverflow.com/q/25591063
tags question: http://stackoverflow.com/q/25584335
tags question: http://stackoverflow.com/q/25710365
tags question: http://stackoverflow.com/q/25596179
tags question: http://stackoverflow.com/q/25615228
tags question: http://stackoverflow.com/q/25674257
tags question: http://stackoverflow.com/q/25613246
tags question: http://stackoverflow.com/q/25578973
tags question: http://stackoverflow.com/q/25626163
tags question: http://stackoverflow.com/q/25620503
tags question: http://stackoverflow.com/q/25669574
tags question: http://stackoverflow.com/q/25671460
tags question: http://stackoverflow.com/q/25569415
tags question: http://stackoverflow.com/q/25699316
tags question: http://stackoverflow.com/q/25561421
tags question: http://stackoverflow.com/q/25643633
tags question: http://stackoverflow.com/q/25585020
tags question: http://stackoverflow.com/q/25684905
tags question: http://stackoverflow.com/q/25629547
tags question: http://stackoverflow.com/q/25586490
type: Tag
tags question: http://stackoverflow.com/q/25700300
tags question: http://stackoverflow.com/q/25705913
tags question: http://stackoverflow.com/q/25625694
tags question: http://stackoverflow.com/q/25562746
tags question: http://stackoverflow.com/q/25579459
tags question: http://stackoverflow.com/q/25620859
tags question: http://stackoverflow.com/q/25622776
tags question: http://stackoverflow.com/q/25567920
tags question: http://stackoverflow.com/q/25552978
tags question: http://stackoverflow.com/q/25676738
tags question: http://stackoverflow.com/q/25668466
tags question: http://stackoverflow.com/q/25622663
tags question: http://stackoverflow.com/q/25662161
tags question: http://stackoverflow.com/q/25630242
tags question: http://stackoverflow.com/q/25662269
tags question: http://stackoverflow.com/q/25555541
tags question: http://stackoverflow.com/q/25658317
tags question: http://stackoverflow.com/q/25693448
tags question: http://stackoverflow.com/q/25676873
tags question: http://stackoverflow.com/q/25686704
tags question: http://stackoverflow.com/q/25612730
tags question: http://stackoverflow.com/q/25594856
tags question: http://stackoverflow.com/q/25696230
tags question: http://stackoverflow.com/q/25674642
tags question: http://stackoverflow.com/q/25589152
tags question: http://stackoverflow.com/q/25588596
tags question: http://stackoverflow.com/q/25654269
tags question: http://stackoverflow.com/q/25559614
tags question: http://stackoverflow.com/q/25645920
tags question: http://stackoverflow.com/q/25644210
tags question: http://stackoverflow.com/q/25638500
tags question: http://stackoverflow.com/q/25660141
tags question: http://stackoverflow.com/q/25626986
tags question: http://stackoverflow.com/q/25664928
tags question: http://stackoverflow.com/q/25603806
tags question: http://stackoverflow.com/q/25668298
tags question: http://stackoverflow.com/q/25670917
tag name: tomcat
tags question: http://stackoverflow.com/q/25591053
tags question: http://stackoverflow.com/q/25605535
tags question: http://stackoverflow.com/q/25552727

http://stackoverflow.com/comment/40071969
has text: try to use spring security.. here is a helloworld http://howtodoinjava.com/2014/02/15/xml-config-based-method-level-spring-security-using-protect-pointcut/ & video: https://www.youtube.com/watch?v=1zu8COg80q4
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25645669
score: 1

http://stackoverflow.com/comment/40207053
comment on: http://stackoverflow.com/q/25616601
has text: I have changed code to int length = _log.length(); log.append(_log.substring(0,length)); firePropertyChange("tradesLog","","trades log changed"); _log.delete(0, length); Seems to work OK now. Thanks a lot
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39973608
score: 0
comment on: http://stackoverflow.com/q/25559417
type: Comment
type: QuestionComment
has text: I didn't checked the encoding of my db, I don't know how.

http://stackoverflow.com/comment/40056055
comment on: http://stackoverflow.com/q/25635813
has text: Line 117: event = EventParser.parse(new InputStreamReader(request.getInputStream())); I was confused on the stack trace too. I take the head 7 line here, I think the last of them was unnecessary.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25691374
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/25691593
has comment: http://stackoverflow.com/comment/40154858
score: 1
tagged with: java
has title: Adding quantities of Duplicate Strings
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/40156276
accepted answer: http://stackoverflow.com/a/25732663
has comment: http://stackoverflow.com/comment/40339211
has body: I've been tasked with sorting a list of categories. A shopping list, if you will. These categories are inputs from the user, items to be bought. After the string name of the category in question is input (using scanner of course) the user is then able to put in the quantity of that category (an integer), followed by the unit cost of that category(a double). They are prompted to repeat this until the category they name is "end". This is all fine and dandy, and I've already written code that takes all of this information and finds and prints out the largest cost item, the largest quantity item, and other info. What I need help with is my duplicate categories. For example, suppose the user puts in "cars" followed by an integer 3, followed by the number 24000.00. They then put in "refigerators" followed by 1, followed by 1300.00. And then the user puts in a duplicate of the first entry, which is "cars" followed by an integer 5, followed by the double 37000.00. How can I get my code revisit older entries, add the new quantity to the old one, and store that value without overriding the old stuff? I also need to find the largest average cost of the items in the list. I am new to HashMap, so I'm struggling with the code: // create an arrayList to store values // create an arrayList to store values ArrayList&lt;String&gt; listOne = new ArrayList&lt;String&gt;(); listOne.add("+ 1 item"); listOne.add("+ 1 item"); listOne.add("+ 1 item"); // create list two and store values ArrayList&lt;String&gt; listTwo = new ArrayList&lt;String&gt;(); listTwo.add("+1 item"); listTwo.add("+1 item"); // put values into map multiMap.put("some sort of user input detailing the name of the item", listOne); multiMap.put("some other input detailing the name of the next item", listTwo); // i need the user to input items until they type "end" // Get a set of the entries Set&lt;Entry&lt;String, ArrayList&lt;String&gt;&gt;&gt; setMap = multiMap.entrySet(); // time for an iterator Iterator&lt;Entry&lt;St…
has answer: http://stackoverflow.com/a/25691593
downvote count: 0
has answer: http://stackoverflow.com/a/25732663
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40155233
tagged with: arraylist

http://stackoverflow.com/a/25655499
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25653140
has body: If you are using DataSeries you could set the color for a concrete DataSeriesItem via DataSeriesItem.setColor() method. for example, starting from the Chart instance DataSeries dataSeries = (DataSeries) chart.getConfiguration().getSeries().get(0); dataSeries.get(10).setColor(SolidColor.RED);
answers question: http://stackoverflow.com/q/25653140
type: Answer

http://stackoverflow.com/a/25668890
has comment: http://stackoverflow.com/comment/40113961
score: 3
accepted answer of: http://stackoverflow.com/q/25668707
upvote count: 3
has body: When you loop over loc, you get an int cell for each location. The problem is that that variable doesn't have any connection to the array, it's only a copy. If you change it, nothing's going to happen to the original array. I suggest looping over loc with a traditional for(;;) and using the current array index within the loop's logic to set the right "cells" to -1.
downvote count: 0
answers question: http://stackoverflow.com/q/25668707
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/40179959
type: Comment
type: QuestionComment
has text: That is for *any* library that your application needs - including JDBC drivers. It has nothing to do with the actual DBMS (or with whatever the library does)
comment on: http://stackoverflow.com/q/25704522
score: 1

http://stackoverflow.com/q/25698287
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40167782
has title: Java - Can not create objects in a shortend line if
duplicate of: http://stackoverflow.com/q/9206618
score: 3
has comment: http://stackoverflow.com/comment/40167699
has body: Lately I started programming in Java again after a short break and whilst doing a project for a friend I noticed something odd: It appears you can not create objects in shortened ifs, example: if( condition ) Statement statement = con.createStatement(); (I cut the code short for simplicity's sake.) I receive an error saying that Statement (a class from the java.sql package) can not be resolved to a variable, however, if I were to wrap the code with braces it would work fine. I assume this is some problem with the compiler turning this in to a multiline statement but I'm uncertain, I'd like to know the reason for this behaviour, thanks in advance!
accepted answer: http://stackoverflow.com/a/25698346
has answer: http://stackoverflow.com/a/25698432
answer count: 2
has answer: http://stackoverflow.com/a/25698346
has comment: http://stackoverflow.com/comment/40167730
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/9206618
has comment: http://stackoverflow.com/comment/40167777
downvote count: 0
has comment: http://stackoverflow.com/comment/40167710
possible better answer: http://stackoverflow.com/a/25698432
favorite count: 0
type: Question

http://stackoverflow.com/comment/39984248
has text: nice i'm new to java and didn't know this stuff thank's
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25597006

http://stackoverflow.com/comment/40148442
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25679787
has text: @Sharad Show part of jrxml with definition customiser class: <xyBarChart><chart customizerClass="whatWroteHere?"
score: 0

gigya
tag name: gigya
type: Tag
tags question: http://stackoverflow.com/q/25711172

http://stackoverflow.com/comment/39996261
comment on: http://stackoverflow.com/q/25597469
score: 0
type: Comment
has text: You'd better to split on `&` then on `=`.
type: QuestionComment

http://stackoverflow.com/comment/39931643
type: Comment
has text: Line 42: txtUsuario.setTitle(mSessao.getString("nome"));
comment on: http://stackoverflow.com/q/25569055
type: QuestionComment
score: 0

timer
tag name: timer
tags question: http://stackoverflow.com/q/25710812
tags question: http://stackoverflow.com/q/25624331
tags question: http://stackoverflow.com/q/25642153
tags question: http://stackoverflow.com/q/25693039
type: Tag
tags question: http://stackoverflow.com/q/25633806
tags question: http://stackoverflow.com/q/25579047
tags question: http://stackoverflow.com/q/25671527
tags question: http://stackoverflow.com/q/25624052
tags question: http://stackoverflow.com/q/25626458
tags question: http://stackoverflow.com/q/25639075

http://stackoverflow.com/a/25681381
answers question: http://stackoverflow.com/q/25664331
type: Answer
has body: Figured it out. Rather pointless question in the end. We have an aggressive firewall in work and I simply needed to use a wifi connection instead as importing the project for the first time required third party software to be installed. Simples in the end.
score: 0
accepted answer of: http://stackoverflow.com/q/25664331
type: AcceptedAnswer

http://stackoverflow.com/a/25584264
type: Answer
has body: This is documented here in the Android SDK documentation: http://developer.android.com/guide/topics/graphics/opengl.html#version-check You basically have 3 options: If your app only works with ES 3.0, you request that version in your manifest: &lt;uses-feature android:glEsVersion="0x00030000" android:required="true" /&gt; You try to create an ES 3.0 context using eglCreateContext(), and check if it succeeds. You create an ES 2.0 context, and then check the supported version with glGetString(GL_VERSION). The link above has sample code for solutions 2 and 3.
answers question: http://stackoverflow.com/q/25584032
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/40113470
score: 1
has text: This was the one i was lacking! Thank you very much.
type: Comment
comment on: http://stackoverflow.com/a/25656629
type: AnswerComment

http://stackoverflow.com/comment/40126175
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25675571
type: QuestionComment
has text: Did you already create the interstitial Ad unit in the google Admob dashboard?

android-wallpaper
tags question: http://stackoverflow.com/q/25711528
type: Tag
tag name: android-wallpaper
tags question: http://stackoverflow.com/q/25699168

http://stackoverflow.com/q/25679914
answer count: 1
tagged with: logging
has body: I have an applet which runs on the client machine. I want to obtain logs or store logs on client side. I know Java console shows all the errors/exceptions. Any way I can store those logs in a file?
score: 0
tagged with: java
tagged with: applet
type: Question
has title: Client Side logging in Applet
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25689411

http://stackoverflow.com/comment/39928343
type: QuestionComment
has text: @Holger or, even shorter, `"Hello "::concat`
comment on: http://stackoverflow.com/q/25565020
score: 1
type: Comment

http://stackoverflow.com/comment/40111926
has text: hihibjj,,,,,,,ghjjjj, , ,kartik.isworking@gmail.com,,,,karan.adep@gmail.com, android-developer-support@google.com, prerna.mungekar@hamarisuraksha.com
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25664543
type: Comment

http://stackoverflow.com/comment/64263709
type: AnswerComment
type: Comment
has text: This answer describes *passive* rendering only. Another approach is *active* rendering, described here: https://docs.oracle.com/javase/tutorial/extra/fullscreen/rendering.html
score: 0
comment on: http://stackoverflow.com/a/25574468

http://stackoverflow.com/q/25626108
score: 1
has comment: http://stackoverflow.com/comment/40337877
tagged with: java
answer count: 1
tagged with: jmapviewer
has comment: http://stackoverflow.com/comment/40036519
has comment: http://stackoverflow.com/comment/40036406
has answer: http://stackoverflow.com/a/25626212
favorite count: 0
type: Question
has body: I'm trying to update markers on a jMapViewer once every 5 seconds. This seems to be working fine until you move the map. At this point it throws a java.util.ConcurrentModificationException. I believe this is to do with the different processes trying to access the map markers list at the same time but I'm not sure how to fix it. timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { loadUnits(); } }, 5 * 1000, 5 * 1000); private void loadUnits() { String query = "SELECT callsign, currentlat,currentlon,previouslat,previouslon, mobile, uniticon FROM unit WHERE isdeleted=0;"; rs = DBase.runQuery(query); kit.removeAllMapMarkers(); MapMarkerUnit x; try { while (rs.next()) { x = new MapMarkerUnit(rs.getDouble("currentlat"),rs.getDouble("currentlon")); if (rs.getInt("mobile") == 1) x.setMovement(true); else x.setMovement(false); x.setIconName(rs.getString("uniticon")); x.setPriority(1); kit.addMapMarker(x); } } catch (SQLException e) { System.out.print(e.toString()); } } Thanks for your help. Kieran
has comment: http://stackoverflow.com/comment/40036512
accepted answer: http://stackoverflow.com/a/25626212
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40036923
downvote count: 0
has title: java.util.ConcurrentModificationException on moving jMapViewer
upvote count: 1

http://stackoverflow.com/q/25620389
tagged with: mapping
upvote count: 2
type: UnansweredQuestion
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/42081561
score: 2
has comment: http://stackoverflow.com/comment/40025875
tagged with: hibernate-envers
tagged with: java
tagged with: orm
has body: I am using 4.3.6 hibernate and envers. I have 2 entity A and B. A is the main entity and B is a sub-section of A. They are one-to-one and bi-directional. Both of them are @Audited, there are 3 scenario happens when I save A: Save A, both A and B is modified. There will be a new Revision Number shared by both. Save A, only A is modified. There will be a new Revision for A. Save A, only B is modified. There will be a new Revision for B. (I don't want this) I will always save Entity A and cascade B to update. How can I have the revision for entity A in scenario 3? Many thanks!!! for data schema, my schema is configured according to the answer of this post: My data schema: @Entity @Audited public class B implements Serializable { .... //bi-directional one-to-one association to A @MapsId @OneToOne(mappedBy="b", cascade=CascadeType.ALL) @JoinColumn(name="A_ID") private A a; } @Entity @Audited @Table(name="A") public class A implements Serializable { ... //bi-directional one-to-one association to B @OneToOne(cascade=CascadeType.ALL) @PrimaryKeyJoinColumn private B b; When I save persist entity A ( A is not modified and B is modified), Hibernate generated sql Hibernate: update A set ... Hibernate: update B set ... Hibernate: update C set ... Hibernate: insert into RevEntity (CREATE_DATE, timestamp, username, id) values (?, ?, ?, ?) Hibernate: insert into B_AUD ...
has title: Hibernate envers one-to-one relationship not both side audited
type: Question
tagged with: one-to-one

http://stackoverflow.com/comment/40121527
type: QuestionComment
has text: Seems to be related (if not duplicate) : http://stackoverflow.com/questions/6386917/strange-exception-table-entry-produced-by-suns-javac
comment on: http://stackoverflow.com/q/25615417
type: Comment
score: 1

http://stackoverflow.com/comment/39908250
type: Comment
has text: @belyid Then this is not related to GWT. You'll have better chances of getting a good answer if you remove GWT from the equation (and question) and update your tags; maybe add [tag:servlets] to begin with (and remove [tag:gwt])
type: QuestionComment
comment on: http://stackoverflow.com/q/25554452
score: 0

http://stackoverflow.com/comment/39930677
type: AnswerComment
comment on: http://stackoverflow.com/a/25568283
type: Comment
has text: Thanks. But can please explain the flow of this program. Where is the main method to execute this ASM program. how it ll generate the new class. can u please give the full code sir!!
score: 0

http://stackoverflow.com/q/25579362
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39951153
type: UnansweredQuestion
has body: I am using eclipse version Eclipse Java EE IDE for Web Developers Luna Release. When I click Launch the Web Service Explorer under the Run menu, the explorer that eclipse has in its own turns out to be HTTP ERROR: 500. Don't it be a web page instead of reminding me of the error? I do not know how to solve it. I find out this problem when I try to publish my first web project with Tomcat installed in the eclipse. However it shows the http error 500.:( Hope someone can help me~ Thank you in advance!
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39968878
has answer: http://stackoverflow.com/a/29957817
answer count: 2
downvote count: 0
has title: Open web service explorer with http error 500 in eclipse
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25771224

http://stackoverflow.com/comment/40034105
score: 0
comment on: http://stackoverflow.com/a/25624576
type: Comment
has text: Thank you. This has helped my understanding a lot.
type: AnswerComment

http://stackoverflow.com/q/25691165
has title: notifydatasetchanged returns null
score: 0
answer count: 1
type: Question
tagged with: android-listview
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25691266
type: UnansweredQuestion
has body: Hey guys I get a nullpointerexception when I try to update the listview from another thread. I am able to do this just fine on my main activity, but I want update listview from another class thread, I was wondering what am I doing wrong, and could it be something I am overlooking? Here is the code. Sorry for the messy code, I have been at this for hours here is the server class. I have tried so many different things I don't remember everything I tried. Server: public class Server extends Thread{ private ServerSocket serverSocket; private ServerGUI gui; Context context; private Server s; ArrayList&lt;String&gt; addclientlist; private ListView listview; private ArrayAdapter&lt;String&gt; adapter; String inforeceive; public Server(Context context){ this.context=context; gui = new ServerGUI(); listview = (ListView) ((Activity)context).findViewById(R.id.list); } @Override public void run() { gui.runOnUiThread(new Runnable(){ @Override public void run() { try{ int port = 8000; serverSocket = new ServerSocket(port); TextView listport = (TextView)((Activity)context).findViewById(R.id.textViewportlisten); listport.setText("Listening On Port: "+serverSocket.getLocalPort()); addclientlist = new ArrayList&lt;String&gt;(); adapter = new ArrayAdapter&lt;String&gt;(gui, android.R.layout.simple_list_item_1, android.R.id.text1, addclientlist); listview.setAdapter(adapter); }catch(Exception e){ } setOnline(); } }); super.run(); } public void setOnline(){ new Thread(new Runnable() { @Override public void run() { try{ while(true){ final Socket cs = serverSocket.accept(); final DataInputStream dis = new DataInputStream(cs.getInputStream()); gui.runOnUiThread(new Runnable() { @Override public void run() { try { final EditText logtext = (EditText) ((Activity) context).findViewById(R.id.editTextlog); logtext.append("New client from: " + cs.getInetAddress() + "\n"); new AsyncTask&lt;Void,Void,Void&gt;(){ @Override protected Void doInBackground(Void... params) { return null; } @Override prot…

http://stackoverflow.com/comment/40001192
comment on: http://stackoverflow.com/a/25606384
type: Comment
score: 1
type: AnswerComment
has text: Thanks alot! My problem is I dont know what adress have that icon. It works.

http://stackoverflow.com/a/25568306
has comment: http://stackoverflow.com/comment/39934927
type: Answer
has comment: http://stackoverflow.com/comment/39934163
answers question: http://stackoverflow.com/q/25567973
has body: You can create your own implementation of HttpRoutePlanner that will allow change of the HttpHost. public class DynamicProxyRoutePlanner implements HttpRoutePlanner { private DefaultProxyRoutePlanner defaultProxyRoutePlanner = null; public DynamicProxyRoutePlanner(HttpHost host){ defaultProxyRoutePlanner = new DefaultProxyRoutePlanner(host); } public void setProxy(HttpHost host){ defaultProxyRoutePlanner = new DefaultProxyRoutePlanner(host); } public HttpRoute determineRoute(HttpHost target, HttpRequest request, HttpContext context) { return defaultProxyRoutePlanner.determineRoute(target,request,context); } } Then you can use this DynamicProxyRoutePlanner in your code HttpHost proxy = new HttpHost("someproxy", 8080); DynamicProxyRoutePlanner routePlanner = new DynamicProxyRoutePlanner(proxy); CloseableHttpClient httpclient = HttpClients.custom() .setRoutePlanner(routePlanner) .build(); //Any time change the proxy routePlanner.setProxy(new HttpHost("someNewProxy", 9090));
score: 9
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25567973
upvote count: 9

http://stackoverflow.com/q/25684902
tagged with: design-patterns
has body: I am a junior engineer on a Java team that uses Spring. We have been coached to Autowired Setters of instance variables rather than Autowiring the actual instance variable. I am slightly confused as to why we do this, what are the advantages of doing this and possible shortfalls of handling dependency management in this way ?
type: Question
accepted answer: http://stackoverflow.com/a/25685506
has comment: http://stackoverflow.com/comment/40142493
has answer: http://stackoverflow.com/a/25685506
linked to: http://stackoverflow.com/q/3746574
tagged with: spring
tagged with: inversion-of-control
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has title: AutoWired Setters rather than AutoWired instance variables in Spring

http://stackoverflow.com/a/25624763
downvote count: 0
has body: Maybe you have problems with the scrollpane (like: no scrollbars visible). Are your sure you are using it correct? this looks strange to me: You create a ViewPort and put this as View?! JViewport vp2 = new JViewport(); scrollPane_1.setViewportView(vp2); vp2.add(table2); why not just set the Table as ViewportView (as the name implies?) just: scrollPane_1.setViewportView(table2); Edit: Info about the ViewPort: The "viewport" or "porthole" through which you see the underlying information. When you scroll, what moves is the viewport. It is like peering through a camera's viewfinder. Moving the viewfinder upwards brings new things into view at the top of the picture and loses things that were at the bottom. http://docs.oracle.com/javase/7/docs/api/javax/swing/JViewport.html
has comment: http://stackoverflow.com/comment/40048536
upvote count: 1
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40040340
accepted answer of: http://stackoverflow.com/q/25611114
type: Answer
answers question: http://stackoverflow.com/q/25611114

http://stackoverflow.com/q/25594600
tagged with: opengl
tagged with: java
tagged with: slick2d
tagged with: lwjgl
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25601636
has body: Draw.drawSquare(0, 0, Display.getWidth(), Display.getHeight(), UITextures.engineBackgroundTex); For some reason, the texture is the same size, even after the window is resized. Display.setResizable is set to true. Am I correctly getting the size of the display? ALSO: The draw call is running at 60 fps and Draw.drawSquare has been tested to work, but for some reason Display.getWidth does not work to resize the texture...
type: UnansweredQuestion
tagged with: resize
has title: LWJGL Get Display Size Not Working Correctly
score: 0

http://stackoverflow.com/a/25640173
has body: It seems to me that connections are not getting cleaned up properly in your application. That's why this map is growing indefinitely. I would suggest you to clean the connections properly manually or use proper integration of JPA with spring, as spring will take care of it by itself..
answers question: http://stackoverflow.com/q/25640057
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40104923

http://stackoverflow.com/q/25557263
possible better answer: http://stackoverflow.com/a/25560164
tagged with: buttonclick
tagged with: android
has answer: http://stackoverflow.com/a/25560164
has answer: http://stackoverflow.com/a/25560190
tagged with: no-response
has title: Android on click button not responding
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39910133
tagged with: onclicklistener
has comment: http://stackoverflow.com/comment/39909665
answer count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25569045
has body: I have a login activity in my android application. It consists of two EditText widgets(Username, Password) and two buttons(Login,Register). The problem is when I click the buttons there's no response and no errors in my logcat. I've imported android.view.View.OnClickListener and I've set OnClickListeners. The weird thing is, it worked perfectly when I used FragmentActivities/FragmentViews, I received JSON responses and logged in, but when I changed back to just "normal" activities it simply had no response. Any help on this, Maybe there's something I'm missing but not seeing? Code below. Login.java import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class Login extends Activity implements OnClickListener { private EditText user, pass; private Button mSubmit, mRegister; private ProgressDialog pDialog; JSONParser jsonParser = new JSONParser(); private static final String LOGIN_URL = "http://************/tappedin/login.php"; private static final String TAG_SUCCESS = "success"; private static final String TAG_MESSAGE = "message"; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login_layout); private EditText user, pass; private Button mSubmit, mRegister; mSubmit = (Button) findViewById(R.id.butLogin); mRegister = (Button) findViewById(R.id.butRegister); mSubmit.setOnClickListener(this); mRegister.setOnClickListener(this); } } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.…
has comment: http://stackoverflow.com/comment/39910652
has answer: http://stackoverflow.com/a/25569045
has comment: http://stackoverflow.com/comment/39909609
type: Question

http://stackoverflow.com/q/25662505
type: Question
has comment: http://stackoverflow.com/comment/40120403
has comment: http://stackoverflow.com/comment/40113267
has answer: http://stackoverflow.com/a/25758433
has comment: http://stackoverflow.com/comment/40120359
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40120642
has title: Commons Logging - Stdout/Stderr doesn't work at JUnit4 tests
tagged with: logging
tagged with: apache-commons-logging
score: 0
has comment: http://stackoverflow.com/comment/40113266
tagged with: junit4
has comment: http://stackoverflow.com/comment/40120441
tagged with: java
answer count: 1
tagged with: junit
has body: Problem: Logs doesn't echo anything in my unit tests. Logging works well in my app, but when I move the same code to test package they stop working. (see code below) Question: How to get logs in my unit tests? Code: import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class LogTest { private static final Log _LOG = LogFactory.getLog(TransformerServiceTest.class); @Test public void testLogs() { _LOG.info("!!!!!!!!!!!!!!!!!!"); // NEVER ECHOES TO STDOUT } } Update: Now only _LOG.error() works After changing to DEBUG level, only ERROR level works log4j.properties # Root logger option log4j.rootLogger=DEBUG, stdout # Direct log messages to stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n LogTest.class public class LogTest { private static Log _LOG = LogFactory.getLog(LogTest.class); @Test public void test() { _LOG.error("Error works!"); //works _LOG.warn("Warn works!"); //doesn't work _LOG.info("Info works!"); // doesn't work } }

http://stackoverflow.com/comment/39946157
has text: @NonSecwitter: your question might then be best asked as a new question on this site. Best of luck.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25574478
type: AnswerComment

http://stackoverflow.com/comment/40037106
type: Comment
type: QuestionComment
has text: Ended up with implementing middle table. you were the first to help, feel free to post answer so I can accept it.
comment on: http://stackoverflow.com/q/25623458
score: 0

http://stackoverflow.com/comment/40071219
type: AnswerComment
comment on: http://stackoverflow.com/a/25645488
has text: So each computer has its own IP address?
type: Comment
score: 0

http://stackoverflow.com/q/25619910
tagged with: versioning
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25620083
tagged with: compiled
type: Question
has body: My project is spanned across two phases. First phase is nearly completed. Although we already have some functionality, that can be seen as menu items for logical separation, developed which is to be delivered in phase two. I have been advised to maintain two versions of the codebase (creating two branches phase1Branch and phase2Branch). That is because we need two compiled (it's java therefore deployed artifact is a jar file. I use jenkins to build the project that generates the jar file for deployment.) versions of the codebase one for phase1 and another for phase2. So that it can be easily switched from phase1 to phase2 as and when required, for instance while showing a demo to the client. However, I still think this can be done without maintaining two codebases. What is the best practice that serves the objective with minimum hassle?
has comment: http://stackoverflow.com/comment/40025037
has title: Two separate compiled versions of java project
tagged with: codebase
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40024941
has comment: http://stackoverflow.com/comment/40025645
score: 0

http://stackoverflow.com/q/25706974
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/25707769
has comment: http://stackoverflow.com/comment/40183570
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40183560
has title: Deleting any node in a single linked list
has comment: http://stackoverflow.com/comment/40183912
tagged with: linked-list
has comment: http://stackoverflow.com/comment/40184993
has comment: http://stackoverflow.com/comment/40183921
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40185000
answer count: 1
has body: I'm trying to implement a Java linked list. The program is giving me a null pointer whenever I try to delete the next to last node. Here are the attributes: public class Nodo { int num; boolean used; Nodo next; } And this is the method so far: public int delete(int val) { // deletes, (1:deleted, 0:not found, -1:empty // list) int deleted = 0; if (n.used) { if (n.next == null) { if (n.num == val) { n.used = false; deleted = 1; } } else { Nodo it = n; Nodo itAnt = null; while (it.next != null) { if (it.num == val) { it.num = it.next.num; it.next = it.next.next; deleted = 1; } itAnt = it; it = it.next; } if (it.num == val) { itAnt.next = null; deleted = 1; } } } else { deleted = -1; System.out.println("Empty list"); } return deleted; } How can I solve this problem?
has comment: http://stackoverflow.com/comment/40183890
downvote count: 1
has comment: http://stackoverflow.com/comment/40183896

http://stackoverflow.com/comment/39986779
has text: Naa, that is not necessary. Since IDE and the server, are two different thingies. Never used any IDE before, hence, cannot say much, as to how to go about it in `Eclipse`. I am running my Apache, alone, with no `Eclipse`, from my home computer, for free. So just checked, it if I am able to see this manager page, through this URL as posted. So the answer is __"YES, indeed. The URL is working fine, so problem lies somewhere else :-)"__
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25598273
type: Comment

http://stackoverflow.com/comment/39991179
comment on: http://stackoverflow.com/q/25601190
type: Comment
has text: Unfortunately I'm simply running the created jar from my user account which has permission to read/write but I did have to type in my credentials to gain me access..
type: QuestionComment
score: 0

http://stackoverflow.com/a/26071281
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25692646
type: Answer
accepted answer of: http://stackoverflow.com/q/25692646
upvote count: 1
has body: I figure out how to solve this problem.. here is my solution: private String completeQuery(String coreQuery){ String completeQuery = ""; completeQuery += "SELECT * WHERE {"+ "\n"; completeQuery += coreQuery + "\n"; completeQuery =completeQuery + "}" + "\n" +"limit 5" ; return completeQuery;} public String link(String object1, String object2, int distance){ if(distance == 1){ String Quer = "&lt;http://dbpedia.org/resource/"+object1+"&gt;" + " ?pre1 " +"&lt;http://dbpedia.org/resource/"+object2+"&gt;"; return completeQuery(Quer); } else { String query = "&lt;http://dbpedia.org/resource/"+object1+"&gt;" + " ?pre1 ?obj1 " + ".\n"; for(int i = 1; i &lt; distance-1; i++){ query += "?obj" + i + " ?pre" + (i+1) + " ?obj" + (i+1) + ".\n" ; } query += "?obj" + (distance-1) + " ?pre" + distance + " " + "&lt;http://dbpedia.org/resource/"+object2+"&gt;"; return completeQuery(query); }}

rss
type: Tag
tags question: http://stackoverflow.com/q/25581106
tags question: http://stackoverflow.com/q/25695582
tags question: http://stackoverflow.com/q/25688231
tag name: rss
tags question: http://stackoverflow.com/q/25619234
tags question: http://stackoverflow.com/q/25696816
tags question: http://stackoverflow.com/q/25592622

http://stackoverflow.com/a/25668734
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40116887
answers question: http://stackoverflow.com/q/25667960
has body: Short answer: No you cannot reference the super class using the . operator from a subclass. Long one: If you want to access an instance method from a super class, that implicitely means that you want to access a method that is already an instance method of your class (unless that method is marked to be invisile for classes' suptypes thus marked with either of the following access levels private or default). That being said, you can access the method by calling its signature: public class A { public int getOne() { return 1; } } public class B extends A { public int getOneFromSuperClass() { return getOne(); // here you are calling the method #getOne from superclass A } public static void main(String args[]) { B b = new B(); b.getOneFromSuperClass(); } } You can even, refer to the method with the super keyword if this method is already overriden in your subclass: public class A { public int getOne() { return 1; } } public class B extends A { public int getOne() { return 2; // You catch it, this method returns 2 not like it seems to be doing } public int getOneFromSuperClass() { return super.getOne(); // Yes we can call the super getOne method to get the correct item } public static void main(String args[]) { B b = new B(); System.out.println(b.getOneFromSuperClass()); This will print 1 not 2 } } You can even call the super#getOne method using an B reference since this method is inhereted from the superclass: public class A { public int getOne() { return 1; } } public class B extends A { public static void main(String args[]) { B b = new B(); b.getOne(); } } Notice that a refence to B class has been used to call a method defined in the A class, simply because this method is inhereted and then becomes an instance method of B as it was defined there.
has comment: http://stackoverflow.com/comment/40115675

http://stackoverflow.com/comment/39942877
type: QuestionComment
comment on: http://stackoverflow.com/q/25554137
score: 1
type: Comment
has text: @shekharsuman No worries! The answer provided worked for me.. Thanks for the concern.

facebook-android-sdk
tags question: http://stackoverflow.com/q/25693973
type: Tag
tags question: http://stackoverflow.com/q/25693744
tag name: facebook-android-sdk

http://stackoverflow.com/a/25588306
score: 10
type: Answer
has comment: http://stackoverflow.com/comment/39967434
has comment: http://stackoverflow.com/comment/39967420
has body: It is all about how you structure your key. To put "filea" into "folderb", just name the key of the object as "folderb/filea".
has comment: http://stackoverflow.com/comment/39967438
downvote count: 0
has comment: http://stackoverflow.com/comment/39967497
has comment: http://stackoverflow.com/comment/39967433
upvote count: 10
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39967464
has comment: http://stackoverflow.com/comment/39967493
accepted answer of: http://stackoverflow.com/q/25588246
answers question: http://stackoverflow.com/q/25588246
has comment: http://stackoverflow.com/comment/39967290
has comment: http://stackoverflow.com/comment/39967256

http://stackoverflow.com/q/25695299
tagged with: java
score: 7
has answer: http://stackoverflow.com/a/25803043
answer count: 1
upvote count: 7
favorite count: 0
type: Question
has body: I installed chromium-chromedriver from official ubuntu repository, but when I try to run the binary or invoke it from java library I always got the following error: /usr/lib/chromium-browser/chromedriver: error while loading shared libraries: libui_base.so: cannot open shared object file: No such file or directory This is not a duplicate of Chromedriver on Ubuntu 12.04 - Error while loading shared libraries: libXi.so.6 as missing library names are different. And I have tried using their solution which doesn't work. Any one encounter the same problem?
type: UnansweredQuestion
downvote count: 0
tagged with: ubuntu-14.04
tagged with: selenium-chromedriver
has title: Chromedriver on Ubuntu 14.04 - error while loading shared libraries: libui_base.so

http://stackoverflow.com/comment/40185976
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25708407
has text: If the code was commented he would get a compilation error...

http://stackoverflow.com/q/25574326
type: UnansweredQuestion
tagged with: android
score: -1
tagged with: android-activity
linked to: http://stackoverflow.com/q/16324482
upvote count: 0
answer count: 2
has answer: http://stackoverflow.com/a/25574446
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 1
has title: The method setImageUrl(String, ImageLoader) in the type NetworkImageView is not applicable for the arguments (Uri, ImageLoader)
has answer: http://stackoverflow.com/a/25574366
favorite count: 0
type: Question
has body: In brief, I am trying to populate an activity that would display information populated from JSON data. I have successfully managed to retrieve strings, but the issue resolves around retrieving images and casting it to imageviews. I have received the following error in eclipse: The method setImageUrl(String, ImageLoader) in the type NetworkImageView is not applicable for the arguments (Uri, ImageLoader)" at the line hsvimage1.setImageUrl(url1, mImageLoader) for the following lines: hsvimage1.setImageUrl(url1, mImageLoader); hsvimage2.setImageUrl(url2, mImageLoader); hsvimage3.setImageUrl(url3, mImageLoader); Below is the entire activity code public class CasualEventsSingleItemActivity extends Activity { // Declare Variables String list_item_name; String list_item_description; Uri list_item_bac; String list_item_price; String list_item_location; String single_list_item_description; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_events_single_item); ImageLoader mImageLoader = new ImageLoader(Volley.newRequestQueue(this), new ImageLoader.ImageCache() { private final LruCache<String, Bitmap> cache = new LruCache<String, Bitmap>(20); @Override public Bitmap getBitmap(String url) { return cache.get(url); } @Override public void putBitmap(String url, Bitmap bitmap) { cache.put(url, bitmap); } }); Intent i = getIntent(); list_item_name = i.getStringExtra("list_item_name"); list_item_location = i.getStringExtra("list_item_location"); list_item_bac = Uri.parse(i.getStringExtra("list_item_bac")); single_list_item_description = i.getStringExtra("single_list_item_description"); TextView txtname = (TextView) findViewById(R.id.name); TextView txtlocation = (TextView) findViewById(R.id.location); TextView txtsdescription = (TextView) findViewById(R.id.sdescription); NetworkImageView hsvimage1 = (NetworkImageView) findViewById(R.id.hsvimage1); NetworkImageView hsvimage2 = (NetworkImageView) findViewById…
tagged with: android-layout

http://stackoverflow.com/comment/40169609
type: Comment
type: QuestionComment
score: 0
has text: You could also catch the exception in the native code and try to get its stacktrace.
comment on: http://stackoverflow.com/q/25698620

http://stackoverflow.com/comment/40037402
has text: if i rename them as you say the program does not work....
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25626247
type: QuestionComment

http://stackoverflow.com/comment/40332244
comment on: http://stackoverflow.com/a/25787128
type: AnswerComment
score: 0
has text: @Karussell Entries are backed up in memory on multiple nodes. If a node dies while the cluster is running its fine. But with this kind of local persistence backups are not stored on disk. So if you shutdown your cluster, then try to start it and one disk doesn't start because its dead ...
type: Comment

http://stackoverflow.com/comment/39934427
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25570583
has text: The answer is simple: You are creating too many threads. Sounds obvious but it actually is the case. Way to analyse could be to log whenever you start a new thread and see what is causing the most threads. Or check if you can find out what these threads are doing and why they aren't finishing...
type: Comment

http://stackoverflow.com/q/25600796
tagged with: java
tagged with: junit
favorite count: 0
possible better answer: http://stackoverflow.com/a/25601170
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25601170
has answer: http://stackoverflow.com/a/25603814
downvote count: 0
has body: I am looking to find is it possible to invoke a custom method whenever an exception is thrown in a test. i.e I have several tests (annotated @Test) and I want to write only one method that handles the exceptions in my way (for example writing custom message for junit etc). (I am looking for something that is no try/catch block for every test) Thanks in advance.
has comment: http://stackoverflow.com/comment/39992292
upvote count: 1
has title: Invoking a custom method when receiving an exception in a test
has comment: http://stackoverflow.com/comment/39991436
accepted answer: http://stackoverflow.com/a/25603814
has comment: http://stackoverflow.com/comment/39990120
type: AnsweredQuestion
tagged with: exception
score: 1

http://stackoverflow.com/comment/40126108
type: QuestionComment
comment on: http://stackoverflow.com/q/25675624
has text: Maybe to avoid buffer reallocation at the first `append()`?
score: 3
type: Comment

http://stackoverflow.com/a/25593777
accepted answer of: http://stackoverflow.com/q/25592412
has body: I'm sorry for my mistake. When I wrote a demo application for this error I found a solution. The problem was that the settings were taken from my application rather than the default. After I commented out@SpringApplicationConfiguration(classes = App.class) everything works fine.
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25592412

http://stackoverflow.com/comment/39993131
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25602347
type: Comment
has text: You mean one better uses a `Map` instead of a `HashMap`? True if the instances are public. But if they are stored privately, there is not that much to gain.

http://stackoverflow.com/q/25647845
tagged with: executable-jar
tagged with: jar
linked to: http://stackoverflow.com/q/25635636
has body: Well, I tried so many ways to create executable jar, but after 4 hours I give up. I am trying to make executable jar file with my project where main class is in the controller. Basically I tried with export/runnable JAR file with various options including generating of ant script . I always have similar errors in terminal When I'm running that with terminal with java -jar fruitStore.jar it says bmj@OZ:~/Documents$ java -jar fruitStoreApp.jar java.io.FileNotFoundException: customers.ser (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.FileInputStream.&lt;init&gt;(FileInputStream.java:93) at model.Shop.loadCustomers(Shop.java:250) at model.Shop.&lt;init&gt;(Shop.java:121) at model.Shop.getInstance(Shop.java:140) at model.Model.&lt;init&gt;(Model.java:12) at GUI.CustomerMainPanel.&lt;init&gt;(CustomerMainPanel.java:24) at GUI.MainMenuGUI.&lt;init&gt;(MainMenuGUI.java:50) at GUI.MainMenuGUI.getInstance(MainMenuGUI.java:35) at model.View.&lt;init&gt;(View.java:49) at model.Controller.&lt;init&gt;(Controller.java:42) at model.Controller.main(Controller.java:805) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) java.io.FileNotFoundException: users.ser (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.FileInputStream.&lt;init&gt;(FileInputStream.java:93) at model.Shop.loadUsers(Shop.java:210) at model.Shop.&lt;init&gt;(Shop.java:122) at model.Shop.getInstance(Shop.java:140) at model.Model.&lt;init&gt;(Model.java:12) at GUI.CustomerMainPanel.&lt;init&gt;(Cust…
has comment: http://stackoverflow.com/comment/40076217
favorite count: 0
has title: Creating Runnable Jar with external text and ser files included
has answer: http://stackoverflow.com/a/25649753
has comment: http://stackoverflow.com/comment/40076172
type: Question
has comment: http://stackoverflow.com/comment/40077265
has answer: http://stackoverflow.com/a/25648871
has comment: http://stackoverflow.com/comment/40076876
has comment: http://stackoverflow.com/comment/40076906
has comment: http://stackoverflow.com/comment/40076025
has comment: http://stackoverflow.com/comment/40076627
has comment: http://stackoverflow.com/comment/40076423
has comment: http://stackoverflow.com/comment/40076508
has comment: http://stackoverflow.com/comment/40076801
has comment: http://stackoverflow.com/comment/40077109
accepted answer: http://stackoverflow.com/a/25649753
possible better answer: http://stackoverflow.com/a/25648871
has comment: http://stackoverflow.com/comment/40076250
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40076684
answer count: 2
has comment: http://stackoverflow.com/comment/40075958
has comment: http://stackoverflow.com/comment/40077235
downvote count: 0
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/comment/39958605
type: Comment
comment on: http://stackoverflow.com/q/25576153
score: 0
type: QuestionComment
has text: @Seismoid Please see my comment above; String isn't good enough since it's a UUID.

http://stackoverflow.com/q/25603581
has comment: http://stackoverflow.com/comment/40003145
tagged with: jackson
has title: Using conditions to dynamically exclude POJO property in Jackson json serialization
has answer: http://stackoverflow.com/a/25609465
downvote count: 0
answer count: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25613351
has answer: http://stackoverflow.com/a/25619299
favorite count: 0
type: Question
tagged with: serialization
has comment: http://stackoverflow.com/comment/39998650
type: UnansweredQuestion
score: 6
upvote count: 6
has body: I have a requirement to dynamically exclude certain property within a List of a defined POJO. The main POJO to be serialized is: public class Foo { List&lt;Bar&gt; bar; public void setBar(List&lt;Bar&gt; bar) { this.bar = bar; } public List&lt;Bar&gt; getBar() { return this.bar; } public static class Bar { private int id; private boolean ignoreId; private String name; public void setId(int id) { this.id = id; } public int getId() { return this.id; } public void setIgnoreId(boolean ignoreId) { this.ignoreId = ignoreId; } public boolean isIgnoreId() { return this.ignoreId; } public void setName(String name) { this.name = name; } public String getName() { return this.name; } } } id is to be ignored if ignoreId = true, like so: [ { "id": "1", "name": "one" }, { "name": "two" } { "name": "three" } { "id": "4", "name": "four" } ] At the moment, I have tried using JsonFilter and JacksonJsonViews but couldn't get the required output. I would be glad if any pointer can be given towards achieving this.
tagged with: pojo

http://stackoverflow.com/comment/40140490
type: QuestionComment
comment on: http://stackoverflow.com/q/25683464
has text: didi you try to remove the "/simgranjas" from controller? "/simgranjas/getAnimals" - "simgranjas/getAnimals"
score: 1
type: Comment

http://stackoverflow.com/comment/40119130
comment on: http://stackoverflow.com/q/25654292
type: QuestionComment
has text: I was able to reproduce it here.
score: 0
type: Comment

http://stackoverflow.com/q/25649442
tagged with: gradle
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25649552
has comment: http://stackoverflow.com/comment/40079631
tagged with: annotation-processing
has answer: http://stackoverflow.com/a/25649552
tagged with: android
tagged with: java
has body: I've been working on a simple java annotation processor that extends AbstractProcessor. I've been able to successfully test this using javac -Processor MyProcessor mySource.java The problem is integrating this into a simple Hello World android application using Android Studio. I started by making a new Android Project, and then adding a separate module where I place all my annotation processor code (the MyProcessor class as well as the custom annotation it uses). I then added this new module as a dependency of the HelloWorld android project. dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':MyProcessorModule') } How do I then use the processor to generate code based on all the source files in the HelloWorld application?
possible better answer: http://stackoverflow.com/a/31353153
upvote count: 6
has answer: http://stackoverflow.com/a/31353153
has title: How do I use custom Java Annotation Processor in Gradle?
tagged with: android-studio
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25649633
answer count: 3
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/52692575

http://stackoverflow.com/comment/40177950
has text: Whoever said that, clearly has no idea what she/he is talking about and probably never has used Derby or NetBeans.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25703742

substring
tags question: http://stackoverflow.com/q/25566232
tags question: http://stackoverflow.com/q/25690388
tags question: http://stackoverflow.com/q/25564315
type: Tag
tags question: http://stackoverflow.com/q/25677488
tags question: http://stackoverflow.com/q/25679521
tags question: http://stackoverflow.com/q/25689578
tags question: http://stackoverflow.com/q/25595097
tag name: substring
tags question: http://stackoverflow.com/q/25622344

http://stackoverflow.com/comment/40128099
type: Comment
comment on: http://stackoverflow.com/q/25676752
score: 0
type: QuestionComment
has text: How do I access the Obligations field in my xml file and return it as a string in java?

http://stackoverflow.com/q/25635964
answer count: 1
has title: Slick2D getGraphics() returning null, null pointer exception occurs
type: Question
has answer: http://stackoverflow.com/a/25684403
has body: I am working on getting my slick2d game to render, but container.getGraphics() is returning null and I am getting a null pointer exception. I checked that it was the getGraphics() that was returning null by using: if (container.getGraphics()==null) return; This fixed the npe but then of course I can't render anything. Stacktrace: Tue Sep 02 21:42:19 MDT 2014 INFO:Slick Build #237 Exception in thread "Thread-1" java.lang.NullPointerException at com.nonuniversal.client.MenuState.render(MenuState.java:17) at org.newdawn.slick.state.StateBasedGame.render(StateBasedGame.java:199) at com.nonuniversal.client.Game.run(Game.java:33) at java.lang.Thread.run(Unknown Source) please note LunatopiaClient needs a username argument when ran... import org.newdawn.slick.AppGameContainer; import org.newdawn.slick.SlickException; public class LunatopiaClient{ private String username; AppGameContainer container; Game game; public LunatopiaClient(String username) { this.username = username; } public static void main(String args[]) { if (args.length!=1) { System.out.println("Usage: java -jar &lt;filename.jar&gt; &lt;username&gt;"); return; } else { LunatopiaClient lunatopiaClient = new LunatopiaClient(args[0]); lunatopiaClient.init(); } } public void init() { try { game = new Game(""); container = new AppGameContainer(game); container.setFullscreen(true); game.init(container); game.init(); } catch (SlickException e) { e.printStackTrace(); } } public Game getGame() { return game; } public String getUsername() { return username; } } class Game import org.newdawn.slick.AppGameContainer; import org.newdawn.slick.GameContainer; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.StateBasedGame; public class Game extends StateBasedGame implements Runnable{ public static final int menuState = 0; public static final int gameState = 1; private boolean running; private AppGameContainer container; Thread game; public Game(String name) { super(name); } public void initStatesList(G…
accepted answer: http://stackoverflow.com/a/25684403
type: AnsweredQuestion
score: 0
tagged with: nullpointerexception
tagged with: java
tagged with: slick2d

http://stackoverflow.com/a/25669407
has comment: http://stackoverflow.com/comment/40161462
has comment: http://stackoverflow.com/comment/40115842
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40115589
has comment: http://stackoverflow.com/comment/40115016
score: 2
upvote count: 2
has body: I guess that you are writing about a PMD rule. Here is the XPath which match all the catch statements which does not have method LOG.info called anywhere inside: //CatchStatement[not(descendant::PrimaryPrefix/Name[@Image='LOG.info'])] For example, for that code: import java.util.logging.Logger; public class Test { private Logger LOG = Logger.getLogger(""); public void main(String[] args) { try { doStuff(); } catch (SomeException e) { // HERE VIOLATION handleException(e); } try { doStuff(); } catch (SomeException e) { LOG.info(e.getMessage() + " other stuff"); handleException(e); } } } it will find rule violation at line 9 (} catch (SomeException e) { // HERE VIOLATION) because in that line is catch statement which does not contain LOG.info. I suggest you to use PMD designer app to write more complex PMDs. It generates Abstract Syntax Tree of your java code and gives possibility to write and check your XPath rules. You could find it here
accepted answer of: http://stackoverflow.com/q/25667781
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25667781

http://stackoverflow.com/comment/40151500
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25688330
has text: @pamphlet yes I have, but nothing to follow after that.

http://stackoverflow.com/a/25570418
has comment: http://stackoverflow.com/comment/40000312
type: Answer
has comment: http://stackoverflow.com/comment/39936910
has comment: http://stackoverflow.com/comment/39935378
answers question: http://stackoverflow.com/q/25569415
has body: You can apply a filter to specific servlet. So apply it only to your servlet that handle your LoginAction, in this way it will only execute if the user login. In your web.xml just change filter path. Change your to the same path of your servlet. SessionFilter SessionFilter com.session.SessionFilter NewSessionFilter /your/path/LoginAction Or use rather than SessionFilter LoginAction Note you can also apply <ulr-pattern> to your jsp. /your/path/login.jsp
has comment: http://stackoverflow.com/comment/39935520
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25569415
upvote count: 1
has comment: http://stackoverflow.com/comment/40004002
has comment: http://stackoverflow.com/comment/39947648

http://stackoverflow.com/comment/39938123
type: AnswerComment
comment on: http://stackoverflow.com/a/25571583
type: Comment
has text: no since you are using the full path ...
score: 0

http://stackoverflow.com/comment/39911493
type: Comment
comment on: http://stackoverflow.com/q/25557774
score: 3
type: QuestionComment
has text: See also [*The Use of Multiple JFrames, Good/Bad Practice?*](http://stackoverflow.com/q/9554636/230513).

http://stackoverflow.com/comment/39904090
comment on: http://stackoverflow.com/a/25554342
type: Comment
has text: @LeoComia look at this. http://developer.android.com/training/implementing-navigation/lateral.html
type: AnswerComment
score: 0

http://stackoverflow.com/a/25601105
has comment: http://stackoverflow.com/comment/39991050
score: 0
answers question: http://stackoverflow.com/q/25601032
has comment: http://stackoverflow.com/comment/39990864
has comment: http://stackoverflow.com/comment/39990704
has body: target="_blank" is your answer ;) &lt;form name="pdf" method="get" target="_blank" action="http://localhost:8080/SendRedirectProg/sr"&gt; More information: http://www.w3schools.com/tags/att_form_target.asp There is also problem in your java code, you should use only one redirect, accordingly to passed value. if(s.equals("PDF 1")) { res.sendRedirect("http://localhost:8080/SendRedirectProg/DemoPDF1.pdf"); } if(s.equals("PDF 2")) { res.sendRedirect("http://localhost:8080/SendRedirectProg/DemoPDF2.pdf"); } if(s.equals("PDF 3")) { res.sendRedirect("http://localhost:8080/SendRedirectProg/DemoMCA 3.pdf"); }
type: Answer
has comment: http://stackoverflow.com/comment/39995421

http://stackoverflow.com/q/25656284
accepted answer: http://stackoverflow.com/a/25656766
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25656766
has title: The Image size saved on the disk is different than what is being displayed
has body: The code is being modified a bit . I added a button to the Jpanel whose action event save the image on the disk . Source Code package ImageResize; import java.awt.image.BufferedImage; import java.awt.*; import java.awt.event.*; import java.awt.image.RenderedImage; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import javax.swing.event.*; import javax.imageio.*; import java.io.*; import javax.imageio.stream.ImageOutputStream; import javax.imageio.plugins.jpeg.JPEGImageWriteParam; import java.util.Locale; import javax.swing.filechooser.FileNameExtensionFilter; class ImageCompressionDemo { private BufferedImage originalImage; private BufferedImage textImage; private JPanel gui; private JCheckBox antialiasing; private JCheckBox rendering; private JCheckBox fractionalMetrics; private JCheckBox strokeControl; private JCheckBox colorRendering; private JCheckBox dithering; private JComboBox textAntialiasing; private JComboBox textLcdContrast; private JLabel jpegLabel; private JLabel pngLabel; private JTextArea output; private JSlider quality; private JButton saveButton; private int pngSize; private int jpgSize; final static Object[] VALUES_TEXT_ANTIALIASING = { RenderingHints.VALUE_TEXT_ANTIALIAS_OFF, RenderingHints.VALUE_TEXT_ANTIALIAS_ON, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HBGR, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VBGR, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB }; final static Object[] VALUES_TEXT_LCD_CONTRAST = { new Integer(100), new Integer(150), new Integer(200), new Integer(250) }; ImageCompressionDemo(BufferedImage inputImage) { int width = 280; int height = 100; gui = new JPanel(new BorderLayout(3,4)); gui.setPreferredSize(new Dimension(400, 600)); quality = new JSlider(JSlider.VERTICAL, 0, 100, 50); quality.setSnapToTicks(true); quality.setPaintTicks(true); quality.setPaintLabels(true); quality.setMajorTickSpacing(10); quality…
tagged with: java
has comment: http://stackoverflow.com/comment/40091510
downvote count: 3
answer count: 1
has comment: http://stackoverflow.com/comment/40092432
tagged with: image-processing
has comment: http://stackoverflow.com/comment/40091788
upvote count: 1
linked to: http://stackoverflow.com/q/25608484
favorite count: 0
type: Question
score: -2
linked to: http://stackoverflow.com/q/19209650
tagged with: image

http://stackoverflow.com/comment/40007949
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25610566
has text: Would this work on a phrase with multiple spaces? (I like the simplicity of this though!)

junit
tags question: http://stackoverflow.com/q/25694715
type: Tag
tags question: http://stackoverflow.com/q/25628253
tags question: http://stackoverflow.com/q/25674733
tags question: http://stackoverflow.com/q/25669917
tags question: http://stackoverflow.com/q/25710184
tags question: http://stackoverflow.com/q/25662505
tags question: http://stackoverflow.com/q/25624161
tags question: http://stackoverflow.com/q/25697291
tags question: http://stackoverflow.com/q/25680974
tags question: http://stackoverflow.com/q/25650476
tags question: http://stackoverflow.com/q/25666409
tags question: http://stackoverflow.com/q/25564154
tags question: http://stackoverflow.com/q/25681115
tags question: http://stackoverflow.com/q/25564692
tags question: http://stackoverflow.com/q/25700510
tags question: http://stackoverflow.com/q/25706840
tags question: http://stackoverflow.com/q/25606198
tags question: http://stackoverflow.com/q/25606251
tags question: http://stackoverflow.com/q/25551108
tags question: http://stackoverflow.com/q/25568896
tags question: http://stackoverflow.com/q/25600796
tags question: http://stackoverflow.com/q/25634898
tags question: http://stackoverflow.com/q/25626220
tags question: http://stackoverflow.com/q/25589963
tags question: http://stackoverflow.com/q/25687215
tags question: http://stackoverflow.com/q/25645312
tag name: junit
tags question: http://stackoverflow.com/q/25642391
tags question: http://stackoverflow.com/q/25604215
tags question: http://stackoverflow.com/q/25624858
tags question: http://stackoverflow.com/q/25602336
tags question: http://stackoverflow.com/q/25700059
tags question: http://stackoverflow.com/q/25621946
tags question: http://stackoverflow.com/q/25574827

http://stackoverflow.com/comment/40157288
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25692701
has text: Or rather no, `0x` is not considered in the parsing. You have to remove it, then use the overloaded method. Also, I feel like your number is too big.

http://stackoverflow.com/comment/40167595
score: 1
type: QuestionComment
has text: 2^24 is 16,777,216. Some sort of arbitrary limit perhaps?
type: Comment
comment on: http://stackoverflow.com/q/25698164

http://stackoverflow.com/comment/40105977
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25664116
type: AnswerComment
has text: mhmm..still not working. Even Log.d prints out : yes . Maybe a bug?

http://stackoverflow.com/comment/40198671
type: AnswerComment
comment on: http://stackoverflow.com/a/25705034
score: 0
type: Comment
has text: Ben advised this was untested, so I took it as pseudo code to illustrate his concept.

http://stackoverflow.com/q/25598524
type: AnsweredQuestion
score: 0
answer count: 1
has title: Call variable from within overridden method but it may not have been initialized
has comment: http://stackoverflow.com/comment/39986209
type: Question
has body: Consider the following declarations: public final class MyClass { public MyClass(AnotherClass var) { /* implementation not shown */ } public void invoke() { /* implementation not shown */ } /* there may be more methods/properties listed */ } public class AnotherClass() { public AnotherClass() { /* implementation not shown */ } public void method() { /* implementation not shown */ } /* there may be more methods/properties listed */ } The implementations of both classes may not be changed. Now consider the following piece of code: final MyClass myVariable = new MyClass(anotherVariable); AnotherClass anotherVariable = new AnotherClass() { @Override public void method() { myVariable.invoke(); } }; Clearly it cannot be run because anotherVariable is not ready at the first line, but if I rearrange the two statements... AnotherClass anotherVariable = new AnotherClass() { @Override public void method() { myVariable.invoke(); } }; final MyClass myVariable = new MyClass(anotherVariable); Then, myVariable may not have been initialized, and it still doesn't work. How could I make this work? A real world example would be (from android): final MediaScannerConnection msc = new MediaScannerConnection(this, new MediaScannerConnection.MediaScannerConnectionClient() { @Override public void onScanCompleted(String path, Uri uri){ msc.disconnect(); } @Override public void onMediaScannerConnected() { msc.scanFile("", null); } }); msc.connect();
accepted answer: http://stackoverflow.com/a/25598603
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25598603

http://stackoverflow.com/q/25677950
has comment: http://stackoverflow.com/comment/40130169
tagged with: literals
has comment: http://stackoverflow.com/comment/40130177
has title: Number Literals in Java
type: Question
has body: When would an assignment not be an integer literal. I understand that int a = 5; is, but would int a = b + c; also be an integer literal. Thanks for your help.
has comment: http://stackoverflow.com/comment/40130160
accepted answer: http://stackoverflow.com/a/25678191
has answer: http://stackoverflow.com/a/25678191
has comment: http://stackoverflow.com/comment/40130164
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39969495
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25589538
has text: If you haven't posted the code, you can only do it.

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/25617461
tags question: http://stackoverflow.com/q/25664639
type: Tag

http://stackoverflow.com/q/25705478
tagged with: integer
type: AnsweredQuestion
has title: String.valueOf(Integer) always return 1
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25705508
tagged with: java
tagged with: string
has body: I'm trying to parse String "2 2 2" and add every symbol '2' in ArrayList. This is my code: charCounter = 0; rawSize = 0; while(charCounter &lt; line.length()){ a_char = line.charAt(charCounter); if(a_char != ' '){ System.out.print(String.valueOf(a_char)+" "); temp = Character.digit(a_char, 10); myIntArray.add(temp); System.out.println(String.valueOf(myIntArray.get(rawSize))); rawSize++; } charCounter++; } I can't understand why System.out.println(String.valueOf(myIntArray.get(rawSize)));always return 1 ? UPDDATE: I try read file, which contain next text: 1 1 1 2 2 2 3 3 3 Here is my Main function: public static void main(String[] args){ char a_char = ' '; int charCounter = 0; int temp = 0; String line = null; String file = "C:\\Users\\KUser\\Desktop\\SImpleIteration\\matrix.txt"; BufferedReader reader = null; ArrayList myIntArray = new ArrayList(); try { reader = new BufferedReader(new FileReader(file)); } catch(FileNotFoundException fnfe) { System.out.println(fnfe.getMessage()); } try { while ((line = reader.readLine()) != null) { charCounter = 0; rawSize = 0; while(charCounter &lt; line.length()){ a_char = line.charAt(charCounter); if(a_char != ' '){ System.out.print(String.valueOf(a_char)+" "); temp = Character.digit(a_char, 10); myIntArray.add(temp); System.out.println(String.valueOf(myIntArray.get(rawSize))); rawSize++; } charCounter++; } } } catch(IOException ioe) { System.out.println(ioe.getMessage()); } }; My output: 1 1 1 1 1 1 2 1 2 1 2 1 3 1 3 1 3 1 When i replace:a_char = line.charAt(charCounter); with a_char = '5';, my output: 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 Can't understand why so.
type: Question
possible better answer: http://stackoverflow.com/a/25705508
has comment: http://stackoverflow.com/comment/40190090
has answer: http://stackoverflow.com/a/25705515
accepted answer: http://stackoverflow.com/a/25705515
has comment: http://stackoverflow.com/comment/40180849

http://stackoverflow.com/comment/39929612
type: QuestionComment
has text: `seeds.add("104.131.40.xxx")` is this the ip of your zookeeper node ? kafka simple consumer does not require zookeeper to discover messages, the ip you are providing are supposed to be the ip of the node that kafka is running and not the zookeeper info
comment on: http://stackoverflow.com/q/25558174
score: 0
type: Comment

http://stackoverflow.com/q/25689107
tagged with: github
type: Question
has answer: http://stackoverflow.com/a/25689476
has comment: http://stackoverflow.com/comment/40150957
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40150320
has comment: http://stackoverflow.com/comment/40150773
tagged with: eclipse
has title: Inability to map Git Repository into a Java Project in Eclipse Juno with JDK 1.6?
has body: I am trying to add a project in my Eclipse that is forked from the Github. It is a starter code and this is the first time Iam working with Git. I am under the impression that the Git code will come into my Eclipse environment under some Folder structure. But I am not able to map the source code into my Local. Steps I have followed are the following :- * Created repository in Github. * Forked the project. * Setup username and user email from Git Shell application. * Cloned the repository in my Git Desktop application. * Using Team Command in Eclipse I tried adding project Share project, but the forked project that I want to be present there is not displaying. Pardon my inability to identify certain obvious infos. let me know if any info is missing and ill append the info here. Along with that here is the image of the package explorer. As you can see the newsindexer-1 is the project that I have downloaded from Github. But I was under the impression that when I run configuration the Runner.java or Tester.java I would be able to pass some arguments. But I cant. Plus when I go to properties I don't see any option of giving the Java Class Path et cetera.
score: 0
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25689476

http://stackoverflow.com/q/25680287
type: Question
tagged with: sbt
score: 0
has body: I have created bamdoo build wich checkouting git repository and started sbt build with tests. There are several sbt reposotories including one from local network. So bamboo build fails with strange message: [0m ::::::::::::::::::::::::::::::::::::::::::::::[0m [0m :: UNRESOLVED DEPENDENCIES ::[0m [0m ::::::::::::::::::::::::::::::::::::::::::::::[0m [0m :: org.jboss.logging#jboss-logging;${version.jboss.logging}: not found[0m In logs I see: Resolving org.jboss.logging#jboss-logging;3.1.1.GA So ${version.jboss.logging} was resolving correct. But further logs are frustrating for me: http://repo1.maven.org/maven2/org/jboss/logging/jboss-logging/${version.jboss.logging}/jboss-logging-${version.jboss.logging}.pom http://myRepo/repo/org/jboss/logging/jboss-logging/${version.jboss.logging}/jboss-logging-${version.jboss.logging}.pom Why sbt tries this URLs with ${version.jboss.logging} instead of 3.1.1.GA? Is it normal for sbt to log dependecies URL without resolving versions variables or not? How to resolve this? Important My Project do not depend on org.jboss.logging directly, it is a transitive dependency. On my local machine not on bamboo server this project compiles successfully without unresolved dependencies even if I delete whole local sbt repository. I have manually uploaded jars to the local network repository. And it did not help.
tagged with: java
has title: How to resolve dependencies in Bamboo build?
has comment: http://stackoverflow.com/comment/40135120
answer count: 0
tagged with: bamboo
tagged with: scala
has comment: http://stackoverflow.com/comment/40170532
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/51906302
has comment: http://stackoverflow.com/comment/40207897
tagged with: git

http://stackoverflow.com/a/25586564
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/39964259
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25586519
downvote count: 0
has comment: http://stackoverflow.com/comment/39964402
answers question: http://stackoverflow.com/q/25586519
has body: A for loop seems a bit cumbersome to me, why not just replace the multiplication by a shift? return num &lt;&lt; (n &lt;&lt; 2);

http://stackoverflow.com/comment/40076213
has text: Marc B is probably right, and I'm not a java guy, so what I would probably do is to check the permissions for `/home/kemallin/Desktop/capture-03.csv` and `/home/kemallin/Desktop/clean.sh`. Make sure the user running the java program have access to those files (a+rwx if you just want to discard a permissions problem... if it is, then you can work from there)
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25647806
type: Comment

http://stackoverflow.com/a/25685271
has body: try this &lt;c:forEach var="key" items="${map.keySet(}"&gt; &lt;tr&gt; &lt;td&gt;&lt;c:out value="${key}"&gt;&lt;/c:out&gt;&lt;/td&gt; &lt;td&gt;&lt;c:out value="${map.get(key)}"&gt;&lt;/c:out&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt;
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25685048

get
tags question: http://stackoverflow.com/q/25577852
tags question: http://stackoverflow.com/q/25634889
tags question: http://stackoverflow.com/q/25571977
type: Tag
tags question: http://stackoverflow.com/q/25652670
tag name: get
tags question: http://stackoverflow.com/q/25583122
tags question: http://stackoverflow.com/q/25678348
tags question: http://stackoverflow.com/q/25663396
tags question: http://stackoverflow.com/q/25551141

http://stackoverflow.com/comment/40058549
type: QuestionComment
comment on: http://stackoverflow.com/q/25586853
score: 0
has text: Ok, what does that tell us? To broad of a question. This has nothing to do with the original question any more. Here is my suggestion: check your write concern and the network latency.
type: Comment

http://stackoverflow.com/q/25617358
type: UnansweredQuestion
has body: How much is the overhead of creating following objects everytime sending the message to queue? Objects: javax.jms.Connection, javax.jms.Session, javax.jms.MessageProducer In my code, Whenever I want to send a message, I am creating above 3 objects. I know its good to create object only once and use it but the connection/session goes into IllegalState after Server Failover. My connectionFactory is able to reconnect but it is not able to refresh connection/session object. Can someone please explain me the overhead?
has answer: http://stackoverflow.com/a/25617743
linked to: http://stackoverflow.com/q/11840630
tagged with: tibco-ems
score: 0
answer count: 2
tagged with: java
tagged with: jms
has answer: http://stackoverflow.com/a/25617751
has title: JMS Connection Overhead
type: Question

http://stackoverflow.com/comment/106938128
has text: Please give some example of my own forEach. Do i need to override forEach from the collection?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25643503

http://stackoverflow.com/a/25586386
answers question: http://stackoverflow.com/q/25586265
upvote count: 2
has body: Making inner class Serializable will work and this is exactly that you are supposed to do if you want to serialize it together with the outer class. The following code demonstrates: public class Outer implements Serializable { class Inner implements Serializable { int value = 17; } Inner inner = new Inner(); public static void main(String[] args) throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); ObjectOutputStream oout = new ObjectOutputStream(out); Outer obj = new Outer(); obj.inner.value = 22; oout.writeObject(obj); Outer r = (Outer) new ObjectInputStream(new ByteArrayInputStream( out.toByteArray())).readObject(); System.out.println(r.inner.value); } } The output is 22, the value that has been correctly serialized and deserialized from the inner class field.
type: Answer
has comment: http://stackoverflow.com/comment/39963679
score: 2
downvote count: 0

http://stackoverflow.com/q/25712458
has body: While learning SRP and LSP, I'm trying to improve the design of my code to comply best with both of these principles. I have an employee class that has a calculatePay method on it. Firstly, I believe following OOP SOLID Principles, calculatePay() method should not be an employee objects responsibility. Common responsibilities of employees would be to performDuties(), takeLunchBreak(), clockIn() and clockOut() etc.. Am I right in thinking this way? That's why I feel calculatePay() should belong in some other class. Okay so that's my SRP insecurity. Coming to LSP: I have subclasses like accountants, salesman, and directors. These are all employees that get paid. How would I change this design to better support volunteers? Volunteers don't get paid. public class Employee { private String name; private int salary; private boolean topPerformer; private int bonusAmount; public Employee(String name, int salary, boolean topPerformer, int bonusAmount) { // set fields etc.. } // This method doesn't seem to belong here. public int calculatePay(){ if(topPerformer) return salary+bonusAmount; else{ return salary; } } }
has comment: http://stackoverflow.com/comment/40193692
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25713222
has answer: http://stackoverflow.com/a/25713515
tagged with: object-oriented-analysis
tagged with: java
has title: Liskov Substitution and SRP Principle violation - how best to structure this scenario?
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/40193650
type: Question
tagged with: c#
tagged with: oop
type: UnansweredQuestion

http://stackoverflow.com/comment/39929242
has text: @PhilippMurry My main question is (maybe it's a silly one): how to send back this info to the client side application?
type: Comment
comment on: http://stackoverflow.com/q/25567639
score: 0
type: QuestionComment

http://stackoverflow.com/q/25609143
favorite count: 0
tagged with: javax.imageio
linked to: http://stackoverflow.com/q/6129450
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25611309
accepted answer: http://stackoverflow.com/a/25611309
score: 1
tagged with: java
type: Question
has body: I am looking for a way to extract the images from thumbs.db file in java. I have tried using the method provided by another user here. The segment of his code i am having trouble with is JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(is); JPEGDecodeParam param = JPEGCodec.getDefaultJPEGEncodeParam(4,JPEGDecodeParam.COLOR_ID_RGBA); decoder.setJPEGDecodeParam(param); BufferedImage originalBufferedImage = decoder.decodeAsBufferedImage(); I am getting the error JPEGImageDecoder cannot be resolved as a type.
tagged with: thumbnails
has comment: http://stackoverflow.com/comment/40006169
has comment: http://stackoverflow.com/comment/40005635
has comment: http://stackoverflow.com/comment/40006235
downvote count: 0
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/40007130
has title: Thumbs.db image extraction Java

http://stackoverflow.com/comment/39986481
score: 0
type: AnswerComment
has text: Maybe you're meaning that this should be a comment
comment on: http://stackoverflow.com/a/25598857
type: Comment

http://stackoverflow.com/a/25636050
answers question: http://stackoverflow.com/q/25635940
score: 1
upvote count: 1
type: Answer
has body: I discovered I had white spaces in my project name. So I renamed with no spaces and it worked
downvote count: 0

http://stackoverflow.com/q/25703006
upvote count: 1
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/40176109
possible better answer: http://stackoverflow.com/a/25703084
accepted answer: http://stackoverflow.com/a/25703374
tagged with: performance
type: Question
has answer: http://stackoverflow.com/a/25703084
has answer: http://stackoverflow.com/a/25703120
has comment: http://stackoverflow.com/comment/40176041
has title: Error Memory VM java, java.lang.OutOfMemoryError: Java heap space
has comment: http://stackoverflow.com/comment/40177575
has comment: http://stackoverflow.com/comment/40176039
has comment: http://stackoverflow.com/comment/40183984
score: -1
type: AnsweredQuestion
has body: Friends I need your help, I have to handle a very large file with information (about the file weighs 30 Mb). When processing this information file, java gives me this error: Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2367) at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130) at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114) at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:535) at java.lang.StringBuffer.append(StringBuffer.java:322) at java.io.StringWriter.write(StringWriter.java:94) at java.io.Writer.write(Writer.java:127) at com.sun.org.apache.xml.internal.serialize.Printer.printText(Printer.java:170) ..... My code is: ... public Document generateXML(File file, String type) { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); Document document = docBuilder.newDocument(); Element rootElement = document.createElement("data"); document.appendChild(rootElement); Element informacionElement = document.createElement("information"); rootElement.appendChild(informacionElement); Element entityElement = document.createElement("entity"); entityElement.appendChild(document.createTextNode("ANYTHING")); informacionElement.appendChild(entityElement); Element entityCode = document.createElement("code"); entityCode.appendChild(document.createTextNode(0000)); informacionElement.appendChild(entityCode); Element fileElement = document.createElement("FILENAME"); fileElement.appendChild(document.createTextNode(file.getName())); informacionElement.appendChild(fileElement); Element detailElement = document.createElement("detail"); rootElement.appendChild(detailElement); Path path = Paths.get(file.getAbsolutePath()); Scanner tmpFile = new Scanner(path, StandardCharsets.UTF_8.name()); String[] tmpTags = keyXml.get(type); int row = 1; while (tmpFile.ha…
tagged with: java
has answer: http://stackoverflow.com/a/25703374
downvote count: 2
answer count: 3

http://stackoverflow.com/q/25710797
has title: Spring Security Oauth: migration from xml to annotations
accepted answer: http://stackoverflow.com/a/25746774
tagged with: java
tagged with: oauth-2.0
answer count: 1
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25746774
score: 1
tagged with: spring-security
favorite count: 0
type: Question
has body: I'm trying to migrate from xml to annotations. But I can't correctly configure endpoint /oauth/token - it doesn't accept my params for POST query. Request: curl -X POST -d "grant_type=password&amp;client_secret=secret&amp;client_id=testclient&amp;username=root&amp;password=password" http://localhost:8080/oauth/token Log: 2014-09-07 16:33:39 DEBUG AntPathRequestMatcher:145 - Checking match of request : '/oauth/token'; against '/oauth/token' 2014-09-07 16:33:39 DEBUG FilterSecurityInterceptor:194 - Secure object: FilterInvocation: URL: /oauth/token; Attributes: [fullyAuthenticated] 2014-09-07 16:33:39 DEBUG FilterSecurityInterceptor:310 - Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@9055e4a6: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS 2014-09-07 16:33:39 DEBUG AffirmativeBased:65 - Voter: org.springframework.security.web.access.expression.WebExpressionVoter@302753d0, returned: -1 2014-09-07 16:33:39 DEBUG ExceptionTranslationFilter:165 - Access is denied (user is anonymous); redirecting to authentication entry point org.springframework.security.access.AccessDeniedException: Access is denied at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:83) at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:206) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) XML (worked correctly) : &lt;http pattern="/oauth/token" creat…
tagged with: annotations
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/q/25562784
has title: Thread-safe update of shared object without performance penalty?
has answer: http://stackoverflow.com/a/25562984
has comment: http://stackoverflow.com/comment/39920564
accepted answer: http://stackoverflow.com/a/25562984
tagged with: java
has comment: http://stackoverflow.com/comment/39920163
has comment: http://stackoverflow.com/comment/39919534
has comment: http://stackoverflow.com/comment/39920855
has comment: http://stackoverflow.com/comment/39919612
has comment: http://stackoverflow.com/comment/39920977
tagged with: semaphore
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39920415
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/39921193
has comment: http://stackoverflow.com/comment/39920457
has comment: http://stackoverflow.com/comment/39919661
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39920515
answer count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/70689
has body: I'm struggling to wrap my head around making a thread-safe implementation of my class to be shared amongst Servlets or multiple 'clients' in the code. Pretend I have the following MySingleton class, a singleton that gets initialized with a Configuration object. However, the Configuration object can be observed, and so the singleton will subscribe to be notified if changes are made. Important key points: The configuration can change at any time (impossible to predict) When the configuration is parsed, its values are saved into member fields of MySingleton The singleton's public method uses those fields to generate a return result See simplified code below: public class MySingleton implements IConfigurationObserver { // Member(s) private static volatile MySingleton instance; private final Configuration configuration; private String firstParam; private String secondParam; // Constructor(s) private MySingleton(Configuration configuration) { this.configuration = configuration; parseConfiguration(); configuration.addObserver(this); } public static MySingleton getInstance(Configuration configuration) { // Perform synchronized creation if applicable (double locking technique) MySingleton syncInstance = instance; if (syncInstance == null) { synchronized(MySingleton.class) { syncInstance = instance; // Verify once again after synchronizing if(syncInstance == null) { syncInstance = new MySingleton(configuration); instance = syncInstance; } } } return syncInstance; } // Private Method(s) private void parseConfiguration() { // Import values from the configuration this.firstParam = configuration.get(0); this.secondParam = configuration.get(1); } // Public Method(s) public String buildSentence() { // Build a new string based on values pulled from the configuration StringBuilder strBuilder = new StringBuilder(); strBuilder.append(firstParam); strBuilder.append(" - "); strBuilder.append(secondParam); return strBuilder.toString(); } // Observer Method(s) @Override public void onConfi…
tagged with: synchronized
favorite count: 0
has comment: http://stackoverflow.com/comment/39919938
type: Question

http://stackoverflow.com/comment/39940030
type: Comment
comment on: http://stackoverflow.com/a/25572364
score: 0
has text: Hi mgaret, could you please tell me the exact syntax of how to refer the jar file of the war in MANIFEST file.
type: AnswerComment

http://stackoverflow.com/comment/40002465
type: AnswerComment
has text: -3. come on ..come on. I'l cheer up you guys. ha ha
type: Comment
comment on: http://stackoverflow.com/a/25607407
score: 0

http://stackoverflow.com/q/25567145
tagged with: java
has answer: http://stackoverflow.com/a/26495790
upvote count: 4
accepted answer: http://stackoverflow.com/a/25568218
favorite count: 0
type: Question
tagged with: netbeans
answer count: 2
has body: I'm trying to create a LDAP realm in Glassfish 4.0 (build 89) but every time I tried so far, the following error occurred: "Invalid property syntax, "=" in value: base-dn=\[...]" I tried using different browsers and reinstalled Glassfish in Netbeans. The strange thing is that a friend of mine could copy my base-dn and it worked. Thanks in advance!
possible better answer: http://stackoverflow.com/a/26495790
has title: Glassfish error while creating a LDAP realm: "Invalid property syntax, "=" in value
score: 4
tagged with: glassfish
has answer: http://stackoverflow.com/a/25568218
tagged with: ldap
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/25613137
downvote count: 0
answers question: http://stackoverflow.com/q/25612808
has body: Let's start with... private class Book { I would say declaring an inner class as private might not be the best choice, as you not be able to use beyond the scope of BookStore, but that's a choice you need to make... This... /** * @return the isbn */ public void getIsbn(int isbn) { return isbn; } is wrong on a number of accounts. First, it is declared as void, meaning that the method won't return anything, but then you use return isbn within the method. It should be declared as returning an int. Next, you pass isbn as a parameter to the method, but immediately return the same value, this isn't really what you want to do, you want to return the value of isbn defined by Book, for example... /** * @return the isbn */ public int getIsbn() { return isbn; } The same thing goes for getBookTitle. In some languages they pass parameters by reference, meaning you can actually alter the value in the method/function and that will be reflected in the callers context. Java doesn't do this (more accurately, you can't reassign the value within the method and have it reflected in the caller). This is tripping point for many developers. Basically, this means you can't do something like... public void getBookTitle(String bookTitle) { bookTitle = this.bookTitle; } As the value of the parameter will the same in the callers context after the method call as it was before it. You have to "get" the value from the class. An interesting side effect though, is you can change the properties of objects passed to a method, if they supply mutable functionality...
type: Answer
accepted answer of: http://stackoverflow.com/q/25612808
has comment: http://stackoverflow.com/comment/40012566
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/40046489
type: QuestionComment
comment on: http://stackoverflow.com/q/25623605
has text: If you look at the artifact in the "Project Structure", there is an entry for "Main Class".
type: Comment
score: 0

http://stackoverflow.com/comment/39944686
has text: Perhaps mention wildcards?
comment on: http://stackoverflow.com/a/25575865
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39952341
type: Comment
comment on: http://stackoverflow.com/q/25579987
type: QuestionComment
has text: Can you provide us with the full stacktrace plz?
score: 0

http://stackoverflow.com/a/25671278
score: 3
has comment: http://stackoverflow.com/comment/40117984
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25671262
downvote count: 0
answers question: http://stackoverflow.com/q/25671262
has body: it overrides classpath so again you will have to add current directory to classpath java -classpath abc.jar:. Abc
has comment: http://stackoverflow.com/comment/40117949
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/36760664
answers question: http://stackoverflow.com/q/25598382
has comment: http://stackoverflow.com/comment/61210488
type: Answer
has body: use below code to initialize ffmpeg ffmpegController = new FfmpegController(MainActivity.this, getTempDirectory());
score: 0

http://stackoverflow.com/comment/39967450
score: 1
type: Comment
type: QuestionComment
has text: Note that in the above code A is the subclass, B is the superclass -- contrary to your title.
comment on: http://stackoverflow.com/q/25588310

http://stackoverflow.com/comment/40149026
comment on: http://stackoverflow.com/q/25687229
type: Comment
type: QuestionComment
has text: Yes, there is a main method in the class. There are other JARs on the classpath, the single JAR file in question is shown for brevity only.
score: 0

memory-management
tags question: http://stackoverflow.com/q/25607390
tags question: http://stackoverflow.com/q/25574899
type: Tag
tags question: http://stackoverflow.com/q/25630228
tags question: http://stackoverflow.com/q/25679546
tag name: memory-management

http://stackoverflow.com/comment/40073472
score: 0
comment on: http://stackoverflow.com/q/25646440
type: Comment
type: QuestionComment
has text: I am inside an Adapter

http://stackoverflow.com/q/25556132
tagged with: java
tagged with: email
has answer: http://stackoverflow.com/a/25556646
has comment: http://stackoverflow.com/comment/39907273
tagged with: string
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39910664
has title: Java regex for removing all characters except a pattern
type: Question
has comment: http://stackoverflow.com/comment/39907394
has comment: http://stackoverflow.com/comment/39907951
has answer: http://stackoverflow.com/a/25556854
accepted answer: http://stackoverflow.com/a/25556854
upvote count: 2
has comment: http://stackoverflow.com/comment/39907696
tagged with: regex
has answer: http://stackoverflow.com/a/25556456
possible better answer: http://stackoverflow.com/a/25556456
has comment: http://stackoverflow.com/comment/39907149
has body: I have a string including e-mail. There are probably extra characters before and / or after it. input examples: a1@b.com a2@b.com abcd efg x y z a3@b.com p q a4@b.com x z asd[x5@c.net]gh I want to remove the extra characters. Desired outputs: a1@b.com a2@b.com a3@b.com a4@b.com x5@c.net Valid characters are a-zA-Z0-9._ So there are probably invalid characters before and / or after e-mail. I tried this code to identify whether it is a correct email or not (this assumes that it is separated from extra characters by space), but I can not replace to the desired string (using s.replaceAll()): if (s.matches("(?i).*\\s[a-zA-Z_\\.]+@[a-zA-Z_\\.]+\\.[a-zA-Z_\\.]+.*") || fields[2].matches("(?i).*[a-zA-Z_\\.]+@[a-zA-Z_\\.]+\\.[a-zA-Z_\\.]+\\s.*"))
has comment: http://stackoverflow.com/comment/39907165
linked to: http://stackoverflow.com/q/201323
type: AnsweredQuestion
answer count: 3
score: 1

http://stackoverflow.com/a/25648025
type: Answer
answers question: http://stackoverflow.com/q/25647381
has body: Yes, that is for sure. unfortunately wsimport is not encoding your curly braces simbols (%7B for { and %7D for } ). I guess it's a bug. The path should look like /apps/buildeng/workspace/workspace/Blah/Blah/Business%20Blah%7BPR102483%7D/BLAGHASFASD/BLALALALALALALAL-Web-Service-Build/src/main/wsdl/mywsdl.wsdl Can you try to use global path instead of relative to check if this is the problem?
score: 0

http://stackoverflow.com/a/25676359
answers question: http://stackoverflow.com/q/25676333
score: 0
type: Answer
has body: You must have forgotten to add the database driver to the CLASSPATH. If you are under Eclipse, go to the Build path menu and add your driver, otherwise refer to the billion posts on the internet that explain how to add a class to the CLASSPATH for any system.

http://stackoverflow.com/comment/39988827
type: QuestionComment
has text: @LuiggiMendoza: Whoops, I guess I mixed the two up.
comment on: http://stackoverflow.com/q/25599991
score: 0
type: Comment

http://stackoverflow.com/comment/93104744
score: 0
has text: This worked for me. Can you explain what exactly it does.
type: Comment
comment on: http://stackoverflow.com/a/35894627
type: AnswerComment

http://stackoverflow.com/comment/40179401
type: Comment
score: 1
has text: Thanks for the note on immutability. I wasn't paying attention to the fact that this issue only arises when the mutability-question is answered with yes.
comment on: http://stackoverflow.com/a/25704382
type: AnswerComment

http://stackoverflow.com/a/25639423
has comment: http://stackoverflow.com/comment/40061085
score: 0
answers question: http://stackoverflow.com/q/25639173
type: Answer
has body: You are doing in wrong way. You are creating an instance of Position class in both Activity and Fragment. Try to create an method inside Fragment which will receive position object which you have been set inside activity like below: Your activity onClick @Override public void onClick(View v) { Positions pos = new Positions(); pos.setLIpos(LoginB.getY()); pos.setRIpos(RegisterB.getY()); FragmentTransaction transaction = fmanager.beginTransaction(); switch (v.getId()) { case R.id.login_button: transaction.add(R.id.Parent, login, "Loginf"); transaction.addToBackStack("Login"); login.setImagePosition(pos); break; case R.id.Reg_button: transaction.add(R.id.Parent, register, "registerf"); transaction.addToBackStack("registerf"); register.setImagePosition(pos); break; default: break; } transaction.commit(); // TODO Auto-generated method stub } Your Fragment class Login extends Fragment implements OnGlobalLayoutListener { EditText UN, Pass; View loginimage, loginusing, loginlayout; // Login_Register Lg=new Login_Register(); @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View login = inflater.inflate(R.layout.login, container, false); // TODO Auto-generated method stub UN = (EditText) login.findViewById(R.id.UsernameL); Pass = (EditText) login.findViewById(R.id.PassswordL); loginimage = login.findViewById(R.id.LoginImage); loginusing = login.findViewById(R.id.loginusing); loginlayout = login.findViewById(R.id.LoginLayout); loginimage.getViewTreeObserver().addOnGlobalLayoutListener(this); UN.getBackground().setAlpha(50); Pass.getBackground().setAlpha(50); ObjectAnimator.ofFloat(loginusing, View.ALPHA, 0,1).setDuration(1000).start(); return login; } public void setImagePosition(Positions pos){ Positions poss=pos; float f=poss.getLIpos(); } }

http://stackoverflow.com/q/25673755
has body: I am trying to learn hyperjaxb3, so I downloaded the zip file containing the maven project for the purchase order tutorial for hibernate and maven from this link, and then imported it into eclipse as a new maven project. But I am getting the following error message in the pom.xml: Plugin execution not covered by lifecycle configuration: org.jvnet.hyperjaxb3:maven-hyperjaxb3-plugin:0.5.6:generate (execution: default, phase: generate-sources) I tried to resolve this error message by adding the following dependency to the pom.xml, which I found at this link: org.apache.maven.plugins maven-jar-plugin 2.3.2 But I am still getting the same error. There is no stack trace because I have not tried to compile the program. It is a compile error message that eclipse gives in the pom. How can I resolve this error? The complete pom.xml can be viewed by clicking on this link.
answer count: 1
tagged with: maven
accepted answer: http://stackoverflow.com/a/25676081
type: Question
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25676081
tagged with: eclipse
tagged with: m2eclipse
type: AnsweredQuestion
has title: maven jar plugin cannot be resolved
score: 0

http://stackoverflow.com/comment/40065982
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25640526
type: AnswerComment
has text: not working for me. there are a few differences between our scenarios: 1 I used ubuntu for both the host and the client 2 I used mysql server 5.6, 3 I used maven 3.1.0 and maybe 4 I used java 8. thx all the same!

http://stackoverflow.com/q/25574554
tagged with: proxy
duplicate of: http://stackoverflow.com/q/9852056
type: UnansweredQuestion
has title: Jetty ProxyServlet: how to add HTTPS support?
tagged with: jetty
tagged with: ssl
score: 4
upvote count: 4
tagged with: groovy
answer count: 0
tagged with: java
downvote count: 0
has body: I made a simple proxy server using the Jetty ProxyServlet. It works for http protocol. Below is my code (in groovy): MyProxyServlet class MyProxyServlet extends ProxyServlet { static final Logger logger = LoggerFactory.getLogger( this ) @Override void init( ServletConfig config ) throws ServletException { super.init( config ) logger.info('>>> init done!') } @Override void service( HttpServletRequest request, HttpServletResponse response ) { logger.info('>>> got a request') super.service( request, response) response.addHeader('foo', 'bar') } } web.xml MyProxyServlet com.foobar.MyProxyServlet 1 true MyProxyServlet /* The code is wrapped into a war, root.war, and deployed into a Jetty server on my Mac with port 8080. Then I enabled Web Proxy (HTTP) and Secure Web Proxy (HTTPS) in the System Preferences of my Mac. As aforementioned, it works for http. However, for HTTPS, it doesn't work. So, how can I make it work with HTTPS? BTW, according to this example (Jetty ProxyServlet with SSL support), it seems that I need to add a ConnectHandler, but I don't know how to achieve this in web.xml. Thank you very much.
has comment: http://stackoverflow.com/comment/40033774
linked to: http://stackoverflow.com/q/9852056
favorite count: 0
type: Question

http://stackoverflow.com/comment/39995817
type: AnswerComment
has text: you can try with global variable. In activity state you want to store array list? i think that can't be. you can read activity life cycle .http://developer.android.com/reference/android/app/Activity.html
comment on: http://stackoverflow.com/a/25602755
type: Comment
score: 0

http://stackoverflow.com/comment/40035389
type: Comment
score: 4
type: QuestionComment
has text: Thread main loop use an async API... so it runs at full speed and should create a lot of async task?
comment on: http://stackoverflow.com/q/25625569

http://stackoverflow.com/comment/40052918
comment on: http://stackoverflow.com/q/25634983
type: QuestionComment
has text: Better start using `PreparedStatement` or I'll introduce you to my friend [bobby tables](http://xkcd.com/327/)
score: 4
type: Comment

http://stackoverflow.com/q/25656710
has comment: http://stackoverflow.com/comment/40092483
tagged with: highcharts
tagged with: arrays
answer count: 1
tagged with: javascript
has title: Add array data in HighChart android
has comment: http://stackoverflow.com/comment/40092552
has comment: http://stackoverflow.com/comment/40092601
type: Question
has comment: http://stackoverflow.com/comment/40092759
tagged with: android
tagged with: java
has body: Im having a bit trouble with loading array/data from my android/java code to highchart/html code. It is working fine when I will put the data in static: series: [{ name:'Fruit', data: [{name:"Test 1",y:10}, {name:"Test 2",y:20}, {name:"Test 3",y:30},]}] But when I will try to add it from my java code: //graph_webview_test is my webview and add the GraphWebInterface() as javascript graph_webview_test.addJavascriptInterface(new GraphWebInterface(), "Android"); //a method of GraphWebInterface @JavascriptInterface public String getStringTickets(){ String temp=""; for(int x=0;x&lt;graphTicketArrayList.size();x++){ temp= temp+"{name:"+"\""+graphTicketArrayList.get(x).getLabel()+"\""+",y:"+graphTicketArrayList.get(x).getTotal()+"},"; } return temp; } //i tried to print the result(Sample_graph.html) console.log(Android.getStringTickets()); result: "{name:"Test 1",y:10},{name:"Test 2",y:20},{name:"Test 3",y:30}", and call the method to load data. series: [{ name:'Fruit', data: [Android.getStringTickets()] }] but the highChart is displaying 0 data and a label (slice) What is the best approach of loading array in highchart. Thanks Guys,
has answer: http://stackoverflow.com/a/25656983
accepted answer: http://stackoverflow.com/a/25656983
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/40139308
type: Comment
type: QuestionComment
score: 0
has text: this must have something to do with this piece of Your code: items.get(3*position). What´s Your intention for this?
comment on: http://stackoverflow.com/q/25683055

http://stackoverflow.com/comment/40148234
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25688084
has text: What is difference between `ParentClass p=new ChildClass();` and `ChildClass p=new ChildClass();`
type: Comment

http://stackoverflow.com/q/25600575
possible better answer: http://stackoverflow.com/a/25600615
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39989679
score: 0
answer count: 3
upvote count: 2
has comment: http://stackoverflow.com/comment/39990127
tagged with: java
downvote count: 2
has title: Explanation of java instance
has body: Can anyone tell me what does this thing do? Also if anyone can give an example if would be helpful. public class ConnectionManager{ private static ConnectionManager instance = null; .....} Here is the complete code: package com.gollahalli.main; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class ConnectionManager { private static ConnectionManager instance = null; private final String USERNAME = "root"; private final String PASSWORD = "root"; private final String H_CONN_STRING = "jdbc:hsqldb:data/explorecalifornia"; private final String M_CONN_STRING = "jdbc:mysql://localhost/explorecalifornia"; private DBType dbType = DBType.MYSQL; private Connection conn = null; private ConnectionManager() { } public static ConnectionManager getInstance() { if (instance == null) { instance = new ConnectionManager(); } return instance; } public void setDBType(DBType dbType) { this.dbType = dbType; } private boolean openConnection() { try { switch (dbType) { case MYSQL: conn = DriverManager.getConnection(M_CONN_STRING, USERNAME, PASSWORD); return true; case HSQLDB: conn = DriverManager.getConnection(H_CONN_STRING, USERNAME, PASSWORD); return true; default: return false; } } catch (SQLException e) { System.err.println(e); return false; } } public Connection getConnection() { if (conn == null) { if (openConnection()) { System.out.println("Connection opened"); return conn; } else { return null; } } return conn; } public void close() { System.out.println("Closing connection"); try { conn.close(); conn = null; } catch (Exception e) { } } }
favorite count: 0
accepted answer: http://stackoverflow.com/a/25600742
type: Question
has comment: http://stackoverflow.com/comment/39990013
has answer: http://stackoverflow.com/a/25600742
has answer: http://stackoverflow.com/a/25600615
has comment: http://stackoverflow.com/comment/39990059
has comment: http://stackoverflow.com/comment/39990700
has comment: http://stackoverflow.com/comment/39989725
has comment: http://stackoverflow.com/comment/39994766
has answer: http://stackoverflow.com/a/25600748

http://stackoverflow.com/comment/39953830
type: QuestionComment
comment on: http://stackoverflow.com/q/25580593
has text: I expected that generated json object from MoveToSend will be sent to the server and than server will parse received object to MoveToSend object. But: client connects to server and that's all...
score: 0
type: Comment

http://stackoverflow.com/comment/40098004
score: 0
comment on: http://stackoverflow.com/q/25659876
type: QuestionComment
type: Comment
has text: It is there in my project. Inside the WebContent folder.

http://stackoverflow.com/comment/39949325
type: Comment
has text: just split the string using the regex ` +`
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25578325

http://stackoverflow.com/a/59453276
type: Answer
has comment: http://stackoverflow.com/comment/120676238
has comment: http://stackoverflow.com/comment/120635342
has body: This question is 5+ years old by now (2019) and i hope you have found what you are looking for. but i would still post an answer. this may not only cover your question but also described multi-threading behavior in brief. first of all. the singleton is a design pattern used in programming, which is used to create only one single instance for the entire application (only one for the JVM. as i hope there is only one JVM in your app). multi threading is a processing mechanism. it executes tasks concurrently. i think you are confused because a you've already know that a thread is a logical processing location. and an object is a memory instance. but you did not understand how multi-threading actually works under the hood. as for your question, i will explain this by with spring framework. so when a user send a request to the server, the server dedicate a separate thread for each request. and in spring, the beans are singleton by default. so the first request begins to execute a method of your singleton bean, and before it is finished, an another request comes and it executes the same method by using another thread. so what's happening here is that the second thread will not wait the first one to be finished executing the entire method. they executes concurrently, it means the first request will run the first line of the method and then the second thread begins to run the first line. and maybe second line also. Do note that while the first thread executes the first line, the second thread cannot execute the same line and while the second executes the first line and second line, the first cannot execute the second line until the second thread is finished the second line. even though we call this concurrent execution, it does not execute concurrently at all. (one line is executed by only one thread at same time) according to your question, you are defined two methods in the bean, so they are separate methods. so two threads requesting the two methods at the same time will …
answers question: http://stackoverflow.com/q/25617962
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/121290789

http://stackoverflow.com/comment/39965753
comment on: http://stackoverflow.com/q/25587090
has text: I run you code, passing the `cle.getEncoded()` value to the `DecryptCipherAES` (I combined the code) and it works fine. You need to "unhex" the key `String` back to a `byte[]` manually, I don't think you can simply rely on using `String#getBytes`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25653921
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/40201515
upvote count: 1
answers question: http://stackoverflow.com/q/25597215
downvote count: 1
has body: Try changing PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(logFile, true))); to FileWriter fileWritter = new FileWriter(logFile,true); //true = append file BufferedWriter bufferWritter = new BufferedWriter(fileWritter); bufferWritter.write(YourData); bufferWritter.close();
has comment: http://stackoverflow.com/comment/40091926
has comment: http://stackoverflow.com/comment/40088532

http://stackoverflow.com/q/25552874
has comment: http://stackoverflow.com/comment/39900896
tagged with: android-intent
has comment: http://stackoverflow.com/comment/39911458
has comment: http://stackoverflow.com/comment/39911277
has body: I have an Intent to share a image from an view. It works, but once I canceled it to upload it on Instagram and I received an exception. Google didn't help... Intent if(!getStringName().equals(" ")) {//check if it is usefull LinearLayout table=(LinearLayout) findViewById(R.id.table_linear); table.setDrawingCacheEnabled(true); Bitmap bitmap = table.getDrawingCache(); String imagepath=saveBitmap(bitmap); //sv.setDrawingCacheEnabled(false); Intent shareImage=new Intent(); shareImage.setAction(Intent.ACTION_SEND); shareImage.setType("image/png"); shareImage.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name)); shareImage.putExtra(Intent.EXTRA_TEXT, getStringName()); shareImage.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(imagepath))); startActivity(shareImage); //new RalaAlertToast(context, getString(R.string.share_success), false); }else { //show message, that it's not useful } Stack Trace java.lang.RuntimeException: Unable to start activity ComponentInfo{at.ralaweb.ralaprogramme.subnetztabelle/at.ralaweb.ralaprogramme.subnetztabelle.ActivityMain}: java.lang.RuntimeException: Parcel android.os.Parcel@41f7d760: Unmarshalling unknown type code 2131558402 at offset 200 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2227) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2276) at android.app.ActivityThread.access$800(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5146) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132) at dalvik.system.NativeStart.…
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39940937
tagged with: parcel
has comment: http://stackoverflow.com/comment/39911427
type: Question
score: 0
has comment: http://stackoverflow.com/comment/39901001
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39901881
has title: Activity crashes because of Intent with ACTION_SEND
has comment: http://stackoverflow.com/comment/39901549

http://stackoverflow.com/a/77825476
answers question: http://stackoverflow.com/q/25642585
score: 0
type: Answer
has body: try this using reflection import java.lang.reflect.Field; import java.util.Arrays; import java.util.Objects; public class ObjectsUtils { public static boolean allNull(Object target) { return Arrays.stream(target.getClass() .getDeclaredFields()) .peek(f -&gt; f.setAccessible(true)) .map(f -&gt; getFieldValue(f, target)) .allMatch(Objects::isNull); } private static Object getFieldValue(Field field, Object target) { try { return field.get(target); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } }

http://stackoverflow.com/q/25603402
has comment: http://stackoverflow.com/comment/39999379
has comment: http://stackoverflow.com/comment/39999176
has body: I am trying to follow a guide explaining how to do resource filtering. I have a hibernate properties file which now has the following properties; ${hibernate.connection.url} ${hibernate.connection.username} ${hibernate.connection.password} and my maven pom has the following profiles; DEV <hibernate.connection.url>devurl:port</hibernate.connection.url> <hibernate.connection.username>user</hibernate.connection.username> <hibernate.connection.password>password</hibernate.connection.password> PROD <hibernate.connection.url>produrl</hibernate.connection.url> <hibernate.connection.username>user</hibernate.connection.username> <hibernate.connection.password>pass</hibernate.connection.password> My maven build url in jenkins looked as follows before the changes; clean package org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.failure.ignore=true And I have modified this too look as follows; clean package -P DEV org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.failure.ignore=true It seems as though I have followed everything in the guide so something I have done above must be incorrect because when i do a build i am getting a mass of errors such as java.lang.UnsupportedOperationException: The application must supply JDBC connections. Is anyone able to see what I have done wrong? Thanks
has comment: http://stackoverflow.com/comment/39998549
has answer: http://stackoverflow.com/a/25603580
tagged with: jenkins
linked to: http://stackoverflow.com/q/25604969
type: UnansweredQuestion
answer count: 1
tagged with: maven
type: Question
has comment: http://stackoverflow.com/comment/39995102
score: 0
has title: How to do simple resource filtering in maven?
has comment: http://stackoverflow.com/comment/39999353
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/40081671
comment on: http://stackoverflow.com/a/25635628
score: 0
has text: Yes I have a timeout value for `future.get` but no timeout for `http request` as I am using the default way of executing the url. That might be a good point regarding timeout for future vs http timeout. Not sure what is the default timeout for http request. I have updated the question to give you the better understanding of the code flow just to make sure you have understand correctly what I was saying earlier. You can go through and see whether you understand exactly as I said? Thanks for the help..
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25599468
type: Question
tagged with: jakarta-ee
upvote count: 2
tagged with: ejb
has body: I have a situation to integrate two independent systems. One is using J2EE,EJBs and other is Spring based. Now the problem is both the systems can call methods of each other and i want to manage transactions as well. I am not sure how to coordinate both applications transaction managers as both are using different one (Spring and EJB). Any one has an idea how to do this ?
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25605156
tagged with: spring
favorite count: 0
has answer: http://stackoverflow.com/a/25605156
score: 2
type: AnsweredQuestion
tagged with: transactions
tagged with: java
has title: How to manage Distributed transaction using spring and J2EE (EJB) CMT

http://stackoverflow.com/q/25683942
tagged with: android-studio
has comment: http://stackoverflow.com/comment/40140842
answer count: 2
has title: Android Calendar Layout
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25700961
tagged with: calendar
has comment: http://stackoverflow.com/comment/40141026
favorite count: 0
type: Question
has body: My calendar layout looks something like this: A B C D E F G A B C D E F G A B C D E F G A B C D I would like to make it that the first day of the calendar to start, for example, from the forth element's position (this implementation should be available only for the first row of the calendar) like this: blank A B C D A B C D E F A B C D E F A B C D E F I have a GridView for this, which is is using a RelativeLayout with a Button in it that has as a background another layout, that shouldn't be relevant right now. Any advice...? Thanks :)
has comment: http://stackoverflow.com/comment/40172767
has answer: http://stackoverflow.com/a/25684701
tagged with: android-layout
has comment: http://stackoverflow.com/comment/40140912
has comment: http://stackoverflow.com/comment/40151020
score: 1
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/40140935

http://stackoverflow.com/a/25594117
accepted answer of: http://stackoverflow.com/q/25594101
answers question: http://stackoverflow.com/q/25594101
has body: Use the append function instead of settext
has comment: http://stackoverflow.com/comment/39977840
type: AcceptedAnswer
score: 1
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40161681
type: Comment
type: QuestionComment
has text: Well if this could be called in a method: `Area a;a.clone();`. Would be 17 Characters. (java.awt.geom.Area)
comment on: http://stackoverflow.com/q/25694872
score: 0

http://stackoverflow.com/comment/39990661
comment on: http://stackoverflow.com/q/25599998
score: 0
type: Comment
type: QuestionComment
has text: findViewById inside the if condition if (convertView == null) giving null pointer

http://stackoverflow.com/comment/40175611
has text: Is `clip.start()` supposed to block until playback is finished?
score: 0
comment on: http://stackoverflow.com/q/25702200
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25660909
type: Question
tagged with: testing
accepted answer: http://stackoverflow.com/a/25660949
has answer: http://stackoverflow.com/a/25660949
type: AnsweredQuestion
tagged with: boolean
score: 0
has body: public boolean checkRemoveButtonAvailability() { List&lt;WebElement&gt; buttonsOnPage = findAll(BUTTONS); for (WebElement button : buttonsOnPage) { String buttonText = button.getText(); if (buttonText.equals("Remove")) { return true; } else { return false; } } return true; } @Test public void removeButtonHasBeenCleared() { ....... assertFalse(userSearchPage.checkRemoveButtonAvailability()); } I use the above method checkRemoveButtonAvailability() in my test, and the result of the test is always passed, although during the tests I check if Remove Button is available or not. Also if I delete the last return type return true, the IDE tells me that a return type must be added. Any suggestions? Thank you
tagged with: java
has title: Java - Selenium - Boolean method always returns false
answer count: 1
tagged with: selenium
tagged with: webdriver

http://stackoverflow.com/comment/40133009
comment on: http://stackoverflow.com/a/25679548
score: 0
has text: A small note - OP wants to append, rather than replace, the spaces.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/46880849
type: Comment
type: AnswerComment
has text: @malte You're right. In this case it should be `minimumNumberShouldMatch` with an `int`, or `minimumShouldMatch` with a `string`. Corrected.
score: 0
comment on: http://stackoverflow.com/a/25552608

http://stackoverflow.com/a/25613713
type: AcceptedAnswer
has body: In your MainActivity on button click you do: @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this, Orange.class); startActivity(intent); finish(); } You start Orange activity and finish MainActivity. When you exit from Orange, there's nowhere to return, thus the application is closed
accepted answer of: http://stackoverflow.com/q/25613642
type: Answer
has comment: http://stackoverflow.com/comment/40013658
answers question: http://stackoverflow.com/q/25613642
upvote count: 3
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40014034

http://stackoverflow.com/q/25564287
has answer: http://stackoverflow.com/a/25564624
answer count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25564624
tagged with: gwt
has body: I'm trying to fetch a JSON string to an object array in GWT. My JSON string is here: https://api.guildwars2.com/v1/wvw/matches.json {"wvw_matches":[{"wvw_match_id":"2-6","red_world_id":2102,"blue_world_id":2105,"green_world_id":2205,"start_time":"2014-08-22T18:00:00Z","end_time":"2014-08-29T18:00:00Z"}, {"wvw_match_id":"1-2","red_world_id":1005,"blue_world_id":1009,"green_world_id":1016,"start_time":"2014-08-23T01:00:00Z","end_time":"2014-08-30T01:00:00Z"}, {"wvw_match_id":"1-6","red_world_id":1022,"blue_world_id":1012,"green_world_id":1018,"start_time":"2014-08-23T01:00:00Z","end_time":"2014-08-30T01:00:00Z"}, {"wvw_match_id":"2-4","red_world_id":2101,"blue_world_id":2014,"green_world_id":2204,"start_time":"2014-08-22T18:00:00Z","end_time":"2014-08-29T18:00:00Z"}, {"wvw_match_id":"2-9","red_world_id":2011,"blue_world_id":2008,"green_world_id":2006,"start_time":"2014-08-22T18:00:00Z","end_time":"2014-08-29T18:00:00Z"}, {"wvw_match_id":"1-5","red_world_id":1007,"blue_world_id":1002,"green_world_id":1004,"start_time":"2014-08-23T01:00:00Z","end_time":"2014-08-30T01:00:00Z"}, {"wvw_match_id":"2-3","red_world_id":2103,"blue_world_id":2012,"green_world_id":2003,"start_time":"2014-08-22T18:00:00Z","end_time":"2014-08-29T18:00:00Z"}, {"wvw_match_id":"2-1","red_world_id":2202,"blue_world_id":2002,"green_world_id":2010,"start_time":"2014-08-22T18:00:00Z","end_time":"2014-08-29T18:00:00Z"}, {"wvw_match_id":"1-1","red_world_id":1019,"blue_world_id":1017,"green_world_id":1008,"start_time":"2014-08-23T01:00:00Z","end_time":"2014-08-30T01:00:00Z"}, {"wvw_match_id":"2-5","red_world_id":2104,"blue_world_id":2301,"green_world_id":2013,"start_time":"2014-08-22T18:00:00Z","end_time":"2014-08-29T18:00:00Z"}, {"wvw_match_id":"2-8","red_world_id":2004,"blue_world_id":2001,"green_world_id":2009,"start_time":"2014-08-22T18:00:00Z","end_time":"2014-08-29T18:00:00Z"}, {"wvw_match_id":"2-7","red_world_id":2005,"blue_world_id":2207,"green_world_id":2206,"start_time":"2014-08-22T18:00:00Z","end…
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Json String to Array
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39997518
has text: @AK2 If you see the messages should too see this message.**see update in my answer**
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25604534
type: Comment

http://stackoverflow.com/comment/40057125
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25637236
has text: @Richie Ah, sorry. In any case, if the JSON is only meant for the plugin, pretty printing is not necessary. For your debugging purposes, consider using a tool like [jsonlint](http://www.jsonlint.com).
type: AnswerComment

http://stackoverflow.com/comment/39977551
has text: I tried that cup.obj model with a loader I wrote recently. It mostly looks fine. There's a small hole at the bottom of the handle, and some artifacts on the inside of the bottom part. I don't see anything obviously wrong with the code you posted. Can you show the `ObjFace` class, particularly the constructor?
type: QuestionComment
comment on: http://stackoverflow.com/q/25586854
score: 0
type: Comment

http://stackoverflow.com/comment/40550407
comment on: http://stackoverflow.com/a/25890810
type: Comment
type: AnswerComment
has text: It could be a Java version problem, I edited my answer.
score: 0

http://stackoverflow.com/comment/40002412
has text: Doesn't code normally run from top to bottom? If you swap the order of two statements don't they change the order they are run? Where is the surprise here?
score: 0
comment on: http://stackoverflow.com/q/25607390
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25670028
tagged with: listview
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
upvote count: 0
possible better answer: http://stackoverflow.com/a/25670133
accepted answer: http://stackoverflow.com/a/25670316
has answer: http://stackoverflow.com/a/25670133
has answer: http://stackoverflow.com/a/25670304
downvote count: 1
has answer: http://stackoverflow.com/a/25670316
has title: ListView values are all shown false (in Android)
type: AnsweredQuestion
tagged with: android-layout
answer count: 3
tagged with: android
tagged with: java
score: -1
has body: I have three textview in rowlayout.xml. However when I run my app all the values except rating is shown as false. rowlayout.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ImageView android:id="@+id/icon" android:layout_width="44dp" android:layout_height="44dp" android:layout_marginLeft="4dp" android:layout_marginRight="10dp" android:layout_marginTop="4dp" android:src="@drawable/ic_launcher" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/rating" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_marginLeft="4dp" android:layout_marginRight="10dp" android:layout_marginTop="4dp" android:text="@+id/rating" /&gt; &lt;TextView android:id="@+id/distance" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_toLeftOf="@id/rating" android:layout_marginLeft="4dp" android:layout_marginRight="10dp" android:layout_marginTop="4dp" android:text="@+id/distance" /&gt; &lt;TextView android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/icon" android:text="@+id/name" android:textSize="40sp" /&gt; &lt;/RelativeLayout&gt; and the MainActivity.java class: package com.SahilSiddesh.far4; import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class MainActivity extends ListActivity { public void onCreate(Bundle icicle) { super.onCreate(icicle); String[] values = new String[] { "Android", "iPhone", "WindowsMobile", "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2" }; String[] distance = new String[] {"1","2","3","4","5…

http://stackoverflow.com/comment/42742822
type: QuestionComment
has text: @ericraio Nope. I used a [cordova plugin](https://github.com/Initsogar/cordova-webintent) that uses native intents. I found no reason why an ordinary link will not work.
score: 0
comment on: http://stackoverflow.com/q/25591466
type: Comment

http://stackoverflow.com/comment/40077001
score: 0
comment on: http://stackoverflow.com/q/25646891
type: Comment
type: QuestionComment
has text: @LittleJacod yes this time you were lucky someone answered your question w/o code, but mostly of times you **must** share an [MCVE](http://stackoverflow.com/help/mcve) in order to get better (and faster) answers. It's just a recommendation for further questions you may ask.

http://stackoverflow.com/q/25628494
tagged with: java
tagged with: sqlite
type: Question
has body: I have looked at several sample projects and I was able to create and update a database from my GameActivity class. However, I really need to make the database calls from my GameView class. The code for the GameActivity and GameView classes are below. The problem I am having is that when I try to make a call to the database in the Gameview like this: mySQLiteAdapter = new SQLiteAdapter(context); mySQLiteAdapter.open(); I get an error that says "The method open() is undefined for the type GameView.SQLiteAdapter". I also tried opening the SQLiteAdapter class with this code: Intent gameIntent = new Intent(myContext,AndroidSQLite.class); gameIntent.putExtra("Move", "22"); myContext.startActivity(gameIntent); However, it also opens up a new instance of the view which I don't want. What is the proper way to create a database connection in the GameView code? GameActivity.class public class GameActivity extends Activity { private SQLiteAdapter mySQLiteAdapter; @Override public void onCreate(Bundle savedInstanceState) { int skill = 0; int selectMove = 0; skill = Integer.parseInt(getIntent().getStringExtra("Logic")); super.onCreate(savedInstanceState); mySQLiteAdapter = new SQLiteAdapter(this); mySQLiteAdapter.openToWrite(); mySQLiteAdapter.deleteAll(); mySQLiteAdapter.insert("FGHIJK"); mySQLiteAdapter.close(); GameView gView = new GameView(this, skill); gView.setKeepScreenOn(true); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); gView.setBackgroundColor(getResources().getColor(android.R.color.black)); setContentView(gView); } } GameView.class public class GameView extends View { private Context myContext; private int[][] moves = new int[9][3]; private int[] moveOrder = new int[9]; private Bitmap gameBoard; private Bitmap gameBoardTrans; private SQLiteAdapter mySQLiteAdapter; public GameView (Context context, int logic){ super(context); myContext = context; mySQLiteAda…
has answer: http://stackoverflow.com/a/25628869
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40041221
score: 0
has title: Make an Android SQLite call from a class: "The method open() is undefined for the type GameView.SQLiteAdapter"
has answer: http://stackoverflow.com/a/25631683
answer count: 2
has comment: http://stackoverflow.com/comment/40042839

http://stackoverflow.com/q/25585393
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25585432
type: Question
type: UnansweredQuestion
tagged with: java
has body: I keep on getting the error identifier expected. I am still learning how to call classes and I believe I am doing it wrong.
answer count: 4
has answer: http://stackoverflow.com/a/25585435
tagged with: class
has title: <identifier> expected when trying to call a class
score: 0
has answer: http://stackoverflow.com/a/25585450
has answer: http://stackoverflow.com/a/25585443
tagged with: identifier

http://stackoverflow.com/q/25622054
downvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/25622083
possible better answer: http://stackoverflow.com/a/25622083
has body: I am new to Java , I am currently analyzing a file compare tool with java that compare two files from this link: http://www.java2s.com/Code/Java/File-Input-Output/Difftextfiledifferenceutility.htm But no where in the file, the file path is mentioned. Where should I insert the file path? I searched google and checked Java Filestram and buffer input output stream. But did not found any useful information. I also searched stackoverflow but it seems no such question exists. Usually, the file path should be updated in main file, right? But it seems that is missing in main file. public static void main(String argstrings[]) { if ( argstrings.length != 2 ) { System.err.println("Usage: diff oldfile newfile" ); System.exit(1); } Diff d = new Diff(); d.doDiff(argstrings[0], argstrings[1]); return; }
favorite count: 0
has answer: http://stackoverflow.com/a/25622393
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25622393
score: 0
has comment: http://stackoverflow.com/comment/40028885
has title: Where to insert file path in this Java Program?
tagged with: java
type: Question
upvote count: 2

http://stackoverflow.com/q/25610793
downvote count: 0
upvote count: 1
tagged with: web-services
type: AnsweredQuestion
has title: Request counter for individual all the web service api
accepted answer: http://stackoverflow.com/a/25610957
tagged with: servlet-listeners
tagged with: rest
score: 1
tagged with: java
tagged with: servlets
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/52320720
has body: I have created web services for my project, using rest and some of using only servlet. I want to create request counter for individual all the web service api to analyse individual request ratio per hour,per day and many more. I don't want to put counter for every api. Can I achieve it by using Servlet Listner or Servlet Filter? yes then how??? Small demo would be great if possible. Note : I know that I can analyse most of the details from access log.
has answer: http://stackoverflow.com/a/25610957
answer count: 1

http://stackoverflow.com/q/25564252
favorite count: 0
has answer: http://stackoverflow.com/a/25564423
has answer: http://stackoverflow.com/a/25564296
type: Question
has answer: http://stackoverflow.com/a/25565921
tagged with: java
has comment: http://stackoverflow.com/comment/39922324
score: 1
has answer: http://stackoverflow.com/a/25564448
has comment: http://stackoverflow.com/comment/39922238
has answer: http://stackoverflow.com/a/25569385
has title: Stringhandling, cut out part of string
has answer: http://stackoverflow.com/a/25564341
upvote count: 2
has comment: http://stackoverflow.com/comment/39923029
has answer: http://stackoverflow.com/a/25564394
tagged with: string
type: UnansweredQuestion
downvote count: 1
has body: I have a string with values like -7.000, 10.000, 0.000, -212.000 Now i want to take away the .000 from the string and also the - in the front if there is one. My values always have to be positive. So from this examples i has to give me 7, 10, 0, 212 back. How can i do that? I could do StringHandling.LEFT(myvalue,1).equals("-")?StringHandling.LEFT(myvalue,2):StringHandling.LEFT(myvalue,1) but then i have the Problem that when my values is 10.000 it just gonna give me 1
answer count: 7

http://stackoverflow.com/q/25641786
possible better answer: http://stackoverflow.com/a/25701193
accepted answer: http://stackoverflow.com/a/25642009
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25701193
score: 0
has body: I need to port a Java project onto an Android smart phone and display the results in an Android application. I am using eclipse with android plugin (Android SDK 20). Process: Exported the jar file of the java project.(java version 1.7.0) Imported the jar file in the libs folder of Android Project. Build Path->Configure Build Path-> Add Jars ->Selected from Libs folder->(OK) (even tested with by changing the order of gtna.jar on top of every thing) So now i can use the methods and classes in the main file of the android project.I pasted the mainfile code from the java project to be run , in onCreate Function under setContentView(); Although I know it will not display any thing on emulator/smartphone at the moment, but i just want to be sure,this code can be run on android.(results should appear in logcat after successful run).Below is the MainActivity.java from the Android Project. package com.example.rani; import gtna.graph.Graph; import gtna.io.graphReader.GtnaGraphReader; import gtna.io.graphWriter.GtnaGraphWriter; import gtna.metrics.trust.DisjunctPaths; import gtna.metrics.trust.TrustMetric; import gtna.networks.model.wot.WoTModelSimple; import java.util.Random; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /*Here is the code for the demo */ int NUMBER_OF_NODES=10; WoTModelSimple wotModel = new WoTModelSimple(NUMBER_OF_NODES, null); Graph wotGraph = wotModel.generate(); GtnaGraphWriter writer = new GtnaGraphWriter(); writer.write(wotGraph, "wot-100000.gtna"); // Read WoT graph GtnaGraphReader reader = new GtnaGraphReader(); Graph wotGraph2 = reader.read("wot-100000.gtna"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Create Trust Metric // SampleSize (1000…
has answer: http://stackoverflow.com/a/25642009
answer count: 2
linked to: http://stackoverflow.com/q/1334802
tagged with: java
tagged with: jar
type: Question
has title: java.lang.NullPointerException while using jar file of a java project in android
tagged with: android

http://stackoverflow.com/comment/39972860
type: Comment
has text: Maybe it's on ur others' folder sir because we're not friends yet.
type: AnswerComment
comment on: http://stackoverflow.com/a/25589992
score: 0

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/25606344
tag name: android-actionbar
tags question: http://stackoverflow.com/q/25584037
tags question: http://stackoverflow.com/q/25676725

http://stackoverflow.com/q/25617097
tagged with: spring
has comment: http://stackoverflow.com/comment/40020056
has comment: http://stackoverflow.com/comment/45122475
has title: Getting results from Ref Cursor Oracle using ProcedureCall hibernate to createStoredProcedureCall
tagged with: stored-procedures
score: 0
has comment: http://stackoverflow.com/comment/40020416
tagged with: java
tagged with: hibernate
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/47350193
type: UnansweredQuestion
tagged with: oracle-database
has body: I'm using ProcedureCall to create stored procedure: ProcedureCall procedure=getCurrentSession().createStoredProcedureCall("getContractServiceForContract"); procedure.registerParameter(1, ResultSet.class , ParameterMode.REF_CURSOR); procedure.registerParameter(2, Integer.class, ParameterMode.IN); procedure.registerParameter(3, Integer.class, ParameterMode.IN); procedure.registerParameter(4, Integer.class, ParameterMode.IN); procedure.getParameterRegistration(2).bindValue(contractId); procedure.getParameterRegistration(3).bindValue(month); procedure.getParameterRegistration(4).bindValue(year); After this i have: ResultSetOutput rso=(ResultSetOutput) procedure.getOutputs().getCurrent(); But getCurrent(); Throws exception: java.lang.UnsupportedOperationException: org.hibernate.dialect.Oracle10gDialect does not support resultsets via stored procedures I was trying to use expression: ResultSetOutput rso=(ResultSetOutput)procedure.getOutputs().getOutputParameterValue(1); But again i got exception: org.hibernate.procedure.ParameterMisuseException: REF_CURSOR parameters should be accessed via results Any ideas how to make this work? My procedure starts with: PROCEDURE getContractServiceForContract ( pResultValue OUT PROCTYPES.ref_cursor, pContractID IN INT, pMonth IN INT, pYear IN INT, pIsLoadByAccountingPeriod IN INT default 0 ) AS yearMin int; yearMax int; monthMin int; monthMax int; vContractIDs t_num_ids_tab; --holds event id's vContractServIDs t_num_ids_tab; --holds event id's BEGIN ...

http://stackoverflow.com/q/25643204
has body: I have a custom beanPostProcessor that is supposed to do some logic with spring controllers. I found out that it behaves funny. When I sysout controller bean in my post processor it says: ...controller.MassUploadController@743479ce but when I call sysout(this) from controller request itself it is a different instance: ...controller.MassUploadController@58469848 So any changes I perform to controller instance in beanPostProcessor are not really reflected in runtime since it is a different instance. How is that possible? It states everywhere that spring controllers are singletons! My controllers are defined in spring with @Controller and in xml I use componentScan on controller. java package
has comment: http://stackoverflow.com/comment/40068665
has comment: http://stackoverflow.com/comment/40103735
answer count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: javabeans
type: Question
score: 0
tagged with: java
has title: Controller beanPostProcessor spring - not singleton?

http://stackoverflow.com/comment/40101155
comment on: http://stackoverflow.com/a/25661452
score: 0
type: Comment
type: AnswerComment
has text: Actually there's another problem. Changes are having effect now but they're not what I was expecting. in the "if" condition I'm saying to desaturate all the pixel lower than threshold value, but I'm having the effect on all the pixels of the image, and they are not even desaturated, actually the opposite. Is there maybe a problem between my color space conversions?

http://stackoverflow.com/comment/40114724
has text: `\s*(\d*(?:;)(?!;)\*(?:;)(?!;)\*(?:;)(?!;)\+(?:(?:;)(?!;)\*=(?!;)\*)*)\s*$`
comment on: http://stackoverflow.com/q/25669037
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25639896
type: Question
tagged with: android
tagged with: java
type: UnansweredQuestion
has body: package com.origin.aritroghosh.originhome; import android.widget.BaseAdapter; //error cannot resolve symbol 'BaseAdapter' /** * Created by aritroghosh on 03/09/14. */ public class DrawerAdapter extends BaseAdapter { } Android studio not importing java header files and also showing errors while added manually
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25640005
has title: Android studio not importing java headers automatically

http://stackoverflow.com/q/25586435
score: 2
upvote count: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have a simple Spring App. In that app I have @Repository which should provide access to JSON file with my data. @Repository("jsonStorageUserRepository") public class JsonUserRepository implements UserRepository { @Value("${users}") private List&lt;User&gt; users; @Override public User getByCursor(Cursor cursor) { return users.get(cursor.getId); } } My users.json file (storage) in properties folder - [ { "name": "Bill", "registered": true }, { "name": "John", "registered": true } ] And my DTO class - public class User implements Serializable { private boolean registered; private String name; public User(String name, boolean redistricted) { this.name = name; registered = redistricted; } // setters and getters were omitted } Right now I have exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jsonStorageUserRepository': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.util.List com.springapp.mvc.repository.json.JsonUserRepository.users; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'users' in string value "${users}" It related to this line - @Value("${users}") private List&lt;User&gt; users; Is it possible to wire converted List of entities from JSON?
has comment: http://stackoverflow.com/comment/39964173
downvote count: 1
has comment: http://stackoverflow.com/comment/39964469
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25586570
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39964514
has comment: http://stackoverflow.com/comment/39964547
has title: How to wire a JSON data from file in Spring?
tagged with: spring
has answer: http://stackoverflow.com/a/25586608
has comment: http://stackoverflow.com/comment/39964654
answer count: 2

http://stackoverflow.com/a/25571682
accepted answer of: http://stackoverflow.com/q/25571553
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: The 2nd approach is better, although there's probably a best case that lies somewhere between them. The 2nd approach here allows multiple applications (or users of the same application) to modify the data at the same time, as the 1st approach may end up using old data if you load all the data at once (especially if a user leaves the application on a while). I would go with the 2nd approach and then figure out what optimizations to make. Since you think the 1st approach may be usable, I'd assume then you don't have too many users who would use the tool at the same time. If that is the case then, perhaps then you don't need to use any optimizations that the 1st method itself would give you as there's not going to be too much database usage. When you say you working with ResultSets more often in the 2nd approach than the 1st, well it doesn't need to be that way. You can use the same methods from the 1st approach which translates your data into Java data structures to be used in the 2nd approach.
answers question: http://stackoverflow.com/q/25571553
type: Answer

http://stackoverflow.com/q/25683965
type: Question
has title: Which folders does IntelliJ add to the classpath for its different Run Configurations by default?
type: UnansweredQuestion
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/25687764
tagged with: settings
tagged with: module
score: 0
tagged with: java
answer count: 1
has body: I have the following folder structure src/ src/main/ src/test/ src/test/package/ src/test/package/FooTest.java src/test/resources/ src/test/resources/foo/ src/test/resources/foo/a.txt Here is FooTest: import org.junit.Test; public class FooTest { @Test public void foo() { System.out.println(null != getClass().getResourceAsStream("foo/a.txt")); } public static void main (String... args) { System.out.println(null != FooTest.class.getClass().getResourceAsStream("foo/a.txt")); } } When I run this as a JUnit test, I get true print out, when I run it as an Application, it's false. The module setup looks like this: So, test/resources is not defined as a test resources folder. Which is why I don't understand why I get true once and false the next time. Could someone please explain how IntelliJ sets the classpath for the different Run Configurations (Application, JUnit test, Cucumber test) in general, and in particular why a.txt seems to be on the classpath for JUnit tests, even though it's not configured to be?
tagged with: classpath

http://stackoverflow.com/a/25587551
type: Answer
answers question: http://stackoverflow.com/q/25587415
has body: To read a file in LibGdx you need to abstract from the underlying. This is because the same application will work in several systems (Desktop, Android, Web, ...). So to read a file you need to use: FileHandle file = Gdx.files.internal("myfile.txt"); String text = file.readString(); The path and location of the files can be summarized in the documentation
downvote count: 0
score: 3
upvote count: 3

http://stackoverflow.com/comment/40103019
type: Comment
has text: Such nitpickers like me ...? ;-) @pskink Also I feel it's worth mentioning that the http related RFCs had been rewritten. Clarifying lots of ambiguities ..
score: 0
comment on: http://stackoverflow.com/q/25662508
type: QuestionComment

http://stackoverflow.com/comment/84269921
comment on: http://stackoverflow.com/q/25614799
score: 0
type: Comment
type: QuestionComment
has text: There is no static class here.

android-json
tags question: http://stackoverflow.com/q/25606487
type: Tag
tag name: android-json

http://stackoverflow.com/q/25617942
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25628176
has comment: http://stackoverflow.com/comment/40022736
score: 3
answer count: 3
tagged with: sql
tagged with: java
has body: I have Java application that makes some JDBC queries to PostgreSQL database, using prepared statements. The queries are not very complex, mostly one liners, but anyway I would like to have some Unit tests for them. Initially I wrote a JUnit test cases that connect a separate testing database (not a production database of course), wipe it at startup, create simple test content and fire the queries. I have been criticized for this approach because the "database should not be used in tests". The reason why the "database is used in tests" is that database engine is the interpreter for the code (SQL) I am testing. A requirement to test SQL without the database sounds like a requirement to test Java code without Java Virtual machine. The claim that some code just must never be tested because of philosophical reasons sounds somewhat strange, same about suggestion that most of SQL features (like ranged or otherwise more complicated queries, or joins) should actually never be used. I also use a wrapper class around all database activities and have a "SQL service mock" that does not talk with the database, and use it in various other tests, but I also need to test the actual production implementation of this mock. Is there alternative, better method to test my JDBC query set, or maybe I am just not doing anything wrong?
has answer: http://stackoverflow.com/a/25619331
has answer: http://stackoverflow.com/a/25627743
type: Question
has comment: http://stackoverflow.com/comment/40023553
tagged with: testing
upvote count: 3
has comment: http://stackoverflow.com/comment/40024093
possible better answer: http://stackoverflow.com/a/25619331
downvote count: 0
has title: Is there anything wrong with testing SQL with JUnit tests over JDBC?
accepted answer: http://stackoverflow.com/a/25628176
tagged with: unit-testing

http://stackoverflow.com/q/25642871
has title: Checking if a queue exists in HornetQ via JMS API
has body: I want to check if a jms queue exists in HornetQ or not. I'm using jms management api: public boolean queueExists(String queueName) throws Exception { final Queue managementQueue = HornetQJMSClient.createQueue("hornetq.management"); Connection connection = jmsConnectionFactory.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); QueueRequestor requestor = new QueueRequestor((QueueSession) session, managementQueue); connection.start(); Message message = session.createMessage(); JMSManagementHelper.putAttribute(message, queueName, ???); Message reply = requestor.request(message); Object result = JMSManagementHelper.getResult(reply); //??? } My Question is which attribute should i put in the request message for this purpose? And where can i find all possible attributes (documentation or constant fields of a class) ? JMSManagementHelper.putAttribute(message, queueName, ???); And what should I do with the result of reply message to understand the request result? Message reply = requestor.request(message); Object result = JMSManagementHelper.getResult(reply); //??? I'm using HornetQ 2.4.1.Final.
tagged with: hornetq
accepted answer: http://stackoverflow.com/a/26639085
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
tagged with: jms
has answer: http://stackoverflow.com/a/26639085
type: Question

http://stackoverflow.com/comment/40070380
has text: How does you logging config look?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25644210
score: 0

http://stackoverflow.com/q/25641280
tagged with: android
tagged with: intermec
score: 2
has body: I just want to know how to trigger the barcode scanner of the intermec cn51 device through software events rather than pressing the blue hardware button for the scanner. The device is running in Android 4.1.1 If anyone out there who has tried developing apps on this device, please any response is highly appreciated.
upvote count: 2
has title: Software trigger for intermec CN51 barcode scanner running in Android platform
tagged with: java
has answer: http://stackoverflow.com/a/26411926
answer count: 1
downvote count: 0
favorite count: 0
type: Question
tagged with: barcode-scanner
type: UnansweredQuestion

http://stackoverflow.com/q/25685484
type: Question
has comment: http://stackoverflow.com/comment/128692438
type: UnansweredQuestion
tagged with: single-sign-on
has comment: http://stackoverflow.com/comment/40145224
has body: I need to implement SSO (Windows authentication) with Java in an Web App. I already use Spring Security and i found an extension named Kerberos, but this extension appears to be discontinued. The extension Kerberos for spring security was discontinued? If it is, what alternatives are you using for SSO (Windows authentication) with Java? []'s
score: 3
upvote count: 3
tagged with: java
answer count: 0
downvote count: 0
tagged with: spring-security-kerberos
has title: Spring security Kerberos was discontinued?
tagged with: spring-security
tagged with: windows-authentication
favorite count: 0
has comment: http://stackoverflow.com/comment/40145465

http://stackoverflow.com/comment/39935864
comment on: http://stackoverflow.com/q/25571309
score: 0
type: Comment
has text: Yes, I noticed after I commented. It is better to separate classes and logcat from each other when posting
type: QuestionComment

macos
tags question: http://stackoverflow.com/q/25581314
tags question: http://stackoverflow.com/q/25575659
tags question: http://stackoverflow.com/q/25574793
tags question: http://stackoverflow.com/q/25631731
tags question: http://stackoverflow.com/q/25690425
tags question: http://stackoverflow.com/q/25683000
tags question: http://stackoverflow.com/q/25647786
tags question: http://stackoverflow.com/q/25712764
tags question: http://stackoverflow.com/q/25681659
tags question: http://stackoverflow.com/q/25615332
tags question: http://stackoverflow.com/q/25613003
type: Tag
tags question: http://stackoverflow.com/q/25693013
tags question: http://stackoverflow.com/q/25683232
tags question: http://stackoverflow.com/q/25566818
tags question: http://stackoverflow.com/q/25684424
tag name: macos
tags question: http://stackoverflow.com/q/25551556
tags question: http://stackoverflow.com/q/25577880
tags question: http://stackoverflow.com/q/25695697
tags question: http://stackoverflow.com/q/25637406

http://stackoverflow.com/comment/106943947
comment on: http://stackoverflow.com/a/25643503
type: AnswerComment
has text: @KanagaveluSugumar: You can't override it for the collection interfaces, but you could write your own static method *accepting* the collection.
score: 0
type: Comment

http://stackoverflow.com/a/25643359
has body: You can get this information from the request-object: request.getRequestURI()
answers question: http://stackoverflow.com/q/25639855
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25639855

http://stackoverflow.com/a/25557167
has body: You don't need to return anything (assuming you change the method signature to return void) - the elements of the array have been swapped in-place. For example: int[] array = { 3, 5, 4 }; swap(array, 0, 2); System.out.println(array[0]); // 4 System.out.println(array[2]); // 3 This is your actual problem: System.out.print(randArrayString); You haven't changed randArrayString since you last printed it - so no wonder it's printing the same value. You just need to add this line again, just before printing it out: randArrayString = Arrays.toString(randArray);
type: AcceptedAnswer
upvote count: 4
score: 4
accepted answer of: http://stackoverflow.com/q/25557043
has comment: http://stackoverflow.com/comment/39909262
has comment: http://stackoverflow.com/comment/39909368
has comment: http://stackoverflow.com/comment/39909275
answers question: http://stackoverflow.com/q/25557043
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40177158
score: 0
type: Comment
type: AnswerComment
has text: There is no PermGen since Java 7 anymore.
comment on: http://stackoverflow.com/a/25703374

http://stackoverflow.com/comment/59800078
has text: Add a replicating test case and open a JIRA issue then ;)
comment on: http://stackoverflow.com/a/35202997
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39918581
comment on: http://stackoverflow.com/q/25558174
has text: are you able to consume messages using the console script present in `$KAFKA_HJOME/bin/kafka-console-consumer.sh` ?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40148578
type: Comment
has text: @Betlista - didn't understand your comment. what is 'common'? and references are not just pointers. they are more than that
comment on: http://stackoverflow.com/a/25688178
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40129897
comment on: http://stackoverflow.com/q/25677810
score: 2
type: QuestionComment
type: Comment
has text: http://docs.oracle.com/javase/tutorial/getStarted/

http://stackoverflow.com/comment/40162382
type: QuestionComment
comment on: http://stackoverflow.com/q/25695011
type: Comment
score: 0
has text: ArrayList is from Java 1.2. Generics are from Java 1.5. (Although, perhaps they could have changed it in 1.5.)

http://stackoverflow.com/comment/40173733
comment on: http://stackoverflow.com/a/25701696
has text: Sure that's exactly what I wanted to understand. The "ObjectAnimator.ofFloat" part. Now I'm good. So what do I gotta do if I wanna use this library ?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40160693
type: Comment
type: QuestionComment
score: 0
has text: Wild guess: I think you miss a `LOCAL_C_INCLUDE = <path-to-libbmp-includes>` in your second (2) makefile, before the `include $(BUILD_SHARED_LIBRARY)`. I suspect that specifying it in the third one isn't the correct way.
comment on: http://stackoverflow.com/q/25689994

http://stackoverflow.com/q/25658841
has comment: http://stackoverflow.com/comment/40100851
has comment: http://stackoverflow.com/comment/40101456
linked to: http://stackoverflow.com/q/19495332
has comment: http://stackoverflow.com/comment/40101275
has comment: http://stackoverflow.com/comment/40101693
tagged with: struts2
accepted answer: http://stackoverflow.com/a/25662421
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23448616
has comment: http://stackoverflow.com/comment/40100970
has answer: http://stackoverflow.com/a/25662421
score: 3
upvote count: 3
tagged with: java
answer count: 1
linked to: http://stackoverflow.com/q/16388959
downvote count: 0
tagged with: clean-urls
has body: Hi i am beginner to struts2. If i post an URL like https://stackoverflow.com/questions/25658104 I want to get value 25658104 It must be done without any parameter. not as https://stackoverflow.com/questions?qid=25658104 Is there any way to get content based on the value passed between /myvalue/ if I post https://stackoverflow.com/questions/myvalue1/-->redirects to a page and loads values corresponding to myvalue1 (from DB) if I post https://stackoverflow.com/questions/myvalue2/-->redirects to a page and loads values corresponding to myvalue2(from DB) I found it in SO site navigation based on the values passed between SO it navigates .How can i use it in Struts2 My question is similar to URL rewriting with PHP but i want to do it in struts2 EDIT struts.xml <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devMode" value="true" /> <constant name="struts.custom.i18n.resources" value="ApplicationResources" /> <constant name="struts.multipart.maxSize" value="104857600" /> <constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/> <constant name="struts.enable.SlashesInActionNames" value="true"/> <constant name="struts.patternMatcher" value="username"/> <bean type="com.opensymphony.xwork2.util.PatternMatcher" name="username" class="com.opensymphony.xwork2.util.NamedVariablePatternMatcher"/> <result-type name="json" default="false" class="org.test.struts.controller.JSONResult" /> Welcome.jsp Login.jsp profile.jsp text/html inputStream text/html inputStream startswith java.lang.String /UploadFile.jsp myfiles /UploadFileSuccess.jsp /UploadFile.jsp 10485760 text/plain,image/jpeg Action class import com.opensymphony.xwork2.ActionSupport; public class ViewProfileAction extends ActionSupport{ private String username; public String getUsername() { return username; } public String execute() { // look up the appropriate user by username and // expose the user to the JSP with a getUser() method. System.out.println(username);…
tagged with: url
has comment: http://stackoverflow.com/comment/40097118
has title: Clean url-s in Struts2
has comment: http://stackoverflow.com/comment/40098763
favorite count: 0
linked to: http://stackoverflow.com/q/22067742
has comment: http://stackoverflow.com/comment/40100809
type: Question

http://stackoverflow.com/q/25693571
upvote count: 1
type: UnansweredQuestion
score: 1
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40163509
tagged with: render
has comment: http://stackoverflow.com/comment/40208567
has comment: http://stackoverflow.com/comment/40172586
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40173252
has comment: http://stackoverflow.com/comment/40168974
has answer: http://stackoverflow.com/a/48083493
tagged with: libgdx
tagged with: tiled
has comment: http://stackoverflow.com/comment/40159003
has comment: http://stackoverflow.com/comment/40200817
has title: libGDX - Rendering issue with Tiled
has body: For some reason as I run away the blocks behind me at the edge of the screen disappear. It is hard to get a shot of them doing that because it is different each frame, but this is what it looks like: If someone could please tell me why its doing this that would be awesome :) public void show() { map = new TmxMapLoader().load("assets/maps/map.tmx"); renderer = new OrthogonalTiledMapRenderer(map); sr = new ShapeRenderer(); sr.setColor(Color.CYAN); Gdx.gl.glLineWidth(3); camera = new OrthographicCamera(); } public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.position.set(player.getX() + player.getWidth() / 2, player.getY() + player.getHeight() / 2, 0); camera.update(); renderer.setView(camera); renderer.render(background); renderer.getSpriteBatch().begin(); player.draw(renderer.getSpriteBatch()); renderer.getSpriteBatch().end(); renderer.render(foreground); // render objects sr.setProjectionMatrix(camera.combined); for(MapObject object : map.getLayers().get("objects").getObjects()) if(object instanceof RectangleMapObject) { RectangleMapObject rectObject = (RectangleMapObject) object; Rectangle rect = rectObject.getRectangle(); if(rectObject.getProperties().containsKey("gid")) { // if it contains the gid key, it's an image object from Tiled int gid = rectObject.getProperties().get("gid", Integer.class); TiledMapTile tile = map.getTileSets().getTile(gid); renderer.getSpriteBatch().begin(); renderer.getSpriteBatch().draw(tile.getTextureRegion(), rect.x, rect.y); renderer.getSpriteBatch().end(); } else { // otherwise, it's a normal RectangleMapObject sr.begin(ShapeType.Filled); sr.rect(rect.x, rect.y, rect.width, rect.height); sr.end(); } } else if(object instanceof CircleMapObject) { Circle circle = ((CircleMapObject) object).getCircle(); sr.begin(ShapeType.Filled); sr.circle(circle.x, circle.y, circle.radius); sr.end(); } else if(object instanceof EllipseMapObject) { Ellipse ellipse = ((EllipseMapObject) obj…
downvote count: 0

http://stackoverflow.com/comment/40173329
type: AnswerComment
comment on: http://stackoverflow.com/a/25696906
has text: update: I just called up a friend and asked him to explain the code that you wrote out and now I understand it! Thanks!
type: Comment
score: 0

http://stackoverflow.com/q/25575591
tagged with: classpath
type: Question
has comment: http://stackoverflow.com/comment/39946564
tagged with: weblogic
has title: java.lang.NoClassDefFoundError: org/apache/struts/actions/MappingDispatchAction
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12339696
has answer: http://stackoverflow.com/a/25593305
tagged with: struts
has comment: http://stackoverflow.com/comment/39944823
has comment: http://stackoverflow.com/comment/39944747
has comment: http://stackoverflow.com/comment/39945190
score: 0
has body: I have an EAR deployed in Weblogic 10.3.6.0 and I get the next error: Error 500--Internal Server Error java.lang.NoClassDefFoundError: org/apache/struts/actions/MappingDispatchAction at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:630) at java.lang.ClassLoader.defineClass(ClassLoader.java:614) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:305) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:246) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179) at weblogic.utils.classloaders.FilteringClassLoader.findClass(FilteringClassLoader.java:101) at weblogic.utils.classloaders.FilteringClassLoader.loadClass(FilteringClassLoader.java:86) at java.lang.ClassLoader.loadClass(ClassLoader.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:246) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179) at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:630) at java.lang.ClassLoader.defineClass(ClassLoader.java:614) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:343) at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:302) at weblogic.utils.cl…
tagged with: ear
has comment: http://stackoverflow.com/comment/39946501
tagged with: java
has comment: http://stackoverflow.com/comment/39944492
answer count: 1
has comment: http://stackoverflow.com/comment/39947249
has comment: http://stackoverflow.com/comment/39945723

http://stackoverflow.com/q/25591514
has title: setBackgroundResource on ImageView return null
type: Question
tagged with: jquery-animate
has answer: http://stackoverflow.com/a/25591602
type: UnansweredQuestion
tagged with: imageview
tagged with: android
tagged with: listview
score: 0
tagged with: java
answer count: 1
has body: I'm using ListFragment in my android project. I decided to make a listView, each listview item consist of music frequency imageView. I will try to animate the imageView of music frequency. Each listView has a button called play, once the play is clicked, the music frequency start to animate. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragmentmusiclist, container, false); lv = (ListView) v.findViewById(R.id.list); mp = new MediaPlayer(); mp = null; Song s1 = new Song("Love Story",(float) 2.5, onMusicPlayListener); Song s2 = new Song("Sad Story",(float) 1.0, onMusicPlayListener); Song s3 = new Song("Breakup Story",(float) 3.5, onMusicPlayListener); songs = new ArrayList&lt;Song&gt;(); songs.add(s1); songs.add(s2); songs.add(s3); adapter = new MusicListAdapter(getActivity(),songs); setListAdapter(adapter); return super.onCreateView(inflater, container, savedInstanceState); } OnClickListener onMusicPlayListener = new OnClickListener() { @Override public void onClick(View v) { final int position = getListView().getPositionForView((LinearLayout)v.getParent()); animMusicFreq = (ImageView) v.findViewById(R.id.music_anim); animMusicFreq.setBackgroundResource(R.anim.anim_music); animMusicFreq.post(new Runnable() { @Override public void run() { AnimationDrawable frameAnimation = (AnimationDrawable) animMusicFreq.getBackground(); frameAnimation.start(); } });

http://stackoverflow.com/comment/39958248
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25582968
type: Comment
has text: @HotLicks I'm hoping to do it specifically with GSON so as not to change the current JSON library we are using in our project.

http://stackoverflow.com/comment/39932094
comment on: http://stackoverflow.com/a/25567219
score: 0
type: AnswerComment
has text: @TomHawtin-tackline - You can see that, but mere mortals can't :-)
type: Comment

http://stackoverflow.com/q/25656452
has title: Swing not displaying the correct font set
tagged with: jlist
has answer: http://stackoverflow.com/a/25656476
accepted answer: http://stackoverflow.com/a/25656476
type: AnsweredQuestion
score: 0
linked to: http://stackoverflow.com/q/6965038
has body: I have a JList inside of a JScrollPane and have set the font to Tahoma, plain, 20 and for some reason its still displaying as very small text and I am not to sure why this is? Just so that this isn't a massive piece of code I have slimmed it down as much as I can the frame that this is stored in uses a GridBagLayout ArrayUtil.ArrayToListModel converts any List&lt;T&gt;; to ListMode&lt;T&gt;; JFrame frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[]{0}; gridBagLayout.rowHeights = new int[]{0}; gridBagLayout.columnWeights = new double[]{1.0}; gridBagLayout.rowWeights = new double[]{1.0}; frame.getContentPane().setLayout(gridBagLayout); JScrollPane showlistScrollPane = new JScrollPane(); GridBagConstraints gbc_showlistScrollPane = new GridBagConstraints(); gbc_showlistScrollPane.insets = new Insets(0, 0, 0, 5); gbc_showlistScrollPane.fill = GridBagConstraints.BOTH; gbc_showlistScrollPane.gridx = 0; gbc_showlistScrollPane.gridy = 0; frame.getContentPane().add(showlistScrollPane, gbc_showlistScrollPane); ArrayList&lt;String&gt; randomData = new ArrayList&lt;String&gt;(); randomData.add("Random drhgiudrhgiudhri"); randomData.add("Data dsirhgodhroih"); ListModel&lt;String&gt; pagesList = ArrayUtil.ArrayToListModel(randomData); showlist = new JList&lt;String&gt;(pagesList); showlist.setFont(new Font("Tahoma", Font.PLAIN, 20)); showlistScrollPane.setViewportView(showlist); No matter how big or small I make the font for showlist it never changes from its default.
tagged with: fonts
tagged with: java
answer count: 1
tagged with: swing
type: Question

http://stackoverflow.com/q/25569625
type: AnsweredQuestion
upvote count: 27
linked to: http://stackoverflow.com/q/6952660
linked to: http://stackoverflow.com/q/2277430
has answer: http://stackoverflow.com/a/25569744
accepted answer: http://stackoverflow.com/a/25569705
has answer: http://stackoverflow.com/a/25569802
downvote count: 0
has answer: http://stackoverflow.com/a/25569705
has answer: http://stackoverflow.com/a/25571331
has comment: http://stackoverflow.com/comment/39932381
duplicate of: http://stackoverflow.com/q/2277430
favorite count: 0
has body: I was trying to insert the integers in PriorityQueue, and I know that : If no comparator is specified when a PriorityQueue is constructed, then the default comparator for the type of data stored in the queue is used. The default comparator will order the queue in ascending order However, the output I am getting is not in sorted order. Output after running the below code is : [2, 4, 8, 6] public static void main(String args[]) { PriorityQueue&lt;Integer&gt; q = new PriorityQueue&lt;Integer&gt;(10); q.offer(4); q.offer(2); q.offer(8); q.offer(6); System.out.print(q); } Can someone please explain why ?
type: Question
tagged with: priority-queue
possible better answer: http://stackoverflow.com/a/25569802
answer count: 5
tagged with: java
linked to: http://stackoverflow.com/q/1795527
has answer: http://stackoverflow.com/a/25569828
score: 27
has title: Sorting Priority Queue in Java

http://stackoverflow.com/q/25676101
downvote count: 0
score: 1
upvote count: 1
tagged with: multithreading
answer count: 1
tagged with: android-intent
has answer: http://stackoverflow.com/a/25676626
accepted answer: http://stackoverflow.com/a/25676626
favorite count: 0
type: Question
tagged with: android
tagged with: java
tagged with: class
has title: Android application logical classes: service, handler, ...?
type: AnsweredQuestion
has body: I've been trying to find a simple and clear solution for my question in the last 2 hours. Hope someone can help me here. I'm developing my first real android application. So of course I want to separate my activities (UI) from the application logic and have a nice structured package tree. But after some research I'm a little bit confused, what is the right choice for my background objects that do not need an user interface: normal java class, services, threads, handler..? What I want to do: I want the create an Object whose methods can be called by the activity. These methods on the other hand should call some Tasks (e.g. check for update on server or create a new message and send it to server). I thought something about this: 3rd Layer: User Interface (probably activities, right?) 2nd Layer: Some Objects that will handle the user inputs and call: 1st Layer Background Tasks e.g. downloading stuff, (I thought about ASyncTasks) First of all I thought that those objects from second layershould be services. But there is no need to run a process for a long time doing permanently stuff in my application. Then I considered normal java classes, but I think this would be too easy. Handler? Hope my question is clear enough! Maybe my basic concept is already wrong?

http://stackoverflow.com/a/25610781
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/25603295
has body: Using JPA 2.1 Entity Graph you can control fetching at run-time, check this blog or this blog for more details.
answers question: http://stackoverflow.com/q/25603295
type: AcceptedAnswer
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/66217436

http://stackoverflow.com/a/25691440
accepted answer of: http://stackoverflow.com/q/25688639
answers question: http://stackoverflow.com/q/25688639
type: Answer
score: 2
has body: I haven't encountered this specific issue before, but I have had problems getting a JBoss-deployed war file to obtain a Groovy Script Engine. What I did to resolve my problem was to create a global Groovy module: 1) Create directory $JBOSS_HOME/modules/org/codehaus/groovy/main/ 2) Copy groovy-all-2.3.6.jar into that directory. 3) Create a module.xml file in the same directory with this content: <?xml version="1.0" encoding="UTF-8"?> <resource-root path="groovy-all-2.3.6.jar"/> 4) Modify the "urn:jboss:domain:ee:1.1" subsystem element in standalone.xml (or whichever flavor you're using) to include the just-created module as a global module, e.g. <spec-descriptor-property-replacement>false</spec-descriptor-property-replacement> <jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement> If it still doesn't work, it might require you to include myJar.jar in the global module as well, although I'd also consider that a workaround.
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25599641
has comment: http://stackoverflow.com/comment/39990982
has comment: http://stackoverflow.com/comment/39988487
tagged with: jface
has comment: http://stackoverflow.com/comment/39989748
has comment: http://stackoverflow.com/comment/39988548
has comment: http://stackoverflow.com/comment/39988634
has answer: http://stackoverflow.com/a/25601617
has comment: http://stackoverflow.com/comment/39988391
tagged with: swt
answer count: 1
has comment: http://stackoverflow.com/comment/39990892
has comment: http://stackoverflow.com/comment/39988299
has title: How can we change text of a table row in swt using jface
has comment: http://stackoverflow.com/comment/39990844
type: Question
linked to: http://stackoverflow.com/q/12821451
accepted answer: http://stackoverflow.com/a/25601617
has body: I need to change the text of the table item when messages are displayed in the tableitem .so how can we do it using jface .The table consists of 2 coloumns.Please help to resolve this as i am new to jface .
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39988156
tagged with: java

http://stackoverflow.com/comment/39933023
has text: @David Eisenstat actually no. I made one mistake (unintentionally)
comment on: http://stackoverflow.com/a/25569411
type: Comment
score: 0
type: AnswerComment

arrays
tags question: http://stackoverflow.com/q/25575814
tag name: arrays
tags question: http://stackoverflow.com/q/25698882
tags question: http://stackoverflow.com/q/25595019
tags question: http://stackoverflow.com/q/25707202
tags question: http://stackoverflow.com/q/25692520
tags question: http://stackoverflow.com/q/25574707
tags question: http://stackoverflow.com/q/25704077
tags question: http://stackoverflow.com/q/25672723
tags question: http://stackoverflow.com/q/25598828
tags question: http://stackoverflow.com/q/25705441
tags question: http://stackoverflow.com/q/25657251
tags question: http://stackoverflow.com/q/25676019
tags question: http://stackoverflow.com/q/25704954
tags question: http://stackoverflow.com/q/25557043
type: Tag
tags question: http://stackoverflow.com/q/25601376
tags question: http://stackoverflow.com/q/25598974
tags question: http://stackoverflow.com/q/25613223
tags question: http://stackoverflow.com/q/25699499
tags question: http://stackoverflow.com/q/25645550
tags question: http://stackoverflow.com/q/25634832
tags question: http://stackoverflow.com/q/25590597
tags question: http://stackoverflow.com/q/25654556
tags question: http://stackoverflow.com/q/25699131
tags question: http://stackoverflow.com/q/25617911
tags question: http://stackoverflow.com/q/25694669
tags question: http://stackoverflow.com/q/25700557
tags question: http://stackoverflow.com/q/25680943
tags question: http://stackoverflow.com/q/25553981
tags question: http://stackoverflow.com/q/25597683
tags question: http://stackoverflow.com/q/25675715
tags question: http://stackoverflow.com/q/25599998
tags question: http://stackoverflow.com/q/25605181
tags question: http://stackoverflow.com/q/25597088
tags question: http://stackoverflow.com/q/25637022
tags question: http://stackoverflow.com/q/25559618
tags question: http://stackoverflow.com/q/25598348
tags question: http://stackoverflow.com/q/25649512
tags question: http://stackoverflow.com/q/25566729
tags question: http://stackoverflow.com/q/25665885
tags question: http://stackoverflow.com/q/25568525
tags question: http://stackoverflow.com/q/25572623
tags question: http://stackoverflow.com/q/25689473
tags question: http://stackoverflow.com/q/25657440
tags question: http://stackoverflow.com/q/25636574
tags question: http://stackoverflow.com/q/25565171
tags question: http://stackoverflow.com/q/25656710
tags question: http://stackoverflow.com/q/25561755
tags question: http://stackoverflow.com/q/25694751
tags question: http://stackoverflow.com/q/25612093
tags question: http://stackoverflow.com/q/25553442
tags question: http://stackoverflow.com/q/25693204
tags question: http://stackoverflow.com/q/25698824
tags question: http://stackoverflow.com/q/25579636
tags question: http://stackoverflow.com/q/25712294
tags question: http://stackoverflow.com/q/25691228
tags question: http://stackoverflow.com/q/25627273
tags question: http://stackoverflow.com/q/25560056
tags question: http://stackoverflow.com/q/25564102
tags question: http://stackoverflow.com/q/25638322
tags question: http://stackoverflow.com/q/25634693
tags question: http://stackoverflow.com/q/25607888
tags question: http://stackoverflow.com/q/25704291
tags question: http://stackoverflow.com/q/25608453
tags question: http://stackoverflow.com/q/25705097
tags question: http://stackoverflow.com/q/25593313
tags question: http://stackoverflow.com/q/25675173
tags question: http://stackoverflow.com/q/25657228
tags question: http://stackoverflow.com/q/25707347
tags question: http://stackoverflow.com/q/25660816
tags question: http://stackoverflow.com/q/25590777
tags question: http://stackoverflow.com/q/25654274
tags question: http://stackoverflow.com/q/25654253
tags question: http://stackoverflow.com/q/25677194
tags question: http://stackoverflow.com/q/25634453
tags question: http://stackoverflow.com/q/25555827
tags question: http://stackoverflow.com/q/25702722
tags question: http://stackoverflow.com/q/25657849
tags question: http://stackoverflow.com/q/25652483

http://stackoverflow.com/a/25674011
has comment: http://stackoverflow.com/comment/40123191
has body: You are having some Compability issue between the two. the easy way will be to find a version that is compatible with ubuntu 32.0
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25673899

http://stackoverflow.com/comment/40093485
type: Comment
type: QuestionComment
score: 0
has text: @AndrewT. Well I can seek just fine but not to the position I want.
comment on: http://stackoverflow.com/q/25656102

http://stackoverflow.com/comment/39970733
comment on: http://stackoverflow.com/q/25589697
has text: Why did you remove the code for the `Polynomial` class? :(
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40150216
comment on: http://stackoverflow.com/a/25685372
has text: Sorry, I don't understand the third case. Why c.fie(b) will call method defined in class A instead of the one in class B. c point to a instance object of class B. Moreover, the parameter passed in is type B.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40140104
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25663165
has text: See also [this Q&A](http://stackoverflow.com/q/25683630/418556) which might help determine from where the fonts are sourced.
score: 0

http://stackoverflow.com/comment/40016440
type: QuestionComment
has text: @Ohgodwhy wow, that's highly special. Who needs arrays when you can just make up slots with numbers in their names!
score: 3
type: Comment
comment on: http://stackoverflow.com/q/25615172

graphics2d
tags question: http://stackoverflow.com/q/25614241
tags question: http://stackoverflow.com/q/25574261
tags question: http://stackoverflow.com/q/25563715
tags question: http://stackoverflow.com/q/25609566
tag name: graphics2d
tags question: http://stackoverflow.com/q/25694968
type: Tag
tags question: http://stackoverflow.com/q/25651838

http://stackoverflow.com/a/25575450
has comment: http://stackoverflow.com/comment/39945163
score: 0
has body: You are using a Fragment to perform tasks that are completely unrelated to the UI. You should move the code to a standard java class. But I think the exception is thrown because you aren't instantiating the Socket objects. Based on the code posted, the loop is never executed
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25574635
accepted answer of: http://stackoverflow.com/q/25574635
type: Answer

http://stackoverflow.com/a/25589727
accepted answer of: http://stackoverflow.com/q/25589523
type: Answer
has body: I'm so stupid..... MainActivity.equipWeapon wasn't calling Weapon.equipWeapon.... So the weapon wasn't changing... Oy' vey...
score: 0
answers question: http://stackoverflow.com/q/25589523
type: AcceptedAnswer

http://stackoverflow.com/comment/40081748
score: 0
type: Comment
type: QuestionComment
has text: In that link dates are in the specific format.
comment on: http://stackoverflow.com/q/25649151

http://stackoverflow.com/q/25660338
tagged with: boolean-expression
has answer: http://stackoverflow.com/a/25660633
has title: How to read from one line separated with only whitespace?
type: Question
tagged with: integer
has answer: http://stackoverflow.com/a/25660417
tagged with: java.util.scanner
has body: int a; int b; int c; Scanner input = new Scanner (System.in); //how to read three integers with white space delimiter System.out.print("Enter the 3 edges of the triangle to be calculated: "); int numbers = input.nextInt(); //then turn 3 integers into boolean form //this is only the algorithm Boolean isTriangle = ((a+b&gt;c) &amp;&amp; (b+c &gt; a) &amp;&amp; (c+a &gt; b)); System.out.print(isTriangle); else System.out.print(isTriangle); So instead of entering 3 integers in a separate line or in a newline i want them all to be in the same line just separated with whitespace. Do I need to change standard input as string then just parse it after for the boolean part? I am confuse because after entering the integers I don't know where to store them to use for the boolean part. Edited part: public static void main(String[] args){ int x; int y; int z; Scanner input = new Scanner(System.in); System.out.println("Enter three edges: "); x = input.nextInt(); y = input.nextInt(); z = input.nextInt(); boolean isTriangle = ((x+y&gt;z) &amp;&amp; (y+z &gt; x) &amp;&amp; (z+x &gt; y)); if (isTriangle){ System.out.print("Can edges " + x + ", " + y + ", " + z + " form a triangle"+ isTriangle); } else { System.out.print("Can edges " + x + ", " + y + ", " + z + " form a triangle"+ isTriangle); } } why is it that when i call x y and z in system.out they don't show the entered input but when i only put the isTriangle on system.out it gives me output
possible better answer: http://stackoverflow.com/a/25660633
tagged with: whitespace
accepted answer: http://stackoverflow.com/a/25660417
has answer: http://stackoverflow.com/a/25660514
type: AnsweredQuestion
score: 0
answer count: 3
tagged with: java

http://stackoverflow.com/q/25567664
has answer: http://stackoverflow.com/a/25567710
has comment: http://stackoverflow.com/comment/39928509
answer count: 5
has answer: http://stackoverflow.com/a/25567715
tagged with: java
tagged with: instance-variables
type: AnsweredQuestion
has body: we know that... Instance Variable are initialized in default constructor. For eg. public class H{ int x; public static void main(String... args){ System.out.print(new H().x); } } The O/P of above code is 0 because there is a default constructor which is called , and that constructor initialized the x to 0. Now, my question is, if we run the below code, i.e. public class H{ int x; public H(){} public static void main(String... args){ System.out.print(new H().x); } } The actual O/P is 0 in this case also, but I think there should be compiler error that x is not initialized, because we have override the default constructor and didn't initialize x.I think I have made my question clear..
tagged with: constructor
has answer: http://stackoverflow.com/a/25567749
has comment: http://stackoverflow.com/comment/39928555
score: 1
possible better answer: http://stackoverflow.com/a/25567706
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39928466
has answer: http://stackoverflow.com/a/25567706
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25567725
has title: Initialization of class variables in constructor in java
accepted answer: http://stackoverflow.com/a/25567715

http://stackoverflow.com/q/25585163
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/39965396
has body: So i need to create an ArrayList of Threads but according to Java - Filling an ArrayList of Threads with loop it seems that i need to use the synchronized keyword, my question then is: If im calling this only on the main thread why do i have to use the synchronized keyword? There are no others threads that could potentially do the same right? ArrayList&lt;Thread&gt; t = new ArrayList&lt;Thread&gt;(); for(int i=0;i&lt;love.size();i++){ BTConnection cbtc = love.get(i).btc; if(cbtc!=null){ Communicate temp = new Communicate(cbtc); Thread ttemp = new Thread(temp); ttemp.start(); t.add(ttemp); } } Moreover if right below the code i use: for(int i=0;i&lt;t.size();i++){ t.get(i).join(); } Does the for loop stop until the ith thread returns and then proceed to wait for the ith+1?
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39964935
has comment: http://stackoverflow.com/comment/39961601
has title: Why do i have to synchronized an ArrayList of Threads?
tagged with: multithreading
answer count: 1
has answer: http://stackoverflow.com/a/25585259
accepted answer: http://stackoverflow.com/a/25585259
has comment: http://stackoverflow.com/comment/39963998
tagged with: synchronized
linked to: http://stackoverflow.com/q/18412308
tagged with: arraylist
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/39961868

http://stackoverflow.com/q/25593570
has comment: http://stackoverflow.com/comment/39976948
favorite count: 0
type: Question
has body: My clock code works at every other hour except ten o' clock. At every other hour, it increments minutes by 1 every time seconds is 60, but at ten o' clock, for some reason, it increments minutes by 1 every time seconds is 10. I don't know what I did wrong. Please help! package misk; public class Misk { public static void main(String[] args) throws InterruptedException { int x = 0; int sec = 0, min = 0, hour = 9; while (x == 0) { Thread.sleep(10); sec++; if (sec == 60) { sec = 0; min++; } if (min == 60) { min = 0; hour++; } if (sec &lt; 10) { if (min &lt; 10) { if (hour &lt; 10) { System.out.println("0" + hour + ":0" + min + ":0" + sec); } } } if (sec &gt; 10) { if (min &lt; 10) { if (hour &lt; 10) { System.out.println("0" + hour + ":0" + min + ":" + sec); } } } if (sec &lt; 10) { if (min &gt; 10) { if (hour &lt; 10) { System.out.println("0" + hour + ":" + min + ":0" + sec); } } } if (sec &lt; 10) { if (min &lt; 10) { if (hour &gt; 10) { System.out.println("" + hour + ":0" + min + ":0" + sec); } } } if (sec &gt; 10) { if (min &gt; 10) { if (hour &lt; 10) { System.out.println("0" + hour + ":" + min + ":" + sec); } } } if (sec &lt; 10) { if (min &gt; 10) { if (hour &gt; 10) { System.out.println("0" + hour + ":" + min + ":" + sec); } } } if (sec &gt; 10) { if (min &lt; 10) { if (hour &gt; 10) { System.out.println("" + hour + ":0" + min + ":" + sec); } } } if (sec &gt; 10) { if (min &gt; 10) { if (hour &gt; 10) { System.out.println("" + hour + ":" + min + ":" + sec); } } } if (sec == 10) { if (min == 10) { if (hour == 10) { System.out.println("" + hour + ":" + min + ":" + sec); } } } if (sec &gt; 10) { if (min == 10) { if (hour == 10) { System.out.println("" + hour + ":" + min + ":" + sec); } } } if (sec == 10) { if (min &gt; 10) { if (hour == 10) { System.out.println("" + hour + ":" + min + ":" + sec); } } } if (sec == 10) { if (min == 10) { if (hour &gt; 10) { System.out.println("" + hour + ":" + min + ":" + sec); } } } if (sec &gt; 10) { if (min &gt; 10) { if (hour ==…
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/25592688
tagged with: java
has comment: http://stackoverflow.com/comment/39976872
has comment: http://stackoverflow.com/comment/39977242
downvote count: 3
has comment: http://stackoverflow.com/comment/39976963
has comment: http://stackoverflow.com/comment/39976972
has comment: http://stackoverflow.com/comment/39976938
upvote count: 1
score: -2
has answer: http://stackoverflow.com/a/25593654
answer count: 1
accepted answer: http://stackoverflow.com/a/25593654
has title: My clock code stops working at Ten O' Clock
has comment: http://stackoverflow.com/comment/39976919
has comment: http://stackoverflow.com/comment/39976898

http://stackoverflow.com/comment/40143671
type: QuestionComment
score: 0
has text: @HangSoungChann you should REALLY upgrade to a version newer than 2.3.16, due to security issues, and thousands of bugfixes... and start using struts2-jquery-plugin
comment on: http://stackoverflow.com/q/25683126
type: Comment

http://stackoverflow.com/comment/40169268
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25699099
has text: I've changed the 5 to 3. Also, you can add a parameter to the split function to ensure there will be no more than three elements in the array, but that would not affect the behavior of this solution.
score: 0

http://stackoverflow.com/q/25705333
tagged with: syntax
tagged with: java
has comment: http://stackoverflow.com/comment/40180776
tagged with: variable-assignment
type: Question
has answer: http://stackoverflow.com/a/25705418
accepted answer: http://stackoverflow.com/a/25705418
has comment: http://stackoverflow.com/comment/40180591
has title: Does "x = x = .." (double equals/assignment) mean anything special?
has answer: http://stackoverflow.com/a/25705360
possible better answer: http://stackoverflow.com/a/25705360
has body: In a server programmed in Java, I found this statement: buffer = buffer = new byte[bufferSize]; What I don't understand is that "buffer = " is stated twice. Would not this code do the exact same thing? buffer = new byte[bufferSize]; Thanks.
has comment: http://stackoverflow.com/comment/40180858
has comment: http://stackoverflow.com/comment/40180737
has comment: http://stackoverflow.com/comment/40180750
type: AnsweredQuestion
score: 0
answer count: 2

list
type: Tag
tags question: http://stackoverflow.com/q/25581329
tags question: http://stackoverflow.com/q/25584744
tags question: http://stackoverflow.com/q/25691773
tags question: http://stackoverflow.com/q/25697498
tags question: http://stackoverflow.com/q/25695083
tags question: http://stackoverflow.com/q/25702379
tags question: http://stackoverflow.com/q/25636877
tags question: http://stackoverflow.com/q/25686930
tags question: http://stackoverflow.com/q/25576558
tags question: http://stackoverflow.com/q/25632576
tags question: http://stackoverflow.com/q/25665663
tags question: http://stackoverflow.com/q/25569392
tags question: http://stackoverflow.com/q/25677466
tags question: http://stackoverflow.com/q/25561948
tags question: http://stackoverflow.com/q/25575559
tags question: http://stackoverflow.com/q/25649842
tags question: http://stackoverflow.com/q/25657983
tags question: http://stackoverflow.com/q/25617911
tags question: http://stackoverflow.com/q/25630223
tags question: http://stackoverflow.com/q/25575380
tag name: list
tags question: http://stackoverflow.com/q/25571841
tags question: http://stackoverflow.com/q/25666394
tags question: http://stackoverflow.com/q/25607888
tags question: http://stackoverflow.com/q/25613927
tags question: http://stackoverflow.com/q/25674226
tags question: http://stackoverflow.com/q/25585387
tags question: http://stackoverflow.com/q/25566943

http://stackoverflow.com/comment/39990168
has text: Thanks for all the great suggestions. Anyone know why Eclipse can't "see beyond" this?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25600725
type: Comment

http://stackoverflow.com/comment/40089728
type: QuestionComment
has text: Try `col = new TableColumn<T,Integer>` and you should use S instead of T to match the javadoc. `TableView<S,T>` where S is the underlying data type and T is the column data type. I'm not sure if this is your problem but I use it in my code.
score: 0
comment on: http://stackoverflow.com/q/25650726
type: Comment

http://stackoverflow.com/q/25601455
type: UnansweredQuestion
downvote count: 0
has title: Android: bindService() prevents me from accessing EditTexts?
upvote count: 1
favorite count: 0
type: Question
has body: I have this weird problem with Android (4.4), where I cannot access an EditText field's content via getText().toString() if (and only if) i started a boundService before. I narrowed it down to the following code: Layout (stripped to the essential parts): &lt;EditText android:id="@+id/edit_username" /&gt; &lt;Button android:id="@+id/button" android:text="@string/do sth" android:onClick="myFunction" /&gt; Activity code: public class MyActivity extends Activity { private EditText editUsername; private MyService myService; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.act_login); this.editUsername = (EditText) this.findViewById(R.id.edit_username); Intent serviceIntent = new Intent(this, MyService.class); bindService(serviceIntent, myServiceConnection, Context.BIND_AUTO_CREATE); // 1 } public void myFunction(View view) { Toast.makeText(this, editUsername.getText().toString(), Toast.LENGTH_SHORT).show(); // 2 Log.d(Config.LOGTAG, "user: " + editUsername.getText().toString()); } private ServiceConnection myServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName className, IBinder service) { ServiceBinder binder = (ServiceBinder) service; myService = binder.getService(); } @Override public void onServiceDisconnected(ComponentName componentName) { networkServiceIsBound = false; } }; The MyService class does nothing atm and just implements the required stub methods as shown in the tutorial from android developers. So my problem is: At marker "2" in the code, the content retrieved from the EditText is empty, no matter what I enter in the text field. Fun info: if I "hardcode" a String into the EditText in the layout (e.g. android:text="blabla"), this is shown. Anyhow - the whole setup works perfectly, if I do not bind the service (i.e. delete the row marked with "1"): Then, everything I type in the text field is shown in both Toast and Log... I guess that b…
score: 1
tagged with: android
tagged with: java
tagged with: service
tagged with: android-edittext
answer count: 0

dreamweaver
type: Tag
tag name: dreamweaver
tags question: http://stackoverflow.com/q/25683232

canvas
tags question: http://stackoverflow.com/q/25698843
tag name: canvas
type: Tag
tags question: http://stackoverflow.com/q/25695869
tags question: http://stackoverflow.com/q/25695219
tags question: http://stackoverflow.com/q/25671865
tags question: http://stackoverflow.com/q/25591287

http://stackoverflow.com/a/25642884
answers question: http://stackoverflow.com/q/25642585
score: 56
has comment: http://stackoverflow.com/comment/40066329
has comment: http://stackoverflow.com/comment/40066298
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25642585
has body: The easiest way to check is entity == null. There is no shorter way to do that. Note that there is a method for this in the standard lib: Objects.isNull(Object obj) And another one which is the opposite of the above one: Objects.nonNull(Object obj) And there is yet another one which can be used to force a value to be not null, it throws a NullPointerException otherwise: T Objects.requireNonNull(T obj); Note: The Objects class was added in Java 7, but the isNull() and nonNull() methods were added only in Java 8.
has comment: http://stackoverflow.com/comment/40066462
has comment: http://stackoverflow.com/comment/40066378
has comment: http://stackoverflow.com/comment/40066400
type: Answer
upvote count: 56

http://stackoverflow.com/comment/40010702
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25575997
has text: Great! Glad that it was.
type: AnswerComment

http://stackoverflow.com/q/25639173
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25639565
answer count: 3
upvote count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25639423
has title: Getter returning 0 when called from other class
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25639565
accepted answer: http://stackoverflow.com/a/25639200
has answer: http://stackoverflow.com/a/25639200
tagged with: android
tagged with: java
has body: I'm beginner to Android and Java, and i just saw some videos of using getter and setter method in java which worked well when i used the getter and setter method in same class. But when i set the position of an image from main class using setter method and try to retrieve it from my fragment class using getter method its returning 0. there was a similar question asked in stackoverflow which i didn't understand. Please help me out.. My main class: public class Login_Register extends Activity implements OnClickListener { Login login = new Login(); Register register = new Register(); ImageButton LoginB; ImageButton RegisterB; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.login_register); FragmentManager fmanager = getFragmentManager(); LoginB = (ImageButton) findViewById(R.id.login_button); RegisterB = (ImageButton) findViewById(R.id.Reg_button); LoginB.setOnClickListener(this); RegisterB.setOnClickListener(this); } @Override public void onClick(View v) { Positions pos = new Positions(); pos.setLIpos(LoginB.getY()); pos.setRIpos(RegisterB.getY()); FragmentTransaction transaction = fmanager.beginTransaction(); switch (v.getId()) { case R.id.login_button: transaction.add(R.id.Parent, login, "Loginf"); transaction.addToBackStack("Login"); break; case R.id.Reg_button: transaction.add(R.id.Parent, register, "registerf"); transaction.addToBackStack("registerf"); break; default: break; } transaction.commit(); // TODO Auto-generated method stub } } My fragment class: public class Login extends Fragment implements OnGlobalLayoutListener { EditText UN, Pass; View loginimage, loginusing, loginlayout; // Login_Register Lg=new Login_Register(); @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View login = inflater.inflate(R.layout.login, container, false); // TODO Auto-generated method stub UN = (EditText) login…

http://stackoverflow.com/comment/39965437
type: QuestionComment
comment on: http://stackoverflow.com/q/25587341
type: Comment
has text: It's a keyword, just like `if` or `return`.
score: 0

http://stackoverflow.com/a/25598857
has comment: http://stackoverflow.com/comment/39986481
score: -1
has body: That's maybe because you're using java.util.Date instead of java.sql.Date. Try changing your import to java.sql.Date and see if it works out.
answers question: http://stackoverflow.com/q/25598847
type: Answer
downvote count: 1
upvote count: 0

http://stackoverflow.com/q/25671893
has comment: http://stackoverflow.com/comment/40138449
tagged with: struts1
has title: Struts1 - ActionForm Beans vs ActionForm classes
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40125082
has body: I am new to Struts 1 and I am trying to educate myself via the official documentation provided by apache.org website. The difference between ActionForm Beans and ActionsForm Classes is not completely clear to me. I do understand the standards for creating a java bean. But I am a bit puzzled by the fact that the "ActionForm Classes" section lists principles to create "ActionForm Bean". Why are these listed as two separate items? Shouldn't all Struts ActionForms be created as java beans? Could anyone please enlighten me with an explanation or some examples? Thank you! Here is the information source: 2.3 ActionForm Beans Note: While ActionForm beans often have properties that correspond to properties in your Model beans, the form beans themselves should be considered a Controller component. As such, they are able to transfer data between the Model and View layers. source: http://struts.apache.org/development/1.x/userGuide/building_model.html 4.3 ActionForm Classes An ActionForm represents an HTML form that the user interacts with over one or more pages. You will provide properties to hold the state of the form with getters and setters to access them. ActionForms can be stored in either the session (default) or request scope. If they're in the session it's important to implement the form's reset method to initialize the form before each use. The framework sets the ActionForm's properties from the request parameters and sends the validated form to the appropriate Action's execute method. When you code your ActionForm beans, keep the following principles in mind: . . . source: http://struts.apache.org/development/1.x/userGuide/building_controller.html
has comment: http://stackoverflow.com/comment/40128254
type: Question
tagged with: java

http://stackoverflow.com/comment/39909086
comment on: http://stackoverflow.com/q/25556654
type: Comment
type: QuestionComment
has text: FYI: If you're using Java 7 you should be using try-with-resources. `try (input = new ObjectInputStream(socket.getInputStream())) {}`. This ensures the stream is cleaned up properly.
score: 1

http://stackoverflow.com/comment/40126259
score: 0
has text: Btw... Have u read about java.util.zip??
comment on: http://stackoverflow.com/q/25672921
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25676779
upvote count: 3
tagged with: java
downvote count: 0
has body: I tried the tutorial and when I tried to deploy the webapp(IntelliJ 13.1.4 Ultimate), i got an weird error as shown in the screenshot below. What is the resolution for this error? org.jdom.input.JDOMParseException: Error on line 742: The content of elements must consist of well-formed character data or markup. Complete error
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/52656049
has answer: http://stackoverflow.com/a/25725878
type: UnansweredQuestion
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/40282394
has answer: http://stackoverflow.com/a/25725718
tagged with: spring
has answer: http://stackoverflow.com/a/25679556
answer count: 4
has comment: http://stackoverflow.com/comment/40431665
score: 3
has title: IntelliJ Spring MVC tutorial deployment

http://stackoverflow.com/q/25559190
has answer: http://stackoverflow.com/a/25559228
tagged with: java
downvote count: 1
favorite count: 0
has title: Program terminating before running?
type: Question
has comment: http://stackoverflow.com/comment/39913309
has answer: http://stackoverflow.com/a/25559217
has body: import java.awt.Canvas; public class GSM extends Canvas implements Runnable { //The game state manager public final long secondNS = 1000000000; public final long frameNS = secondNS/60; public boolean running = true; public long now = System.nanoTime(); public long startTime = now; public long lastFrame = now; public long lastSecond = now; public int frames = 0; public void run() { System.out.println("Program started."); while(running) { now = System.nanoTime(); if(now - lastFrame &gt;= frameNS) { lastFrame = now; frames++; } if(now - lastSecond &gt;= secondNS) { lastSecond = now; System.out.println(frames); frames = 0; } } } public static void main(String[] args) { new GSM(); } } Just starting to make a game engine but the program terminates right away. Can someone point out the error? I know there's something missing that will be super obvious and I'm going to facepalm, i appreciate your helps. Thank you!
type: UnansweredQuestion
score: -1
has answer: http://stackoverflow.com/a/25559264
upvote count: 0
has comment: http://stackoverflow.com/comment/39913102
answer count: 3

http://stackoverflow.com/a/25705972
type: Answer
has comment: http://stackoverflow.com/comment/40181732
has body: The catch block only executes if the try block throws an exception. Since this is not the case, no exception will be thrown here. Independent of that, Java requires you to specify an explicit return value even if you think that all code paths in your function throw an exception. While the compiler would be able to figure it out in easy cases (the C# compiler does this, for example) it is theoretically impossible for a compiler to prove that no non-throwing codepaths exist.
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25705950
accepted answer of: http://stackoverflow.com/q/25705950
score: 3

http://stackoverflow.com/comment/40132977
type: Comment
type: QuestionComment
score: 0
has text: I have tried for the same id, and there are records. I have infact tried for every single id in the db, and my code, and my code returns an empty string for every id that works fine when executed in the DB.
comment on: http://stackoverflow.com/q/25679372

http://stackoverflow.com/comment/40339223
has text: Sorry,i think that you miss understand me, i didn't find libjniSolrTest.lib or jniSolrTest.h under the folder target/classes/ for maven , i only found solrtest-0.jar
comment on: http://stackoverflow.com/a/25695635
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39933811
score: 0
comment on: http://stackoverflow.com/q/25570308
type: Comment
has text: http://java67.blogspot.de/2014/05/how-to-compare-two-arrays-in-java-string-int-example.html read this and you will find what you need to do.
type: QuestionComment

http://stackoverflow.com/comment/39927934
score: 0
type: Comment
type: QuestionComment
has text: Have you take a look at `org.springframework.beans.factory.config.CustomScopeConfigurer` you can define it like that : ` ` Then in the Tenant Scope you can do your multi-tenant logic.
comment on: http://stackoverflow.com/q/25564919

jcomponent
type: Tag
tags question: http://stackoverflow.com/q/25641780
tag name: jcomponent
tags question: http://stackoverflow.com/q/25571162

http://stackoverflow.com/q/25605968
has body: I've some issue regarding the deployment order of two applications inside Wildfly 8.1. The problem is that some modules of app2.ear depends of modules from app1.ear, but app1.ear is deployed after app2.ear. I've tried to specify a dependency for app1 like this: &lt;jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;deployment&gt; &lt;dependencies&gt; &lt;module name="app2.ear" /&gt; &lt;/dependencies&gt; &lt;/deployment&gt; &lt;/jboss-deployment-structure&gt; But no luck, app1.ear fails to deploy with this error: {"JBAS014671: Failed services" ... Caused by: org.jboss.modules.ModuleNotFoundException: app2.ear:main"}} Any idea if it is possible and how to dot it ? Thx in advance.
score: 9
type: AnsweredQuestion
has title: How to set deployment order of two ears in Wildfly
tagged with: wildfly
downvote count: 0
answer count: 1
favorite count: 0
tagged with: jakarta-ee
type: Question
upvote count: 9
tagged with: java
accepted answer: http://stackoverflow.com/a/25613107
tagged with: jboss
has answer: http://stackoverflow.com/a/25613107
tagged with: deployment

http://stackoverflow.com/comment/39912477
type: Comment
type: QuestionComment
has text: int is a primitive type. Object is a reference type. you can convert a primitive type to a reference that by making autoboxing
comment on: http://stackoverflow.com/q/25558839
score: 0

http://stackoverflow.com/comment/40012480
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25613046
type: Comment
has text: There is a syntax error in your code - a `;` just after the `if` statement, which finishes the `if` block without the body. The following `else` is left without any corresponding `if`.

http://stackoverflow.com/comment/40114399
has text: @RushabhWadkar Glad I could help. If you find the answer helpful, and it solves your problem you can always accept it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25669060
type: AnswerComment

http://stackoverflow.com/q/25678284
has answer: http://stackoverflow.com/a/25678352
has comment: http://stackoverflow.com/comment/40130907
score: 2
type: AnsweredQuestion
answer count: 2
tagged with: for-loop
upvote count: 2
has title: How to search through values in a HashMap to find the highest value, and return both that value and key?
downvote count: 0
tagged with: key
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25678329
has answer: http://stackoverflow.com/a/25678329
tagged with: hashmap
has body: I'm writing a code that requires a comparison of values, but am fairly new to HashMaps and am not sure how to search through all of the values saved. What I'm trying to do is find the highest value of all of the saved values. I want it to go through until the first condition passes, save both that value and key, and continue through until a new value passes through the if-statement condition. double highestNum = 0.0; // 0 set to the default lowest value; saves highest value String highestKey = ""; // used to save the key assosciated w/ highest value for (String high : quantity_hash.keySet()) { if (quantity_hash.get(high) &gt; highestNum) { highestKey = high; } } As of now (I believe), my code will search through the values until the if-statement passes. It will then save that key and value, and then it stops. Any suggestions? edit: I've looked at previous questions, and they seem to just try to find a key associated with a set value, whereas I'm trying to compare all of the values, and save the keys associated with those. highestNum and highestKey should get rewritten multiple times, if necessary.
possible better answer: http://stackoverflow.com/a/25678352
tagged with: compare
tagged with: java

http://stackoverflow.com/comment/40133054
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25679570
has text: Um... because `replaceAll("\\s", "\\\\")` would remove the whitespace?

http://stackoverflow.com/q/25686949
has title: why is the statement in finally block executed despite using return in try block
has answer: http://stackoverflow.com/a/25687035
answer count: 4
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/40146105
has comment: http://stackoverflow.com/comment/40146126
has body: I don't get why is the statement in finally block being executed despite using return statement in try block. The return statement, as i know, returns the execution to the main. If am using return in try block that means execution of try ends at that point and control goes into the main. Then why statement in finally is executed? class a { public static void main(String arr[]) { try { System.out.println("hello1"); return; } finally { System.out.println("hello2"); } } }
possible better answer: http://stackoverflow.com/a/25686976
downvote count: 1
linked to: http://stackoverflow.com/q/65035
favorite count: 0
accepted answer: http://stackoverflow.com/a/25687015
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25686976
score: 3
duplicate of: http://stackoverflow.com/q/65035
has answer: http://stackoverflow.com/a/25687015
has answer: http://stackoverflow.com/a/25687022
tagged with: java

http://stackoverflow.com/comment/40203006
has text: Hi again SparkOn. I managed to implement the PrepareStatement, but I am still having trouble to enter the date using the JDateChooser from the JCalendar library. I even tried the java.sql.Date class conversion that you mentioned before, and nothing. Thanks for your help again.
type: Comment
comment on: http://stackoverflow.com/a/25697918
type: AnswerComment
score: 0

http://stackoverflow.com/q/25556405
answer count: 2
tagged with: android
has body: I have an Android app that parses a RSS feed. The "date" item returns the date in this format: "Mon, 16 Jun 2014 14:31:00 +0000". How can I convert this to the default device format?
type: AnsweredQuestion
score: 0
tagged with: java
has title: Format date in Android
tagged with: formatting
tagged with: date
possible better answer: http://stackoverflow.com/a/25556487
linked to: http://stackoverflow.com/q/6981505
accepted answer: http://stackoverflow.com/a/25556484
has answer: http://stackoverflow.com/a/25556487
has answer: http://stackoverflow.com/a/25556484
type: Question

http://stackoverflow.com/a/25676994
type: Answer
downvote count: 1
upvote count: 6
answers question: http://stackoverflow.com/q/25676911
score: 5
has body: I would not use Reflection here: it's using a bazooka for killing a mosquito. I'd rather use plain Java. Check this example below: List&lt;Item&gt; myList = new ArrayList&lt;Item&gt;(); String userInputValue; // * Add some items to myList // ... // * Get user input value // ... // * Access the array list int len=myList.size(); for(int i=0; i&lt;len; i++) { if (myList.get(i).getItemName().equals(userInputValue)) { // Do something ... } }
accepted answer of: http://stackoverflow.com/q/25676911
type: AcceptedAnswer

http://stackoverflow.com/comment/39951923
type: Comment
type: QuestionComment
score: 0
has text: Where is `tilearray` declared and initialized? Maybe this is null. Try to debug your code.
comment on: http://stackoverflow.com/q/25579769

http://stackoverflow.com/a/25558223
score: 47
upvote count: 47
has comment: http://stackoverflow.com/comment/72748940
downvote count: 0
answers question: http://stackoverflow.com/q/25556624
has body: Your POJO classes do not fit to your XML. The structure is simpler than you thought. See below example: @JacksonXmlRootElement(localName = "open") class OpenCredentials { @JacksonXmlProperty(localName = "creds") @JacksonXmlElementWrapper(useWrapping = false) private Credentials[] credentials; //getters, setters, toString } class Credentials { @JacksonXmlProperty(isAttribute = true) private String priv; @JacksonXmlProperty(isAttribute = true) private String type; private String user; @JacksonXmlProperty(localName = "client_token") private String clientToken; @JacksonXmlProperty(localName = "client_secret") private String clientSecret; //getters, setters, toString } Simple usage: XmlMapper mapper = new XmlMapper(); OpenCredentials openCredentials = mapper.readValue(XML, OpenCredentials.class); System.out.println(openCredentials); Above program prints (for your XML): OpenCredentials{credentials=[Credentials{priv='write', type='internal', user='Username1', client_token='abcplaudzrbcy37c', client_secret='0cxDE3LE0000='}, Credentials{priv='read', type='internal', user='Username1', client_token='123plaudzrbcy37c', client_secret='0cxDE3LE1234='}, Credentials{priv='none', type='internal', user='Username1', client_token='000plaudzrbcy37c', client_secret='0cxDE3LEabcd='}]} See also: jackson-dataformat-xml. Home: Jackson XML databind Wiki.
accepted answer of: http://stackoverflow.com/q/25556624
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/39919346
score: 0
comment on: http://stackoverflow.com/q/25562479
type: Comment
type: QuestionComment
has text: hey it worked with gif.

http://stackoverflow.com/a/25615085
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25615068
has body: Make your method an instance method and create an instance of the class you can pass to your Thread instance public static void main(String[] args) { GetData getData = new GetData(new MyMainClass()); getData.start(); } public void useText(String text) { System.out.println(text); // do something... } In the GetData class' run method, you can then use the MyMainClass instance as a callback. public GetData extends Thread { public GetData(MyMainClass instance) { this.instance = instance; } private MyMainClass instance; @Override public void run() { String text; /* Download text from HTTP and save it to "text". * Every 1 seconds to about 10 minutes using stream API. * text= "abc..."; * If there are no errors, run method never exit. */ instance.useText(text); } }
answers question: http://stackoverflow.com/q/25615068
type: Answer
has comment: http://stackoverflow.com/comment/40016407
has comment: http://stackoverflow.com/comment/40016365
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/40069282
type: AnswerComment
score: 1
has text: @RyanMarv yes from a performance point of view there shouldn't be any difference. If you need integer positions only consider using `java.awt.Point` or using a more expressive name than "Pair" :)
comment on: http://stackoverflow.com/a/25643288
type: Comment

http://stackoverflow.com/comment/40127532
type: QuestionComment
comment on: http://stackoverflow.com/q/25676392
score: 0
has text: Before you start screwing with the painting chain, take a look at [Painting in AWT and Swing](http://www.oracle.com/technetwork/java/painting-140037.html) and understand how the process actually works...
type: Comment

http://stackoverflow.com/comment/40024443
has text: `:` is used to make a `if-else` statement, boolean running = value1.equals("run")? true `:` false;
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25619568
type: Comment

http://stackoverflow.com/comment/40121101
comment on: http://stackoverflow.com/a/25672763
type: AnswerComment
score: 0
type: Comment
has text: Well, I answered your original question about validating that 2 text fields are populated on a button click. If it answered THAT question, then mark it as correct. If not, then I can explain further. If you have an additional questions about your project, I would suggest starting a new question, that has a [Minimal, Complete, Verifiable Example](http://stackoverflow.com/help/mcve) that demonstrates the specific problem you're having.

http://stackoverflow.com/comment/40183060
comment on: http://stackoverflow.com/q/25706679
score: 1
has text: What does logcat say?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39985728
type: AnswerComment
has text: Thanks this is what I was looking for. but what do you mean by JOption in the secondline?
score: 0
comment on: http://stackoverflow.com/a/25598308
type: Comment

http://stackoverflow.com/a/25626977
has comment: http://stackoverflow.com/comment/40039761
has comment: http://stackoverflow.com/comment/40039198
type: Answer
has body: @XmlID &amp; @XmlIDREF is to facilitate references within a single XML document. http://blog.bdoughan.com/2010/10/jaxb-and-shared-references-xmlid-and.html If you have a model generated from multiple XML schemas into multiple packages then you need to make sure the JAXBContext is created to be aware of all these classes. One way to do this is creating the JAXBContext on a colon delimited String of package names. JAXBContext.newInstance("com.example.pkg1:com.example.pkg2:com.example.pkg3");
has comment: http://stackoverflow.com/comment/40039958
has comment: http://stackoverflow.com/comment/40038875
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40039412
has comment: http://stackoverflow.com/comment/40072383
downvote count: 0
answers question: http://stackoverflow.com/q/25626350
has comment: http://stackoverflow.com/comment/40038954

http://stackoverflow.com/q/25700459
tagged with: hadoop
accepted answer: http://stackoverflow.com/a/25708285
answer count: 2
has answer: http://stackoverflow.com/a/25708285
tagged with: hadoop2
downvote count: 0
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25703223
has answer: http://stackoverflow.com/a/25703223
score: 1
tagged with: java
tagged with: hadoop-streaming
has title: Can a existing mapreduce program be made to run from a specified offset of input file
tagged with: mapreduce
has body: Is there any way to run an existing mapreduce program so that it processes only from a given offset of the input file? Eg: If given offset is 500, the mapreduce program should start processing input file from 500th byte.
favorite count: 0
type: Question

http://stackoverflow.com/comment/40025822
comment on: http://stackoverflow.com/q/25617806
type: QuestionComment
has text: Thanks. I have just started learning Selenium Webdriver and dont know many things.
type: Comment
score: 0

http://stackoverflow.com/a/25712715
has body: Try this instead: DateFormat formatter = new SimpleDateFormat("E, d MMMM yyyy", Locale.ENGLISH); Log.v("APP", formatter.format(dateOfItem)); Using dateOfItem.toString() uses its own output format.
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25712658
type: Answer

http://stackoverflow.com/q/25556165
accepted answer: http://stackoverflow.com/a/25556767
possible better answer: http://stackoverflow.com/a/25557197
favorite count: 0
has comment: http://stackoverflow.com/comment/39907164
has title: Having trouble converting integer color for cyan to RGB
has comment: http://stackoverflow.com/comment/39907449
type: Question
has answer: http://stackoverflow.com/a/25556767
has answer: http://stackoverflow.com/a/25557197
tagged with: colors
upvote count: 2
tagged with: modulo
tagged with: modulus
tagged with: rgb
has body: There is a simple algorithm to convert integer values to RGB value of three numbers between 0-255 at integer to rgb. I got the integer number from Android Colors. I even ran: System.out.println(Color.decode("-16711681")); and the answer was java.awt.Color[r=0,g=255,b=0], which is expected. I literally have an issue on step one, -16711681 % 256 is 255, and I expect 0 for the red color. In Java I coded: System.out.println(-16711681 % 256); and I get -1, which means I have to add 256 and my red color is 255. Can someone help me?
score: 2
type: AnsweredQuestion
answer count: 2
tagged with: java
downvote count: 0

http://stackoverflow.com/a/25610036
has comment: http://stackoverflow.com/comment/40007729
has comment: http://stackoverflow.com/comment/40007392
accepted answer of: http://stackoverflow.com/q/25609720
type: AcceptedAnswer
downvote count: 0
has body: Here is an example recursive BigInteger version using a memoization optimization and supporting the "negafibonacci", private static Map&lt;Integer, BigInteger&gt; memo = new TreeMap&lt;&gt;(); private static final BigInteger NEGATIVE_ONE = new BigInteger("-1"); public static BigInteger fib(final int n) { if (n &lt; 0) { // This if block adds the "negafibonacci" support. final int p = Math.abs(n); final boolean even = p % 2 == 0; if (even) { return NEGATIVE_ONE.multiply(fib(p)); } return fib(p); } else if (n == 0) { return BigInteger.ZERO; } else if (n == 1 || n == 2) { return BigInteger.ONE; } if (memo.containsKey(n)) { return memo.get(n); } BigInteger r = fib(n - 1).add(fib(n - 2)); memo.put(n, r); return r; } public static void main(String[] args) { for (int i = -8; i &lt;= 8; i++) { System.out.println(fib(i).toString()); } } When I run the above I get a sequence that matches the one from Wikipedia - −21 13 −8 5 −3 2 −1 1 0 1 1 2 3 5 8 13 21 Finally, I created a simple benchmark - public static void main(String[] args) { long current = System.currentTimeMillis(); for (int i = 1; i &lt; 1000; i++) { System.out.println(fib(i)); } long end = System.currentTimeMillis(); System.out.printf("Ran in: %d milliseconds", end - current); } When I calculate the first 999 fibonacci numbers it completes in under 200 milliseconds. If you really wanted to optimize further you could look into the Closed-form Expression.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40007036
answers question: http://stackoverflow.com/q/25609720
has comment: http://stackoverflow.com/comment/40007150
type: Answer
has comment: http://stackoverflow.com/comment/40007294
has comment: http://stackoverflow.com/comment/40007466

http://stackoverflow.com/a/25707473
has body: You will need to define a custom XmlAdapter. The complicated part in your case is that you want to map one XML element into multiple Java Element objects. This means that, in Java., your XmlAdapter needs to be configured for collection of Element objects. Assuming your example XML fragment is part of a document: <elements> .... <elements> Then you will need to configure the XmlAdapter for the List field in the Java Document class: class Document { @XmlJavaTypeAdapter(CustomAdapter.class) List elements; } Then you your CustomAdapter class can receive a list of Element objects (corresponding to the actual XML structure with the nested items) and produce a list of Element with the structure you want. For an example, check JAXB XmlAdapter – Customized Marshaling and Unmarshaling
type: AcceptedAnswer
score: 6
downvote count: 0
answers question: http://stackoverflow.com/q/25704853
upvote count: 6
type: Answer
accepted answer of: http://stackoverflow.com/q/25704853

http://stackoverflow.com/a/25634968
type: Answer
accepted answer of: http://stackoverflow.com/q/25634949
has body: Recall that binary representation of even numbers has the least significant bit set to zero. Now the solution is easy: mask the last bit with 1 using bitwise AND, and compare the result to zero. If you get a zero, the number is even; otherwise, it is odd. boolean isEven(int a) { return (a &amp; 1) == 0; } When you do a &amp; 1, you get the result that is either 1 or zero, depending on the value of the last bit. The jargon for this is "bit masking": in this case, 1 is used as a bit mask.
answers question: http://stackoverflow.com/q/25634949
downvote count: 0
upvote count: 7
type: AcceptedAnswer
score: 7

http://stackoverflow.com/a/47014531
answers question: http://stackoverflow.com/q/25664811
has comment: http://stackoverflow.com/comment/139844439
upvote count: 1
has comment: http://stackoverflow.com/comment/100631826
score: 1
type: Answer
has body: I faced a similar issue in 7.0.82. In 7.0.57 the httpRequest.getSession(false) returned a session (the session was already created), but in 7.0.82, it was returning null. Absolutely no code change, only the tomcat was upgraded. I was able to resolve this by adding the JsessionId cookie manually. HttpSession session = request.getSession(false); Cookie userCookie; if (request.getParameter("JSESSIONID") != null) { userCookie = new Cookie("JSESSIONID", request.getParameter("JSESSIONID")); } else { String sessionId = session.getId(); userCookie = new Cookie("JSESSIONID", sessionId); } response.addCookie(userCookie);
downvote count: 0

http://stackoverflow.com/comment/40102842
score: 0
comment on: http://stackoverflow.com/a/25662101
type: Comment
type: AnswerComment
has text: onClick Working Now..?

http://stackoverflow.com/comment/39986819
has text: That is the class name of my onCreateView()
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25598996

http://stackoverflow.com/comment/40070638
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25645180
has text: What's the specific issue? Looks like a simple set of numeric comparisons, no?
type: Comment

http://stackoverflow.com/q/25670917
accepted answer: http://stackoverflow.com/a/25671097
tagged with: deployment
has body: I created a dynamic web project in eclipse and then export it as war file. I successfully deployed the war file using tomcat manager. The problem is when i try to access it , tomcat gives me 404 error. I don't have files such as index.html inside the web app.
has comment: http://stackoverflow.com/comment/40117315
type: Question
has answer: http://stackoverflow.com/a/25671097
has title: Error deploying WAR files
answer count: 1
downvote count: 0
upvote count: 1
tagged with: war
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40117347
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/25629696
downvote count: 0
upvote count: 1
has body: Instead of searching in PATH or using File.canExecute(), you could start Process and catch the exceptions (haven't tested though) Process process = new ProcessBuilder("ls").start();
answers question: http://stackoverflow.com/q/25629588
score: 1
type: Answer

http://stackoverflow.com/a/25681995
answers question: http://stackoverflow.com/q/25679521
score: 0
type: Answer
has body: Use Regular expression and replaceAll(String regex,String replacement) \s matches every white Whitespace characters and+ matches the preceding pattern element one or more times. So please try this: public static void main(String[] args){ String s="Abc def ghi"; String output = s.replaceAll("\\s+", "\\\\"); System.out.println(output);// output :Abc\def\ghi }

http://stackoverflow.com/q/25702379
favorite count: 0
tagged with: hashmap
has body: Im trying to merge two lists into a new list with all the values of the two staying at the same index as the originals, while not adding to the new list length. List A contains one number at random indexes, some are null, numbers are between 1-3. List B contains numbers 123 on all indexes. I tried using a for loop and list add, but then it gave me a indexoutofbounds because it seems that list add pushes the content of the list when it adds a value. Im now trying to use hashmap: lists: Int arraylength = 10; ArrayList&lt;Integer&gt; mergeballs = new ArrayList&lt;&gt;(arraylength); // merging list A // contenent: null,3,null,null,2,3,null,1,null,2 ArrayList&lt;Integer&gt; hats = new ArrayList&lt;&gt;(arraylength); // merging list B //contenent: 123,123,123,123,123,123,123,123,123,123 ArrayList&lt;Integer&gt; hatsMerged = new ArrayList&lt;Integer&gt;(arraylength); // A &amp; B merged for (int o = 0; o &lt; stickarray.length; o++) { HashMap&lt;Integer, Integer&gt; map = new HashMap&lt;Integer, Integer (arraylength); map.put(o, hats.get(o) + mergeballs.get(o)); hatsMerged.add(o,map.get(o)); System.out.print(hatsMerged.get(o)); } With this code im also getting a index out of bounds and hats and mergeballs are getting summarized, which I do not want. I want it to be: 123,1233,123,123,1232,1233,123,1231,123,1232 How can I do this? and is hashmap the best option?
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25702622
type: UnansweredQuestion
score: -1
tagged with: list
has title: Merging two lists into a new list, index to same index, while not adding to length
has answer: http://stackoverflow.com/a/25702499
has comment: http://stackoverflow.com/comment/40174886
upvote count: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40174911
downvote count: 1

http://stackoverflow.com/comment/40072828
comment on: http://stackoverflow.com/q/25646346
type: QuestionComment
has text: are you wanting to use singletons ?
type: Comment
score: 0

http://stackoverflow.com/comment/51066970
type: AnswerComment
score: 4
has text: @EvaMariam Default scope has always been singleton.
type: Comment
comment on: http://stackoverflow.com/a/25583493

http://stackoverflow.com/comment/40067010
score: 0
type: AnswerComment
has text: Nekojimi,that means by default log files wont store any where if dont use Handler object?
comment on: http://stackoverflow.com/a/25643079
type: Comment

http://stackoverflow.com/comment/39949051
has text: You state, `"javac cannot find this class : StreamedTextArea() which I assumed was part of java.awt.*"` -- Rather than making this assumption, don't assume, since a quick look at the Java API will tell you that it's not, and so that is the first place you should go for this type of question. Since you found this code in a book or online, I suppose the code for this class may be in this book or online as well.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25578202
type: QuestionComment

http://stackoverflow.com/a/25678201
has comment: http://stackoverflow.com/comment/40134290
type: Answer
has comment: http://stackoverflow.com/comment/40134079
has comment: http://stackoverflow.com/comment/40134033
score: 1
downvote count: 0
upvote count: 1
has body: you don't want to use the * in your servlet mapping. simply because everytime that you have /user/ in your URL it will redirect back to the servlet. the asterisk accepts every URL that has /user/ and redirect it based on servlet mappiing, so you might want to make it User /user/User and use it in your action as action = user/User
has comment: http://stackoverflow.com/comment/40134262
answers question: http://stackoverflow.com/q/25677974

http://stackoverflow.com/comment/40069464
score: 0
type: Comment
type: QuestionComment
has text: one call is replacing the div and then that register page is replacing there then it appears.
comment on: http://stackoverflow.com/q/25643264

http://stackoverflow.com/q/25601112
has answer: http://stackoverflow.com/a/25601217
type: UnansweredQuestion
score: 0
has body: I am making a http post request in java and I need to see the xml which is sent in the request. Is there a way to see that xml in java ? Please provide the method to print the request xml sent. Sample code in java : public static void main(String[] args) { // TODO Auto-generated method stub HttpClient cl = new HttpClient(); PostMethod postMethod = new PostMethod("***URL***"); NameValuePair[] params = { new NameValuePair("dealerId", "***sampleDealerId***"), new NameValuePair("queryId", "***sampleQueryId***") }; postMethod.setRequestBody(params); cl.getParams().setAuthenticationPreemptive(true); Credentials defaultCreds = new UsernamePasswordCredentials("***user***", "***password***"); cl.getState().setCredentials(AuthScope.ANY, defaultCreds); try { try { cl.executeMethod(postMethod); } catch (IOException e) { e.printStackTrace(); } BufferedReader br; try { System.out.println(postMethod.getStatusCode()); System.out.println(postMethod.getStatusText()); br = new BufferedReader(new InputStreamReader(postMethod.getResponseBodyAsStream()),256); String line; char[] chars = new char[256]; while (br.read(chars) != -1) { System.out.println(chars); chars = new char[256]; } } catch (IOException e) { e.printStackTrace(); } } finally { postMethod.releaseConnection(); } }
tagged with: java
has title: How to extract the xml sent in a Http Post request through java?
answer count: 1
tagged with: http
tagged with: https
tagged with: http://stackoverflow.com/tag/xml
type: Question

http://stackoverflow.com/comment/40456855
type: Comment
comment on: http://stackoverflow.com/a/25670752
type: AnswerComment
has text: Ok, first, you can always read (Monitor) the wire to any specific port and read whatever is on it. this is, even if you are not in the TCP session (assuming that you are using TCP) you can get the packages (like wireshark). Second, if you are not talking about application layer, I still don't understand your question.
score: 0

http://stackoverflow.com/a/25563221
upvote count: 1
type: Answer
score: 1
has body: int d = 9; d += d = 3; First d = 9. Then d += d = 3 which means: Let `d` equal to `d` plus the result of `d=3`. ^ ^ 9 3 So let d equal to 9 plus 3 which is 12.
answers question: http://stackoverflow.com/q/25563111
downvote count: 0

http://stackoverflow.com/a/25711047
score: 5
has comment: http://stackoverflow.com/comment/40190773
answers question: http://stackoverflow.com/q/25710763
type: AcceptedAnswer
upvote count: 5
type: Answer
has body: A specialization of the Model interface that controllers can use to select attributes for a redirect scenario. Since the intent of adding redirect attributes is very explicit -- i.e. to be used for a redirect URL. @RequestMapping(value = "/delete", method = RequestMethod.GET) public String DeleteAction(Model model, Object object, @RequestParam int id RedirectAttributes attributes) { object.delete(id); attributes.addFlashAttribute("success", "Object has been removed successfully."); return "redirect:" + "index"; }
has comment: http://stackoverflow.com/comment/40202632
has comment: http://stackoverflow.com/comment/107539529
has comment: http://stackoverflow.com/comment/46477041
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25710763

http://stackoverflow.com/a/25598056
score: 5
answers question: http://stackoverflow.com/q/25585581
upvote count: 5
type: Answer
has body: E is a type variable -- it stands in for some other type, like String or Integer. So just as you can't understand dst.add(pop()) without knowing where and how dst was defined, you can't understand a method declaration like popAll(Collection&lt;E&gt; dst) without knowing where and how the type variable E is defined. In the case of popAll, the type variable E is defined at the class level: Stack&lt;E&gt;: it's the type of the elements in the stack. You'll often even see it javadoc'd: /**A Stack of elements * *@param E The type of elements in the stack */ public class Stack&lt;E&gt;{ public void popAll(Collection&lt;E&gt; dst){ ... } } On the other hand, when you see a method declaration like public &lt;E&gt; void ..., the type variable E is being declared (not referenced from some enclosing scope like the enclosing class). In fact most times when you see a method with its own type variable, it's a static method, so there is no enclosing instance of the class to establish the value of E. In both cases, what is the E type variable doing? It's telling us how two different types have to relate to each other. In popAll, it's telling us that the element type of the collection you want to put the popped elements into has to match the element type of the stack you're popping them from. Similarly, take the example from page 136: public class ListUtils{ public static &lt;E&gt; E reduce(List&lt;E&gt; list, Function&lt;E&gt; f, E initVal); } Here, the E type variable tells us that the element type of list has to match the argument type of f and the type of initVal. The surrounding class does not define E for us, it's only meaningful in the scope of the reduce method declaration.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25585581

http://stackoverflow.com/q/25602557
has comment: http://stackoverflow.com/comment/39993333
score: 1
has answer: http://stackoverflow.com/a/25603336
has comment: http://stackoverflow.com/comment/39993990
tagged with: java
tagged with: hibernate
answer count: 1
downvote count: 0
upvote count: 1
has title: ConcurrentModificationException while saving large collections in Hibernate
favorite count: 0
has comment: http://stackoverflow.com/comment/39993782
type: Question
has comment: http://stackoverflow.com/comment/39993628
type: UnansweredQuestion
has body: I have the following problem: I have an application which sends a DatabaseJob to a queue in a separate thread, when an entity should be saved in the database. While the queue has jobs, this worker thread takes the first job from the queue and uses Hibernate to save it. In general this works quite fine. The problem I have, appears when trying to save large collection (1000+) entries. It can happen that the collection is modified while Hibernate tries to flush it to the database, resulting in the following ConcurrentModificationException. 2014-09-01 10:37:57,301 ERROR [DatabaseManager] [Thread: database-message-queue] Hibernate - Unhandled Exception during saving java.util.ConcurrentModificationException at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:711) at java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:734) at org.hibernate.collection.internal.PersistentSet.getSnapshot(PersistentSet.java:96) at org.hibernate.engine.spi.CollectionEntry.afterAction(CollectionEntry.java:246) at org.hibernate.action.internal.CollectionUpdateAction.execute(CollectionUpdateAction.java:105) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:463) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:349) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1222) at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:425) at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:177) All collections I use are made safe for concurrent access by using Collections.synchronizeXXX, but for iterating it has to be synchron…
tagged with: multithreading

http://stackoverflow.com/comment/40152699
type: QuestionComment
has text: please understand there is a difference between class not found and class def not found
score: 0
comment on: http://stackoverflow.com/q/25690337
type: Comment

http://stackoverflow.com/comment/40072399
has text: @vmr Basically MongoDB library is trying to get SpringVersion, by making call to SpringVersion.getVersion(), and in some env this call is failing as per the spring docs due to classloader not exposing package metadata
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25646047
type: QuestionComment

http://stackoverflow.com/q/25587091
downvote count: 0
tagged with: selenium
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25587205
type: Question
has title: Selenium "cannot resolve symbol"
has answer: http://stackoverflow.com/a/25587205
tagged with: maven
upvote count: 1
has comment: http://stackoverflow.com/comment/39965038
has comment: http://stackoverflow.com/comment/39965102
has comment: http://stackoverflow.com/comment/39964998
has comment: http://stackoverflow.com/comment/39964951
answer count: 1
has comment: http://stackoverflow.com/comment/39965202
has body: I followed this tutorial : https://www.youtube.com/watch?v=VZxpv5l5JvY&amp;feature=share&amp;list=PLrM2ELpRbbu5cWJbRuzpAr6SR40Gb0QHU&amp;index=10 Then instead of typing my own code I copy/pasted the code given by selenium IDE export function (I recorded my actions first) into the class file. But I get all these errors, unknown symbols, why is that, isn't maven supposed to resolve them ? I did eveything they say in the tutorial... https://picload.org/image/cglicod/selnium.jpg What is going on, all I want is to get this IDE exported code to work.
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40100270
type: Comment
score: 0
type: AnswerComment
has text: @user130004 I know, I'm just arguing that it may be cause of conflicts to use both `register` and `register*`... you should try to change the name of one of them, as a test. Also consider upvoting (not accepting) the answer if `Your suggestions helped me a lot`, to compensate haters downvoting for no reasons :/
comment on: http://stackoverflow.com/a/25639720

http://stackoverflow.com/a/25660513
answers question: http://stackoverflow.com/q/25659359
has body: There are no other ways. Imagine the following method: Result doSomething(A arg1, B arg2, C arg3) { ... } Because you are calling your EJB using remote connection, the client will serialize arg1, arg2 and arg3. At this point, they are completely new instance, say arg1', arg2' and arg3'. They are probably not even on the same JVM, and if it were, you should not rely on that (some EJB container use reference when they determine that caller and called are in the same JVM). Returning a Result, taking those argN' updated is the only way: Result doSomething(A arg1, B arg2, C arg3) { ... return new Result(arg1, arg2, arg3); } Then the container will serialize Result, and arg1', arg2' and arg3', and the caller will receive Result' containing arg1", arg2" and arg3".
score: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40102034
has comment: http://stackoverflow.com/comment/40103033
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25659359
type: AcceptedAnswer

http://stackoverflow.com/comment/40051107
type: Comment
score: 0
type: AnswerComment
has text: Hmm, I'll try changing that to see if it helps. I see what you're saying. I think you're on to something here, because I too don't think the DatagramSocket class is concurrent.
comment on: http://stackoverflow.com/a/25633970

http://stackoverflow.com/a/25625234
type: Answer
answers question: http://stackoverflow.com/q/25624458
has body: Simple answer: Yes (for certain definitions of disable). You are completely free to exercise whatever forms of navigation control on your website, and create a series of once-only urls, which must be accessed in a specific order, thus rendering the back button useless. (you could even cause re-visiting these urls to return to a pre-defined homepage) Common misconceptions: You can use javascript to control a browser on a client. - You can't, there's no two ways about it, the javascript is out of your control and can be modified by a 7year-old (this is a conservative estimate based on experience, not expectation.), Preventing backwards navigation is always hacky and/or bad. Certain things should really attempt to do this better - Ever done an online quiz, or memory game? Solution: please note this will not disable the button, and will instead invalidate requests made to a 'previous' url Include a key in every request (which changes for every subsequent request), and is associated with the HttpSession, this could then be included in form submission - bear in mind, someone who knows what they're doing can still extract this and use it to travel backwards, so it is also worthwhile ensuring that your key can only be used for a specific subset of pages from your entire site (those allowed). Many easy ways to do this, personally I am a fan of primes and hashes. also note, refreshing a page with this could cause you grief if you have not considered your desired behaviour. Do so, and implement it.
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/25587295
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25587208
upvote count: 1
has body: You can take advantage of SwingWorkers Future heritage and use isCancelled and cancel functionality... protected Void doInBackground() throws Exception { int i = 0; while (!isCancelled() &amp;&amp; i &lt; howMany) { ... In order to be able to cancel the worker, you will need a reference to it... private SwingWorker worker; //... stopButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (worker != null) { worker.cancel(true); } } }); Note, SwingWorker should not be accessing or referencing any UI components (in fact, you should avoid referencing any values outside of it's context where possible), because it runs in the background, you run the risk of (not only) violating the single thread rules of Swing, but also having the information you are relying on changed while you are processing it. You should gather all the information that the SwingWorker needs and pass that information to it (via the constructor or setter methods) before you start it. This means that the worker is running in isolation without the risk of other data changing which could cause other, random issues.
score: 1

cordova
tags question: http://stackoverflow.com/q/25601522
tags question: http://stackoverflow.com/q/25657749
tags question: http://stackoverflow.com/q/25642001
tags question: http://stackoverflow.com/q/25563151
type: Tag
tag name: cordova
tags question: http://stackoverflow.com/q/25695519

http://stackoverflow.com/comment/40054666
has text: `Unresolved compilation problem` means there was a compilation error in the source code. You need to show the compilation error messages.
comment on: http://stackoverflow.com/q/25635946
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/25655366
tagged with: random
answer count: 3
has comment: http://stackoverflow.com/comment/40090167
tagged with: java
has body: I was going through some coding exercises, and had some trouble with this question: From 5 dice (6-sided) rolls, generate a random number in the range [1 - 100]. I implemented the following method, but the returned number is not random (called the function 1,000,000 times and several numbers never show up in 1 - 100). public static int generator() { Random rand = new Random(); int dices = 0; for(int i = 0; i &lt; 5; i++) { dices += rand.nextInt(6) + 1; } int originalStart = 5; int originalEnd = 30; int newStart = 1; int newEnd = 100; double scale = (double) (newEnd - newStart) / (originalEnd - originalStart); return (int) (newStart + ((dices - originalStart) * scale)); }
accepted answer: http://stackoverflow.com/a/25655747
favorite count: 0
has title: From 5 dice rolls, generate a random number in the range [1 - 100]
type: Question
has answer: http://stackoverflow.com/a/25655453
possible better answer: http://stackoverflow.com/a/29177601
has comment: http://stackoverflow.com/comment/40089850
tagged with: dice
has comment: http://stackoverflow.com/comment/40090657
has answer: http://stackoverflow.com/a/29177601
score: 5
tagged with: range
has comment: http://stackoverflow.com/comment/40090640
has comment: http://stackoverflow.com/comment/40090326
downvote count: 1
upvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25655747

http://stackoverflow.com/comment/40121756
comment on: http://stackoverflow.com/q/25672699
score: 1
type: Comment
type: QuestionComment
has text: I think @LucasRoss means how to generate Vector C (what will Vector C contain? All the elements in A followed by all the elements in B? Or will each element in C be the result of some operation of the corresponding element in A and B?).

http://stackoverflow.com/a/25556200
answers question: http://stackoverflow.com/q/25555711
score: 3
upvote count: 3
downvote count: 0
type: Answer
has body: i found answer how to fix it. Insted of using code like: ImageIcon image = new ImageIcon("webPagesBadge.gif"); JOptionPane.showMessageDialog(null, "Some Messsage","Example",JOptionPane.INFORMATION_MESSAGE,image); i use ImageIcon image = new ImageIcon(ImageUtilities.loadImage("webPagesBadge.gif")); JOptionPane.showMessageDialog(null, "Some Messsage","Example",JOptionPane.INFORMATION_MESSAGE,image); and i put image into: Method which i use to load image ImageUtilities.loadImage("webPagesBadge.gif") is from org.openide.util.ImageUtilities

http://stackoverflow.com/q/25639260
has comment: http://stackoverflow.com/comment/40060408
has answer: http://stackoverflow.com/a/25639697
type: Question
has comment: http://stackoverflow.com/comment/40072413
tagged with: android
possible better answer: http://stackoverflow.com/a/25639798
has title: NullPointerException at this.getReadableDatabase();
tagged with: database
has answer: http://stackoverflow.com/a/25639798
linked to: http://stackoverflow.com/q/25616096
accepted answer: http://stackoverflow.com/a/25639697
has comment: http://stackoverflow.com/comment/40060159
type: AnsweredQuestion
score: 0
answer count: 2
tagged with: nullpointerexception
has body: Heyhey :) I looked at several Questions to the same topic, but I found no solution to my problem. A NullPointerException at this.getReadableDatabase(); appears... Here's my Code: public class DatabaseHandler extends SQLiteOpenHelper { public static final int DATABASE_VERSION = 1; public static final String DATABASE_NAME = "TODO_APP"; /*--------------------------- TABLE ITEMS START ---------------------------*/ private static final String TABLE_ITEMS = "items"; private static String KEY_ID_ITEMS = "id_items"; private static final String KEY_CATEGORY_ITEMS = "category"; private static final String KEY_DATETIME_ITEMS = "datetime"; private static String KEY_NAME_ITEMS = "name"; private static final String KEY_DESCRIPTION_ITEMS = "description"; private static final String KEY_ALARM_ITEMS = "alarm"; public DatabaseHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { // create table ITEMS String CREATE_ITEMS_TABLE = "CREATE TABLE " + TABLE_ITEMS + "(" + KEY_ID_ITEMS + " INTEGER PRIMARY KEY," + KEY_CATEGORY_ITEMS + " INTEGER," + KEY_DATETIME_ITEMS + " TIMESTAMP DEFAULT CURRENT_TIMESTAMP," + KEY_NAME_ITEMS + " TEXT," + KEY_DESCRIPTION_ITEMS + " TEXT," + KEY_ALARM_ITEMS + " INTEGER" + ");"; db.execSQL(CREATE_ITEMS_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // Drop older table if existed db.execSQL("DROP TABLE IF EXISTS " + TABLE_ITEMS); // Create tables again this.onCreate(db); } public void addItem(DB_Item item) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_CATEGORY_ITEMS, item.getCategory()); values.put(KEY_NAME_ITEMS, item.getName()); values.put(KEY_DESCRIPTION_ITEMS, item.getDescription()); values.put(KEY_ALARM_ITEMS, item.getAlarm()); // Inserting Row db.insert(TABLE_ITEMS, null, values); db.close(); // Closing database connection } public DB_Item getItem(String name) { //!!!!…
tagged with: java
tagged with: sqlite

http://stackoverflow.com/a/25662821
has body: The problem is in your code: HSSFRow row = ss.createRow((short) ss.getLastRowNum() + 1); you're casting the row index to short. Try this code instead: HSSFRow row = ss.createRow((int) ss.getLastRowNum() + 1);
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/25662747
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25662747
downvote count: 0
score: 6

http://stackoverflow.com/comment/40139279
comment on: http://stackoverflow.com/a/25682565
type: Comment
score: 0
type: AnswerComment
has text: JSP : http://pastebin.com/X5QVdfaf Servlet : http://pastebin.com/KDtMjVQf I already did some tweaking to see if I could figure it out, but it hasn't worked.

http://stackoverflow.com/comment/40174923
comment on: http://stackoverflow.com/a/25698707
has text: Sir which is best gui design makeing tool for CoreJAVA?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40048687
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25611753
score: 0
has text: I wanted to auto redirect when you go into the page. But thanks!

http://stackoverflow.com/q/25646284
accepted answer: http://stackoverflow.com/a/25648549
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40085149
has title: Reading XML tag from MediaWiki using Java
type: Question
has body: I need to read output of 'search' tag from following url usign Java. First I need to read XML into some string from following URL: http://en.wikipedia.org/w/api.php?format=xml&action=query&list=search&srlimit=1&srsearch=big+brother I should end up having this: <searchinfo totalhits="55180"/> Then once I have the XML, I need to get content of the search tag: Output of 'search' tag looks like this and I need to get two parts from the code in the middle: At the end, all I need is to have two strings, which would equal to this: String title = Big Brothers Big Sisters of America String snippet = "Big..." Can someone please help me amending this code, I am not sure what I am doing wrong. I don't think it's even retrieving XML from url, much less the tags inside the XML. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse("http://en.wikipedia.org/w/api.php?format=xml&action=query&list=search&srlimit=1&srsearch=big+brother"); doc.getDocumentElement().normalize(); XPathFactory xFactory = XPathFactory.newInstance(); XPath xpath = xFactory.newXPath(); XPathExpression expr = xpath.compile("//query/search/text()"); Object result = expr.evaluate(doc, XPathConstants.NODESET); NodeList nodes = (NodeList) result; for (int i=0; i<nodes.getLength();i++){ System.out.println(nodes.item(i).getNodeValue()); } Sorry, I am a newbie and can't find the answer to this anywhere.
has comment: http://stackoverflow.com/comment/47993940
has answer: http://stackoverflow.com/a/25648549
tagged with: mediawiki
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/25568806
has answer: http://stackoverflow.com/a/25569103
possible better answer: http://stackoverflow.com/a/25569103
has body: I've checked the methods of the WindowListener interface but it doesn't have an event for this, or for resizing the window. (Actually there is a resized event inheritied from the Component class: (link) but thats all.. Can someone show me how to do something if the user triggers full-screen or leaves it? //By full-screen I mean maximized :))
tagged with: java
tagged with: events
has title: Where is the full-screen window event in Java (Awt)?
type: Question
answer count: 2
upvote count: 3
tagged with: window
downvote count: 0
tagged with: swing
tagged with: awt
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25570044
score: 3
accepted answer: http://stackoverflow.com/a/25570044

http://stackoverflow.com/q/25665377
has answer: http://stackoverflow.com/a/25666131
accepted answer: http://stackoverflow.com/a/25666131
type: Question
has title: How to get maximum sum of numbers drawn from multiple arrays - permutation don't work (16!)
linked to: http://stackoverflow.com/q/25644020
upvote count: 0
tagged with: arrays
downvote count: 1
favorite count: 0
type: AnsweredQuestion
has body: Yesterday I asked about How to find the maximum possible sum of numbers in arrays drawn from a unique array index and I was advise to use permutation - it worked well, but I wasn't aware that my arrays are much bigger than I assumed. I have arrays as big as [16] - so I have 16! possibilites...what could I use instead of permutation to get maximum possible sum? edit. here is my arrays: public static ArrayList&lt;Double[]&gt; tempArrayCreator() { ArrayList&lt;Double[]&gt; tempArray = new ArrayList&lt;&gt;(); Double[] l1 = { 9.0, 13.5, 9.0, 9.0, 9.0, 13.5, 9.0, 13.5, 13.5, 13.5, 9.0, 13.5, 13.5, 9.0, 13.5, 9.0 }; Double[] l2 = { 6.0, 6.0, 13.5, 6.0, 9.0, 6.0, 6.0, 6.0, 6.0, 9.0, 6.0, 6.0, 9.0, 9.0, 6.0, 9.0 }; Double[] l3 = { 22.5, 22.5, 14.0, 22.5, 14.0, 22.5, 22.5, 22.5, 22.5, 21.0, 22.5, 22.5, 21.0, 14.0, 22.5, 14.0 }; Double[] l4 = { 6.0, 6.0, 7.0, 6.0, 7.0, 6.0, 6.0, 6.0, 6.0, 7.0, 9.0, 6.0, 7.0, 7.0, 6.0, 7.0 }; Double[] l5 = { 4.5, 6.75, 6.0, 4.5, 6.0, 6.75, 4.5, 4.5, 6.75, 9.0, 4.5, 6.75, 9.0, 6.0, 6.75, 6.0 }; Double[] l6 = { 6.0, 9.0, 5.0, 6.0, 5.0, 9.0, 6.0, 6.0, 9.0, 7.5, 6.0, 9.0, 7.5, 5.0, 9.0, 5.0 }; Double[] l7 = { 13.5, 13.5, 4.0, 13.5, 4.0, 13.5, 13.5, 13.5, 13.5, 6.0, 13.5, 13.5, 4.0, 4.0, 13.5, 4.0 }; Double[] l8 = { 4.5, 4.5, 4.0, 4.5, 4.0, 4.5, 4.5, 4.5, 4.5, 4.0, 4.5, 4.5, 6.0, 4.0, 4.5, 4.0 }; Double[] l9 = { 10.5, 10.5, 10.0, 10.5, 10.0, 10.5, 10.5, 10.5, 10.5, 10.0, 10.5, 10.5, 10.0, 10.0, 10.5, 10.0 }; Double[] l10 = { 11.25, 11.25, 3.0, 11.25, 3.0, 11.25, 11.25, 11.25, 11.25, 3.0, 11.25, 11.25, 3.0, 3.0, 11.25, 3.0 }; Double[] l11 = { 7.5, 11.25, 10.0, 7.5, 10.0, 11.25, 7.5, 11.25, 11.25, 15.0, 7.5, 11.25, 15.0, 10.0, 11.25, 10.0 }; Double[] l12 = { 7.5, 7.5, 12.0, 7.5, 8.0, 7.5, 7.5, 7.5, 7.5, 8.0, 7.5, 7.5, 8.0, 8.0, 7.5, 8.0 }; Double[] l13 = { 13.5, 13.5, 6.0, 13.5, 6.0, 13.5, 13.5, 13.5, 13.5, 9.0, 13.5, 13.5, 9.0, 6.0, 13.5, 6.0 }; Double[] l14 = { 9.0, 9.0, 8.0, 9.0, 8.0, 9.0, 9.0, 9.0, 9.0, 12.0, 9.0, 9.0, 12.0, 8.0, 9.0, 8.0 }; Doub…
answer count: 3
tagged with: algorithm
has answer: http://stackoverflow.com/a/25665823
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25665690
possible better answer: http://stackoverflow.com/a/25665690
tagged with: permutation

http://stackoverflow.com/comment/40151392
type: Comment
type: QuestionComment
has text: I want that when i move my JLabel, it stays inside of my frame.. and not go outside.
score: 0
comment on: http://stackoverflow.com/q/25689404

http://stackoverflow.com/comment/40007402
score: 2
has text: I would also like to point out that you can simply write `return b.compareTo(a);`
type: Comment
comment on: http://stackoverflow.com/q/25610170
type: QuestionComment

http://stackoverflow.com/q/25613181
has answer: http://stackoverflow.com/a/25613630
tagged with: eclipse
has title: Eclipse plugin and editor
tagged with: editor
score: 0
has answer: http://stackoverflow.com/a/25618011
answer count: 2
type: UnansweredQuestion
tagged with: java
tagged with: file
type: Question
has body: How to open a file outside of the project programically in a new editor window ? I've been searching all over the internet and nothing seems to work. I have eclipse 4.4. I thought something so simple as opening a file will be easy but somehow it keeps me awake at night. Please help.
tagged with: plugins

http://stackoverflow.com/comment/40094729
has text: @GiGa thnx for suggestion. i thought it should work but i'm trying also other ways
comment on: http://stackoverflow.com/q/25657845
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/40031911
type: Comment
type: QuestionComment
has text: This is not duplicate !!!! I wanted to knw how it can be handled in java!!!
comment on: http://stackoverflow.com/q/25622301
score: 0

http://stackoverflow.com/comment/40012430
has text: what do you want to do? please explain. TIA
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25613082

http://stackoverflow.com/q/25691133
has answer: http://stackoverflow.com/a/30320020
tagged with: restlet-2.0
score: 0
answer count: 1
has body: In my ServerResource are two different "Get-Functions" public class ApiKeyRestlet extends ServerResource { @Get("json:json") public ApiKeyResponse apikeyAsJson() throws RecordDoesNotExist { ... } @Get("text:text") public Representation apikeyAsFile() throws RecordDoesNotExist { ... Representation representation = new StringRepresentation(data, MediaType.TEXT_PLAIN); Disposition disposition = new Disposition(Disposition.TYPE_ATTACHMENT); disposition.setFilename("apikey.properties"); representation.setDisposition(disposition); return representation; } ... The path .../apikey is bound to ApiKeyRestlet. If the client sends Accept: text/plain then apikeyAsFile should be called and if the client sends Accept: application/json apikeyAsJson should come into effect. But I can send what I want as Accept-Header its always apikeyAsJson that's called. I think it has something todo with compatibility between these two formats but how can I handle this? I don't want to define two different routes for this. [Update] I debugged through the code and I found that the return type of Representation adds the default MediaType [*/*]. Scoring is alway 0.5 and so always the first function defined in ServerResource will be called - seems to be a bug??? If I define a Accept-Header the score for this request should go up...
type: Question
has comment: http://stackoverflow.com/comment/40250196
type: UnansweredQuestion
tagged with: java
tagged with: restlet
has title: Restlet does not differentiate between different Accept Headers

http://stackoverflow.com/comment/39917723
has text: Nobody can not control the JVM's oplects placement policy. Persistant data could not be placed on stack, because data on stack will be released after execution of certain classes.
type: QuestionComment
comment on: http://stackoverflow.com/q/25561759
score: 1
type: Comment

http://stackoverflow.com/comment/39928110
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25567067
has text: OK, and now you can make your inner while loop a simple for loop as well.
type: Comment

http://stackoverflow.com/a/25649552
has body: there's a plugin to make it work. It works perfectly with modules that are on Maven, not sure about local .jar files, but you sure give it a try: here the plugin page: https://bitbucket.org/hvisser/android-apt and here my build.gradle with it: buildscript { repositories { mavenCentral() } dependencies { ... add this classpath to your buildscript dependencies classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4' } } apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' &lt;&lt; apply the plugin after the android plugin dependencies { // in dependencies you call it apt 'com.company.myAnnotation:plugin:1.0-SNAPSHOT' compile 'com.company.myAnnotation:api:1.0-SNAPSHOT' and it should work.
has comment: http://stackoverflow.com/comment/85458687
has comment: http://stackoverflow.com/comment/40078847
type: Answer
answers question: http://stackoverflow.com/q/25649442
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25649442
type: AcceptedAnswer
downvote count: 0
score: 3

http://stackoverflow.com/comment/40162124
has text: maybe a static class with application context might work? not sure though
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25694261

http://stackoverflow.com/q/25554373
accepted answer: http://stackoverflow.com/a/25554735
answer count: 2
has answer: http://stackoverflow.com/a/25554735
has body: Let's say that I have a Spring 4 web application with a Hibernate-based persistence layer. I'd like to create a RestController that supports basic CRUD operations for my models. Creating a method for fetching records works without a hitch: @RequestMapping(value = "/stuff/list", method = RequestMethod.GET) public List<Stuff> getStuff(){ return stuffService.findAll(); } Jackson handles the object serialization, no problem. But what if I want to add a method for creating new records via a POST request? Is there any easy way to support a simple method like this? @RequestMapping(value = "/stuff/new", method = RequestMethod.POST) public Integer getStuff(@RequestParam("stuff") Stuff stuff){ return stuffService.save(stuff); } Is something like this possible? Or do I need to manually map posted form data to a new object? SOLUTION Here is how I solved my problem, there were a couple steps. First, my final controller method: @RequestMapping(value = "/stuff/new", method = RequestMethod.POST) public Integer getStuff(@RequestBody Stuff stuff){ return stuffService.save(stuff); } I already had a filter applied to all requests to the application API, to allow cross origin resource sharing, but modifications to this were needed to allow requests to specify content type: public class SimpleCORSFilter implements Filter{ @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletResponse response = (HttpServletResponse) servletResponse; response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "x-requested-with, Content-Type"); filterChain.doFilter(servletRequest, servletResponse); } @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void destroy() …
possible better answer: http://stackoverflow.com/a/25554655
has comment: http://stackoverflow.com/comment/39904320
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39904260
tagged with: rest
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
has title: Mapping JSON to Hibernate models in Spring REST Controllers
has answer: http://stackoverflow.com/a/25554655
linked to: http://stackoverflow.com/q/11492325
type: Question

http://stackoverflow.com/comment/40121551
has text: I don't know exactly what is eating your memory, but in general, if you want to ensure something is released, you should explicitly call some `close()` or `release()` method — whatever is appropriate for your object. Perhaps these things support AutoCloseable?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25671326
type: Comment

http://stackoverflow.com/q/25695159
type: UnansweredQuestion
tagged with: java
answer count: 1
has title: error with sending object to another activity
type: Question
has comment: http://stackoverflow.com/comment/40162249
tagged with: android
has comment: http://stackoverflow.com/comment/40162231
tagged with: class
has answer: http://stackoverflow.com/a/25695614
has comment: http://stackoverflow.com/comment/40162548
score: 0
has body: my app always crashes when i send an object to the main activity. I want it so the main activity displays a String from my class but everytime I press the row in the second activity and go back to the main activity the app crashes can someone please help me to fix this, thanks. my class below public class Ship implements Serializable { public String test() { String s = "Hello Android!"; return s; } } Second Activity hangarList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long l) { Intent sendListEvents = new Intent(); if(position == 1) { Ship test = new Ship(); sendListEvents.putExtra("ship1", test); } //insert position events ^^^ setResult(RESULT_OK, sendListEvents); } }); Main Activity below @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == result) { if (resultCode == RESULT_OK) { Intent getData = getIntent(); Ship ship1 = (Ship) getData.getSerializableExtra("ship1"); String s = ship1.test(); test.setText(s); } } }

http://stackoverflow.com/comment/40019480
type: QuestionComment
has text: Integer overflow happening there. Make any one of them to long. That saves you from stop happening integer multiplication.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25616873

subclipse
type: Tag
tags question: http://stackoverflow.com/q/25689161
tag name: subclipse

http://stackoverflow.com/comment/39981296
score: 0
type: Comment
has text: Have you done _any_ research? One google search would have been enough.
type: QuestionComment
comment on: http://stackoverflow.com/q/25595958

http://stackoverflow.com/q/25610964
tagged with: jdbc
has comment: http://stackoverflow.com/comment/40009180
has comment: http://stackoverflow.com/comment/40009105
has comment: http://stackoverflow.com/comment/40009310
answer count: 1
has title: Refactoring similar CSV processing
has body: So I'm currently working on a project which includes updating a H2 Database from several GZIP compressed CSV files using JDBC. I noticed that the processing of the CSV file keeps quite the same. Only the part where I fill the PreparedStatement Object, really differ from each other. Here is a code snippet that I use: InputStream in = getStream(world.getUrl(), true, Configuration.GET_PLAYER_COMPRESSED); Scanner sc = new Scanner(in); PreparedStatement stmt = con.prepareStatement(SQL_UPDATE_PLAYER); String[] line; int i = 0; while (sc.hasNextLine()) { try { line = sc.nextLine().split(","); { //this code differs from the rest stmt.setString(1, world.getIdentifier()); stmt.setInt(2, Integer.valueOf(line[0])); stmt.setString(3, URLDecoder.decode(line[1], "UTF-8")); if ("0".equals(line[2])) { stmt.setNull(4, Types.INTEGER); } else { stmt.setInt(4, Integer.valueOf(line[2])); } } stmt.addBatch(); if (++i &gt;= 1000) { stmt.executeBatch(); //execute batch every 1000 entries i=0; } } catch (Exception e) { e.printStackTrace(); } } stmt.executeBatch(); stmt.close(); sc.close(); Is it a good way to access this problem via a callback-object like in the example below? Callback callback = new Callback() { protected int i; protected PreparedStatement stmt; //called before processing public void preProcess() { int i = 0; //initialisation or whatever } //called on every line public void processLine(String[] line) { stmt.setString(1, world.getIdentifier()); // [...] stmt.addBatch() if(++i &gt;= 1000) { stmt.executeBatch(); i = 0; } } //called after processing lines protected void postProcess() { stmt.executeBatch(); } } processCsv(inputStream, callback);
type: Question
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/27889853
tagged with: refactoring
tagged with: java
has answer: http://stackoverflow.com/a/27889853

http://stackoverflow.com/comment/40099000
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25653301
has text: Debian Wheezy + Java 1.8.0_20x64: it fails with the same error message; Eclipse don't fails.
score: 0

http://stackoverflow.com/comment/40000518
score: 0
type: Comment
has text: Thank you so much! It works perfect... but I can't understand why this work... can you explain me? thanks
type: AnswerComment
comment on: http://stackoverflow.com/a/25588447

http://stackoverflow.com/q/25672682
has comment: http://stackoverflow.com/comment/40120354
accepted answer: http://stackoverflow.com/a/25672749
has body: I have a slight problem with my program and I'm sure it lies in this loop and if-else statement: for (int i = 0; i &lt; xArray.length; i++) { if(searchNumber == xArray[i]) { found = true; if(found) { System.out.println("We have found your number " + searchNumber + " at position " + i + " in the array. " ); } else { System.out.println("No match was found."); } break; } } What happens when I execute the program is that if the searchNumber (which is taken via the Scanner with keyboard input) is found then it will display the appropiate message saying it was found, but if it isn't found no message is displayed. I tried debugging it by talking myself through what every line of code is doing, but when I got to this loop I got very confused.
has comment: http://stackoverflow.com/comment/40120410
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40120429
tagged with: if-statement
has comment: http://stackoverflow.com/comment/40120428
tagged with: java
tagged with: break
has comment: http://stackoverflow.com/comment/40120417
has comment: http://stackoverflow.com/comment/40120461
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25672749
tagged with: for-loop
answer count: 5
upvote count: 1
has title: If-else statement in Java
has comment: http://stackoverflow.com/comment/40120432
has answer: http://stackoverflow.com/a/25672898
possible better answer: http://stackoverflow.com/a/25672898
downvote count: 1
has comment: http://stackoverflow.com/comment/40120380
has answer: http://stackoverflow.com/a/25672724
has answer: http://stackoverflow.com/a/25673722
has answer: http://stackoverflow.com/a/25672812

http://stackoverflow.com/comment/40073420
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25646615
has text: What are you using to read the excel file?
type: Comment

http://stackoverflow.com/q/25556326
tagged with: swing
has body: If I have a JTable in java and if I click on the first row then shift+click lets say on the 10th row, how would get all the selected rows between 1 and 10... Is there a code for it? thanks in advance
tagged with: click
has comment: http://stackoverflow.com/comment/39907888
tagged with: jtable
tagged with: java
downvote count: 1
score: -1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25557168
has answer: http://stackoverflow.com/a/25570771
answer count: 2
has title: Get all selected rows by shift click
upvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2141273

http://stackoverflow.com/comment/39996060
comment on: http://stackoverflow.com/a/25567250
score: 0
has text: It makes sense after @cfrick's suggested correction.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25700075
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: I want to write something like a music stream service with java. The db stuff and other logic is not the problem, but streaming something itself seems to be a challenge. My idea is the following: After the client requests to stream one file, the server starts to send the bits of the requested music (wave) file to the client. Then i want construct a wave file on the client again with the bits from the server, and play it. BUT: streaming is, if you didnt download the whole file, but already can play the part you already downloaded. Lets say you downloaded 50 / 1000 bytes, i want to play them already. That would be streamung, wouldnt it? But how i can achieve this, using java, and maybe openal? I mean, i cannot write to a file; while usung it, can i?
has comment: http://stackoverflow.com/comment/40171134
type: Question
has comment: http://stackoverflow.com/comment/40171026
has title: play sound bytes with java
has comment: http://stackoverflow.com/comment/40171211
has comment: http://stackoverflow.com/comment/40171305
tagged with: audio
tagged with: openal
score: 0

http://stackoverflow.com/a/25559189
downvote count: 0
has comment: http://stackoverflow.com/comment/39913083
has comment: http://stackoverflow.com/comment/39945223
answers question: http://stackoverflow.com/q/25558647
has comment: http://stackoverflow.com/comment/39944945
has body: Untested, never the less: create a symbolic link via nio with the right extension in a temp dir Call Desktop.open() on the symbolic link This works for me locally: public static void main(String... args) throws IOException { Path source = FileSystems.getDefault().getPath(args[0]); Path symLink = Files.createTempFile(source.getFileName().toString(), ".txt"); Files.delete(symLink); Files.createSymbolicLink(symLink, source); Desktop.getDesktop().open(symLink.toFile()); } Disclaimer: I have not done any research beyond the above smoke test.
type: Answer
has comment: http://stackoverflow.com/comment/39913664
score: 2
upvote count: 2

http://stackoverflow.com/q/25692646
tagged with: sparql
has comment: http://stackoverflow.com/comment/40165875
has body: is there any way to generate a SPARQL query in a dynamic way? what I'm trying to do is some thing like this: if I have a DBpedia resource r1 and another DBpedia resource r2, this query SELECT * WHERE { &lt;r1&gt; ?pre &lt;r2&gt; } will return the predicate between the 2 resources and this query SELECT * WHERE { &lt;r1&gt; ?pre1 ?obj1 . ?obj1 ?pre2 &lt;r2&gt; } will return all the predicates and object between these two resources ( in two steps) and so on I'm trying to build this query in such a way that it will automatically increase the number of objects and predicates between the two resources (for example in 4 steps)?
has comment: http://stackoverflow.com/comment/40846609
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26065884
has comment: http://stackoverflow.com/comment/40223330
tagged with: dbpedia
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26071281
has title: Generate an incremental SPARQL query
answer count: 1
has answer: http://stackoverflow.com/a/26071281
type: Question
has comment: http://stackoverflow.com/comment/40173281
has comment: http://stackoverflow.com/comment/40173390
has comment: http://stackoverflow.com/comment/40158868

http://stackoverflow.com/a/25556842
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25556668
type: Answer
has body: The quick and dirty solution: Edit the Tasks class: public class Tasks extends TimerTask { TextView t; Activity activity; BatteryStatus b = new BatteryStatus(); public void run(){ try{Update();} catch(Exception e){e.printStackTrace();} } public void Update(){ if(activity != null){ activity.runOnUIThread(new Runnable(){ t = b.getTextView(); t.setText("hellooo"); }); } } public void setActivity(Activity a){ // this must be called from the rest of your application activity = a; } }

http://stackoverflow.com/comment/39992301
score: 0
comment on: http://stackoverflow.com/q/25601759
type: QuestionComment
type: Comment
has text: @ElliottFrisch The column createdDate is CHAR(26) in my db.

http://stackoverflow.com/comment/40200545
has text: What version of things are you using? How are you deploying this?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25713814
type: Comment

http://stackoverflow.com/a/25578564
has body: You are calling the second method to pass as a parameter to the orElse() call. The orElse() is not the one calling secondMethod() like what happens in the map call. You are passing the returned value from secondMethod() not the method itself. What you want to do: Optional.ofNullable(nullableValue).map(MyClass::firstMethod).orElseGet(MyClass::secondMethod); What this does it is casts secondMethod into a supplier. That way it is only called when the optional is null.
upvote count: 9
answers question: http://stackoverflow.com/q/25578269
type: Answer
score: 9
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25578269

http://stackoverflow.com/a/25705074
type: Answer
answers question: http://stackoverflow.com/q/25705053
upvote count: 4
has comment: http://stackoverflow.com/comment/40180141
has comment: http://stackoverflow.com/comment/40180164
has comment: http://stackoverflow.com/comment/40180223
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40180334
has comment: http://stackoverflow.com/comment/40180058
score: 4
has comment: http://stackoverflow.com/comment/40180114
has comment: http://stackoverflow.com/comment/40180146
has body: Java always knows exactly how big each element of the array is going to be, because Java has only two kinds of arrays: arrays of primitives or arrays of object references. If it's an array of primitives (int, long, etc.) it's the size of the primitive; and if it's an array of objects then it's the size of references to objects (pointers).
accepted answer of: http://stackoverflow.com/q/25705053
downvote count: 0
has comment: http://stackoverflow.com/comment/40180350
has comment: http://stackoverflow.com/comment/40180128

http://stackoverflow.com/comment/40042619
type: AnswerComment
comment on: http://stackoverflow.com/a/25628743
has text: I would appriciate an example with an subclass of an analyzer that use a synonym filter. I get exceptions.
type: Comment
score: 0

http://stackoverflow.com/q/25656189
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40091592
answer count: 3
has answer: http://stackoverflow.com/a/25656303
downvote count: 0
upvote count: 1
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25656220
type: Question
possible better answer: http://stackoverflow.com/a/25656303
has body: i am printing a .txt file using the Scanner and I want to print the file with line numbers. here is my code. My problem is that the line numbers aren't incrementing. import java.util.*; import java.io.*; public class List { public static void main(String[] args) throws IOException { int line =1; File f = new File("src/List.txt"); Scanner sc = new Scanner(f); while(sc.hasNext()) { int num = 1; System.out.print(num); System.out.println(sc.nextLine()); num++; } } } Output: 1Bird 1Dog 1Cat 1Elephant 1Tiger 1Zebra Expected Output: 1 Bird 2 Dog 3 Cat 4 Elephant 5 Tiger 6 Zebra
accepted answer: http://stackoverflow.com/a/25656206
has title: How to print txt file with file numbers using I/O?
has answer: http://stackoverflow.com/a/25656206

http://stackoverflow.com/q/25685342
has comment: http://stackoverflow.com/comment/40143026
tagged with: sha1
has comment: http://stackoverflow.com/comment/40143066
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40143410
answer count: 0
tagged with: sharedpreferences
has title: Keeping track of a hashed password's original length
type: Question
has comment: http://stackoverflow.com/comment/40145153
tagged with: android
linked to: http://stackoverflow.com/q/2435338
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40144169
has body: I am saving SHA1 password in shared SharedPreferences if user had opted for "remeber me" option while singing into app.. so next time user is on login screen he will have user name and passwod feild already filled in by SharedPreferences resource.... Problem here is, since i am saving encrpted SHA1 password that is always 40 in length no matter how short or long actual password string is..so user will see 40 password dots in password text box .. user might get confuse with this password length.... so how could i display that original string of password there...?? It would have been nice if i could simply decrpyt that string but that unfortunately is not an option i can rely on. so is there any other way?????

http://stackoverflow.com/comment/40146474
type: AnswerComment
has text: sorry I can rate you +1 as my reputation is low, +1 to you, thanks for answer, it's really help me.
comment on: http://stackoverflow.com/a/25686534
score: 1
type: Comment

http://stackoverflow.com/a/25708326
score: 1
type: Answer
has body: This looks odd to me, but I'm not a JNI expert by any stretch: public static void main(String[] args){ System.loadLibrary("cryptopp"); System.loadLibrary("ZCPP_Code64"); } I would expect to see something like (from one of my Crypto++/Android/JNI projects): public class PRNG { static { System.loadLibrary("stlport_shared"); System.loadLibrary("cryptopp"); System.loadLibrary("prng"); } private static native int CryptoPP_Reseed(byte[] bytes); private static native int CryptoPP_GetBytes(byte[] bytes); private static Object lock = new Object(); // Returns the number of bytes consumed. public static int Reseed(byte[] seed) { synchronized (lock) { return CryptoPP_Reseed(seed); } } // Returns the number of bytes generated. public static int GetBytes(byte[] bytes) { synchronized (lock) { return CryptoPP_GetBytes(bytes); } } } Don't worry about the stlport_shared because its an Android thing. This also looks odd: #pragma comment(lib, "cryptlib.lib") //#pragma comment(lib, "crypt32.lib") #pragma comment(lib, "cryptopp.lib") Because you are calling System.loadLibrary("cryptopp"), that means you are using the Crypto++ DLL. It also means this is not needed: #pragma comment(lib, "cryptlib.lib"). Pick static linking or dynamic linking, but not both. It would probably be easiest if you (1) built your ZCPP_Code64 DLL, and (2) statically linked to Crypto++. Then your static loader would look like: static { System.loadLibrary("ZCPP_Code64"); } If you choose static linking against Crypto++, then you will probably have to rebuild the static lib. That's because you'll end up in this configuration: Your DLL -&gt; dynamic linking against the C Runtime Crypto++ LIB -&gt; static linking against the C Runtime That will cause a bunch of duplicate symbols (C Runtime symbols). What you want is: Your DLL -&gt; dynamic linking against the C Runtime Crypto++ LIB -&gt; dynamic linking against the C Runtime To fix it, you open the Cryptlib project, and change the Runtime linking object from static to d…
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40186188
has comment: http://stackoverflow.com/comment/40186328
has comment: http://stackoverflow.com/comment/40186404
has comment: http://stackoverflow.com/comment/40186076
answers question: http://stackoverflow.com/q/25703769

http://stackoverflow.com/q/25601517
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25601970
score: 1
upvote count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Android Parcelable List<String[]>
answer count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25601970
tagged with: android
tagged with: parcelable
has body: I have a JSON and i wanted to put it into parcelable class so that i can pass its object from one activity to other. i have used Parcelable before several times. but this time i got confused with how to create the parcelable class with below JSON response. Actually the confusion is with List&lt;String[]&gt; arraylist of String[] how can i pass this. [ { puzzle_title: "Puzzle", grid_size: "8", data: [ [ "J", "J", "P", "Y", "B", "T", "P", "U" ], [ "L", "W", "B", "I", "Q", "M", "S", "L" ], [ "K", "Y", "Q", "L", "N", "A", "W", "D" ], [ "Y", "E", "I", "G", "U", "G", "H", "V" ], [ "B", "L", "A", "C", "K", "E", "I", "F" ], [ "X", "L", "Q", "T", "B", "N", "T", "B" ], [ "O", "O", "R", "E", "D", "T", "E", "W" ], [ "H", "W", "B", "K", "H", "A", "F", "V" ] ], words: [ "RED", "YELLOW", "BLUE", "BLACK", "WHITE", "MAGENTA" ] }, {} ] I have write my parcelable class like below.. public class PuzzelSetter implements Parcelable { @SerializedName("puzzle_title") private String title; @SerializedName("grid_size") private int size; private List&lt;String[]&gt; data = new ArrayList&lt;String[]&gt;(); private List&lt;String&gt; words = new ArrayList&lt;String&gt;(); public String getTitle() { return title; } public List&lt;String[]&gt; getData() { return data; } public void setData(List&lt;String[]&gt; data) { this.data = data; } public List&lt;String&gt; getWords() { return words; } public void setWords(List&lt;String&gt; words) { this.words = words; } public void setTitle(String title) { this.title = title; } public int getSize() { return size; } public void setSize(int size) { this.size = size; } public void setData(ArrayList&lt;String[]&gt; data) { this.data = data; } public void setWords(ArrayList&lt;String&gt; words) { this.words = words; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(title); dest.writeInt(size); dest.writeList(data); dest.writeStringList(words); } public static final Parcelable.…

http://stackoverflow.com/comment/40308288
type: Comment
has text: @MadProgrammer I managed to make it work. Now I'm hitting me with the example of Threads. How could I do to make the ball deviate before "hitting" the mouse pointer. Literally run from him. Thanks..
type: AnswerComment
comment on: http://stackoverflow.com/a/25561128
score: 0

http://stackoverflow.com/a/25632163
has body: Another alternative: A user's primary calendar ID is their Email address in Google Apps. Additionally, a Google Apps Super Admin can automatically see all calendar details for users within their domain regardless of ACLs. Because of this F/B info doesn't need to be shared within the domain if you want/need to avoid this. Using a Super Admin on both Google Apps accounts, you could GET all user email addresses (calendar IDs) and then GET a list of events based on the calendar IDs. From here, you would just need to mark off the times as F/B in your Java web app.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25564763

http://stackoverflow.com/q/25635957
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1978933
tagged with: uri
has answer: http://stackoverflow.com/a/25636122
has comment: http://stackoverflow.com/comment/40054505
has answer: http://stackoverflow.com/a/57788016
answer count: 4
has answer: http://stackoverflow.com/a/25637861
score: 0
has body: I have this file URL: http://xxx.xxx.xx.xx/resources/upload/2014/09/02/new sample.pdf which will be converted to http://xxx.xxx.xx.xx/resources/upload/2014/09/02/new%20sample.pdf later. Now I can get the last path by: public static String getLastPathFromUrl(String url) { return url.replaceFirst(".*/([^/?]+).*", "$1"); } which will give me new sample.pdf but how do I get the remaining of the URL: http://xxx.xxx.xx.xx/resources/upload/2014/09/02/ ?
tagged with: java
has title: How do I split the rest of the URL from the last path of it
tagged with: file
tagged with: url
has answer: http://stackoverflow.com/a/25636563
tagged with: file-uri
type: Question

http://stackoverflow.com/comment/40159006
comment on: http://stackoverflow.com/q/25693592
score: 0
type: Comment
type: QuestionComment
has text: Do you want the parameter to refer to the method, or to actually be the result of invoking the method?

http://stackoverflow.com/comment/40065785
comment on: http://stackoverflow.com/a/25640505
type: Comment
score: 0
type: AnswerComment
has text: Please check that ActionFactory class package also.

http://stackoverflow.com/q/25595677
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25596701
upvote count: 2
type: UnansweredQuestion
downvote count: 0
tagged with: keyboard
has title: How to differentiate left/right shift, ctrl, alt and enter keys in JavaFX?
tagged with: javafx-8
tagged with: keyboard-events
score: 2
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/25596675
has body: How can a JavaFX 8 controller tell whether a Shift, Ctrl, Alt or Enter key is located on the left or right part of the keyboard? The getKeyLocation() method in java.awt.event.KeyEvent doesn't exist for the javafx.scene.input.KeyEvent class unfortunately. I also tried to check the event.location in a Javascript by intercepting window.onkeydown, but unlike V8 or other JS engines, it seems the Nashorn library doesn't discriminate them and returns DOM_KEY_LOCATION_STANDARD no matter where the key is located. Since the overall key capture seems pretty much broken (inconsistencies in KeyEvent::getCode/keyText methods), I'm starting to think an external library will be necessary. Is there a solution in the JavaFX (or Java) library, and if not, a lightweight library that could offer the same functionality on different platforms (Windows, Linux and Mac OS)? Thanks in advance! Update Tried with JavaFX + awt component (see suggestion below), but wouldn't work as it seems JavaFX provides and translates the events - incorrectly. Tried with JNativeHook (they recently moved), it almost qualifies as a work-around but fails to recognize some keys, has imprecise timing and is a bit awkward to implement, especially since I can't compile the native code for all the platforms. The licencing terms are also a bit confused (GPL for the stable version, which isn't an option in my case, perhaps moving to LGPL...).

http://stackoverflow.com/q/25560659
has body: Attempting the following: class Base { public Base(){ } } class Derived extends Base { } public class Main { public static void main (String[] args) { Derived derived = (Derived) new Base(); } } Causes a CastClassException, but compiles successfully. The comments on this question suggest that it's impossible for the compiler to figure out what type new Base() has until runtime -- but why should that be the case? I know that in other type systems the compiler can always infer the type of any expression, and the Java compiler certainly does some type inference with e.g. lambda expressions. And it must, at some point, know what type new Base() has if it's going to emit the correct bytecode. Is there a theoretical limitation that prevents the Java compiler from catching this before the program runs, or is it an implementation choice?
score: 2
upvote count: 2
type: AnsweredQuestion
answer count: 3
tagged with: java
linked to: http://stackoverflow.com/q/4460580
tagged with: types
downvote count: 0
has answer: http://stackoverflow.com/a/25560684
accepted answer: http://stackoverflow.com/a/25560684
has answer: http://stackoverflow.com/a/25560687
favorite count: 0
has title: Why is ClassCastException a runtime error?
type: Question
has comment: http://stackoverflow.com/comment/39915764
has comment: http://stackoverflow.com/comment/39915745
has answer: http://stackoverflow.com/a/25560726
possible better answer: http://stackoverflow.com/a/25560726

http://stackoverflow.com/a/25643987
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40068648
has body: It's reference that is final(constant) but still you can update its state (instance variable) but you can't assign it to other Person object. It's better explanaied under JLS - 4.12.4. final Variables Once a final variable has been assigned, it always contains the same value. If a final variable holds a reference to an object, then the state of the object may be changed by operations on the object, but the variable will always refer to the same object. You can't say person = new Person(20);
has comment: http://stackoverflow.com/comment/40068539
answers question: http://stackoverflow.com/q/25643938
type: Answer
has comment: http://stackoverflow.com/comment/40068769
has comment: http://stackoverflow.com/comment/40068688
has comment: http://stackoverflow.com/comment/40068597
upvote count: 3

http://stackoverflow.com/comment/39967700
score: 1
comment on: http://stackoverflow.com/q/25588493
has text: o.O What do you mean?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25649512
has title: Sending Multiple Nested NameValue Arrays in Android MultipartMode POST
has comment: http://stackoverflow.com/comment/40079552
type: UnansweredQuestion
tagged with: android
has body: Question: How do you send embedded associative (name => value) sub-arrays on a multipart http POST, instead of just the ordinary single dimensional, top level name => value pairs? I searched far and long and was not able to find an example of this.
has comment: http://stackoverflow.com/comment/40078972
score: 0
tagged with: http-post
tagged with: java
has answer: http://stackoverflow.com/a/25650154
answer count: 1
tagged with: arrays
type: Question

contains
tags question: http://stackoverflow.com/q/25669445
tag name: contains
tags question: http://stackoverflow.com/q/25591768
type: Tag
tags question: http://stackoverflow.com/q/25699131
tags question: http://stackoverflow.com/q/25672656
tags question: http://stackoverflow.com/q/25690388

http://stackoverflow.com/comment/40149190
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25677092
type: AnswerComment
has text: So just to confirm the code you suggested - does go in the 'protected void OnCreate...' part of the java file?

http://stackoverflow.com/comment/40170736
type: AnswerComment
score: 0
has text: @MarkoTopolnik and when you say a 'lot of redundant copy'; doesn't it just! :)
comment on: http://stackoverflow.com/a/25699310
type: Comment

http://stackoverflow.com/q/25704978
has comment: http://stackoverflow.com/comment/40180272
has comment: http://stackoverflow.com/comment/40198429
has answer: http://stackoverflow.com/a/25705034
has comment: http://stackoverflow.com/comment/40195774
has answer: http://stackoverflow.com/a/25731831
has comment: http://stackoverflow.com/comment/40198543
has title: Best practice for dealing with long running JEditorPane setText process
score: 2
has body: All processors that update my swing GUI from places other than by user clicks are performed using EventQueue.invokeLater (for example output generated from a long running background non-EDT thread process). In my current scenario I have a TCPIP socket read background thread process that returns data which needs to update a JEditorPane object. I use the JEditorPane setText call. The problem is, placing the setText call in an invokeLater routine freezes the GUI for large files (example case test 19,790 KB). My attempt to resolve this is to perform the setText action in a non-EDT background thread. This appears to solve the problem, BUT, I am concerned about best practices, because JEditorPane setText in java 7 (the JDK I’m using) is NOT thread safe. HOWEVER trawling through the JDK code, it seems to me that the lengthy process performed here is in JDKs DefaultEditorKit.read, and within that method the only code that would effect the GUI is in the doc.insertString calls (unless I am mistaken). Now when you look at JDKs PlainDocument.java insertString method it documents that IT IS thread safe, so one would think therefore that this solution is sound. HOWEVER... Stress testing my application, I do some random clicks around the GUI, and currently have a tree node animation running, and during the large load below, it does appear to slow down the animation a little, hence my concern that I’ve not performed the best resolution (also very concerned about future JREs screwing me up here and therefore not relying on insertString currently being threadsafe). I’ve investigated and seen that this question “how to handle long running JEditorPane setText” has been asked before but with no suitable answers. QUESTION 1) Does anyone have thoughts on my current observations? QUESTION 2) Does anyone have ideas on how I could achieve this another? NOTE JEditorPane is my only choice here because I will be eventually supporting dynamic fonts of an IDE look and feel nature. NOTE also that …
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25731831
tagged with: settext
answer count: 2
tagged with: jeditorpane
has comment: http://stackoverflow.com/comment/40198914
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40199020
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40198566
type: Question
possible better answer: http://stackoverflow.com/a/25705034
has comment: http://stackoverflow.com/comment/40198743

http://stackoverflow.com/comment/39902775
has text: There's nothing that says the source directory even exists. You have to make assumptions about your development environment.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25553069

http://stackoverflow.com/comment/39955126
type: Comment
type: AnswerComment
has text: @assylias Do the dates represent days? Can you convert them easily to an `int`? Because in that case you can have a single array of prices, which could potentially be even faster, depending on how big the "gaps" are between days with prices specified.
score: 1
comment on: http://stackoverflow.com/a/25578274

http://stackoverflow.com/comment/39983521
score: 0
comment on: http://stackoverflow.com/q/25597088
type: QuestionComment
type: Comment
has text: Can you post the error message youre getting?

http://stackoverflow.com/comment/40170195
type: Comment
score: 0
type: AnswerComment
has text: @camickr Also, `JTextArea#setText()` does not "parse all this text looking for new line strings." It's actually just the superclass method `JTextComponent#setText()` which calls the `insertString()` or `replace()` methods of the underlying document model.
comment on: http://stackoverflow.com/a/25691384

http://stackoverflow.com/a/25689852
downvote count: 0
score: 17
upvote count: 17
answers question: http://stackoverflow.com/q/25689673
type: Answer
accepted answer of: http://stackoverflow.com/q/25689673
has body: Java generic collections are not stored with a type to ensure backwards compatibility with pre J2SE 5.0. Type information is removed when added to a generic collection. This is called Type Erasure. This means that a generic collection can be assigned to a non generic reference and objects in a generic typed collection can be placed in an non generic, nontyped collection. All Java generics really does is make sure you can't add the wrong type to a generic list and saves you from doing an explicit cast on retrieval; even though it is still done implicitly. Further to this the Java section of this answer goes a little deeper into what I just said this article also covers basically what you were asking in a more complete way other things to watch out for with Type Erasure
has comment: http://stackoverflow.com/comment/40152160
type: AcceptedAnswer

http://stackoverflow.com/comment/71243430
type: AnswerComment
comment on: http://stackoverflow.com/a/25556330
has text: @Michaelangel007 Hey there, I think we're approaching this topic with different background assumptions. Care to shoot me an email and we'll talk about the details?
score: 1
type: Comment

http://stackoverflow.com/comment/39980777
comment on: http://stackoverflow.com/a/25595401
type: AnswerComment
has text: I am not using maven.this is a java project and I am using Ant to build the project.Please can you brief me what I need to get the unit test coverage in sonarqube dashboard?? Steps completed: 1)Java build to generate the .class files and packed into ear 2)An ant script to execute the cactus test scripts -this will generate the xml files which will be used to generate the unit test result 3)Now in sonarqube,I am able to get the unit test result but not unit test coverage
score: 0
type: Comment

http://stackoverflow.com/comment/40043198
type: Comment
comment on: http://stackoverflow.com/q/25629478
type: QuestionComment
score: 0
has text: How can i do to support negative numbers?

http://stackoverflow.com/comment/39930441
comment on: http://stackoverflow.com/q/25567577
type: QuestionComment
has text: at org.apache.http.impl.client.InternalHttpClient.getParams(InternalHttpClient.java:206)
score: 1
type: Comment

http://stackoverflow.com/q/25587811
tagged with: mapreduce
has answer: http://stackoverflow.com/a/25588547
tagged with: hadoop
score: 0
tagged with: java
answer count: 1
tagged with: iterable
type: Question
tagged with: reduce
has body: I have two very large datasets(tables) on HDFS. I want to join them on some column(s), then group them on some column(s), and then perform some group functions on some columns. My steps are: 1- Create two jobs. 2- In the first job, in mapper read the rows of each dataset as map input value and emit join columns' values as map output key and remaining columns' values as map output value. After mapping, the MapReduce framework performs shuffling and groups all the map output values according to map output keys. Then, in reducer it reads each map output key and its values which man include many rows from both datasets. What I want is to iterate through reduce input value many times so that I can perform cartesian product. To illustrate: Let's say for a join key x, I have 100 matches from one dataset and 200 matches from the other. It means joining them on join key x produces 100*200 = 20000 combination. I want to emit NullWritable as reduce output key and each cartesian product as reduce output value. An example output might be: for join key x: From (nullWritable),(first(1),second(1)) Over (nullWritable),(first(1),second(200)) To (nullWritable),(first(100),second(200)) How can I do that? I can iterate only once. And I could not cash the values because they dont fit into memory. 3- If I do that, I will start the second job, which takes the first job's result file as input file. In mapper, I emit group columns' values as map output key, and the remaining columns' values as map output value. Then in reducer by iterating through each key's value, I perform some functions on some columns like sum, avg, max, min. Thanks a lot in advance.
type: UnansweredQuestion
has title: Iterating many times through Text input value in the Reducer in a MapReduce job

http://stackoverflow.com/a/25696307
has body: You have make changes here: Computer constructor: CPU Cpu = new CPU("?", 0); `to` Cpu = new CPU("?", 0); Computer's setCPU(String cpuType, int cpuSpeed) CPU cpu = new CPU(cpuType, cpuSpeed); `to` Cpu.setType(cpuType); Cpu.setSpeed(cpuSpeed);
answers question: http://stackoverflow.com/q/25696211
has comment: http://stackoverflow.com/comment/40164584
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/40164632

http://stackoverflow.com/a/25569430
has comment: http://stackoverflow.com/comment/39933506
has comment: http://stackoverflow.com/comment/40092159
downvote count: 0
answers question: http://stackoverflow.com/q/25566851
score: 1
type: Answer
has body: May I recommend a superior http client? http://grails.org/plugin/jersey-request-builder It was developed by my old team mates at Rackspace, runs on Jersey client, and it's ridiculously easy to use. It uses DSL's. For example: new RequestBuilder().post { uri = "http://www.example.com" body = ["foo": "bar"] headers = [ "X-Auth-Key": "1321d980-3ceb-11e3-b872-081196ac8a64" ] } See the documentation for more examples, but once we had this we never used HttpBuilder again.
upvote count: 1
has comment: http://stackoverflow.com/comment/39932043

http://stackoverflow.com/a/25745967
type: AcceptedAnswer
has body: I was using JSON requests asynchronously, so I overcome this situation by using synchronous JSON requests like following: RequestFuture&lt;JSONObject&gt; future = RequestFuture.newFuture(); itemReq = new JsonObjectRequest(url + city, new JSONObject(), future, future); AppController.getInstance().addToRequestQueue(itemReq);
score: 0
answers question: http://stackoverflow.com/q/25625926
type: Answer
accepted answer of: http://stackoverflow.com/q/25625926

http://stackoverflow.com/comment/40184067
score: 0
has text: i am using smack version 3.2.2
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25701848

http://stackoverflow.com/comment/39967914
score: 0
has text: Can I ask why you want the position of the max value? There may be another data structure that could better suit your purpose.
comment on: http://stackoverflow.com/q/25588274
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40103397
type: QuestionComment
comment on: http://stackoverflow.com/q/25663007
has text: Solved :) Need to use integer.parsint
type: Comment
score: 0

http://stackoverflow.com/comment/40113883
type: QuestionComment
has text: What you're seeing will look something like `[C@48a2e6`. This is a composition of the class of `ch` (which is `[C`, or character array), followed by the @ symbol and the hexadecimal string representation of the array's hash code.
comment on: http://stackoverflow.com/q/25668920
score: 0
type: Comment

http://stackoverflow.com/comment/40118840
type: Comment
type: QuestionComment
has text: He will start to run in to problems. Parts of Eclipse need Java 7
comment on: http://stackoverflow.com/q/25671774
score: 1

http://stackoverflow.com/q/25558228
tagged with: powermock
type: UnansweredQuestion
tagged with: matcher
has answer: http://stackoverflow.com/a/25612114
has body: In Mockito 1.9.5 I'd like to format the actual value when verifying the (in order) call arguments of a method. Mockito provides a overridable describeTo method within ArcgumentMatcher&lt;T&gt;s that enables me to format the expected value. When mocking JRE classes like DatagramPacket using PowerMockito's whenNew, the actual value is not formatted the way I like. In the following example I'm only interested if the address of the DatagramPacket was called in order. If not, I'd like to see the mismatching, actual value and not the default toString() name "java.net.DatagramPacket@7546a399". My custom matcher is able to match only the InetSocketAddress. Example The custom matcher: static class IsDatagramForAddress extends ArgumentMatcher&lt;DatagramPacket&gt; { final InetSocketAddress addr; public IsDatagramForAddress(InetSocketAddress addr){ this.addr = addr; } public boolean matches(Object dgp) { SocketAddress isa = ((DatagramPacket) dgp).getSocketAddress(); boolean eq = isa.equals(addr); // System.out.println(dgp + ": " + isa + "&lt; &gt;" + addr + " == " + eq); return eq; } @Override public void describeTo(Description description) { description.appendText(addr == null ? null : addr.toString()); } } The test: private static DatagramPacket isDatagramForAddress(InetSocketAddress addr){ return argThat(new IsDatagramForAddress(addr)); } ... @Test public void testSendIsCalledWithServersInOrder() throws Exception { InOrder order = inOrder(sock); order.verify(sock).send(isDatagramForAddress(new InetSocketAddress("8.8.8.2", 100))); order.verify(sock).send(isDatagramForAddress(new InetSocketAddress("8.8.8.1", 100))); } This is what I get: org.mockito.exceptions.verification.VerificationInOrderFailure: Verification in order failure Wanted but not invoked: datagramSocket.send(/8.8.8.1:100); -&gt; at xxxx.XxxxTest.testSendIsCalledWithServersInOrder(XxxxTest.java:95) Wanted anywhere AFTER following interaction: datagramSocket.send( java.net.DatagramPacket@7546a399 ); -&gt; at xxxx…
score: 1
tagged with: mockito
tagged with: java
has title: Mockito 1.9: format the expected value (like "actual formatter" in custom ArgumentMatcher)
downvote count: 0
answer count: 1
tagged with: formatting
upvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/40175406
comment on: http://stackoverflow.com/q/25701285
score: 0
type: Comment
type: QuestionComment
has text: You use the hibernate, maybe that need runtime context.

http://stackoverflow.com/q/25595693
tagged with: layout-manager
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/39981037
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
has body: I'm using a JEditorPane inside a JPanel which I've called my contentPane in the example below. The content pane is inside a JScrollPane. I would like the editor pane to fill as little space as possible (to just contain it's text) and the rest of the space available in the content pane be left empty to the bottom, and on either side. If the text gets too large, the editor pane will grow, and eventually the scroll pane will create scroll bars to browse through all of the content. However, instead of the editor pane only taking up its preferred size (which is the size of the text it contains) it fills up the entire content pane which fills the entire view port of the scroll pane. Here's some example code to demonstrate my problem: import java.awt.BorderLayout; import java.awt.Color; import javax.swing.BoxLayout; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; @SuppressWarnings("serial") public class ScrollPaneExample extends JFrame { public static void main(String[] args) { new ScrollPaneExample(); } public ScrollPaneExample() { super("ScrollPaneExample"); setSize(400, 400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); JEditorPane editorPane = new JEditorPane("text/plain", ""); editorPane.setBackground(Color.YELLOW); for (int i = 0; i &lt; 5; i++) editorPane.setText(editorPane.getText() + "Hello World\n"); JPanel contentPane = new JPanel(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); contentPane.setBackground(Color.BLUE); contentPane.add(editorPane); JScrollPane scrollPane = new JScrollPane(contentPane); add(scrollPane, BorderLayout.CENTER); setVisible(true); } } When run, this is what the window looks like: By the yellow background, we can see that the editor pane is taking up all the space. Here is a (Photoshopped) example of what I want the layout to look like: The blue background represents the content pane, and the yellow represents the …
has comment: http://stackoverflow.com/comment/39980909
has comment: http://stackoverflow.com/comment/39981074
type: Question
has title: JEditorPane filling all available space in JScrollPane
tagged with: jeditorpane
accepted answer: http://stackoverflow.com/a/25595969
tagged with: jscrollpane
answer count: 1
has answer: http://stackoverflow.com/a/25595969
downvote count: 0

http://stackoverflow.com/a/61541465
answers question: http://stackoverflow.com/q/25643370
type: Answer
has comment: http://stackoverflow.com/comment/108862014
score: 0
has body: For each textbox or edittext set font into iscolapota.

http://stackoverflow.com/a/25608464
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25608215
has comment: http://stackoverflow.com/comment/40004160
has comment: http://stackoverflow.com/comment/40004358
has comment: http://stackoverflow.com/comment/40004267
answers question: http://stackoverflow.com/q/25608215
type: Answer
has body: You need to account for the difference in representation. When using System.out.println() (or a debugger) you see the decimal representation of the signed byte(s). In a hex editor you see the same in hexadecimal. How are you checking for "match" in your code? Edit: Comparing a byte to an int literal (thats what the 0x notation is to the compiler) requires masking the byte with 0xFF (to suppress sign extension; the compiler casts the bytes to int for comparing. Thats just how java works with the signed byte type). Possible ways to express the comparison are (byteArray[] &amp; 0xFF) == 0xXX or byteArray[] == (byte) 0xXX. Just writing byteArray[] == 0xXX means literally sign extend the byte to int, then compare to int literal.
has comment: http://stackoverflow.com/comment/40004428
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25597289
upvote count: 1
has body: Best bet is to use a lookahead to assert either season or the end of the string follows. As well if newline sequences are between the pattern you want to use the dotall flag making the dot . match newlines also. String s = "season\nfoobar foobaz\n\nseason\nbarbaz\nseason\nbazquz"; Pattern p = Pattern.compile("(?s)season\\s*(.*?)(?=\\s*season|$)"); Matcher m = p.matcher(s); List&lt;String&gt; arrayList = new ArrayList&lt;String&gt;(); while (m.find()) { arrayList.add(m.group(1)); } System.out.println(arrayList); // [foobar foobaz, barbaz, bazquz]
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25597267
downvote count: 0

jboss
tags question: http://stackoverflow.com/q/25674159
tags question: http://stackoverflow.com/q/25636583
tags question: http://stackoverflow.com/q/25624977
tags question: http://stackoverflow.com/q/25625304
tags question: http://stackoverflow.com/q/25687972
tags question: http://stackoverflow.com/q/25551639
tags question: http://stackoverflow.com/q/25632491
tags question: http://stackoverflow.com/q/25683788
tags question: http://stackoverflow.com/q/25672157
tags question: http://stackoverflow.com/q/25606198
tags question: http://stackoverflow.com/q/25570390
tags question: http://stackoverflow.com/q/25573350
tags question: http://stackoverflow.com/q/25688639
tag name: jboss
tags question: http://stackoverflow.com/q/25641727
tags question: http://stackoverflow.com/q/25710855
tags question: http://stackoverflow.com/q/25605968
tags question: http://stackoverflow.com/q/25579684
tags question: http://stackoverflow.com/q/25617448
type: Tag
tags question: http://stackoverflow.com/q/25584631
tags question: http://stackoverflow.com/q/25610937
tags question: http://stackoverflow.com/q/25635699
tags question: http://stackoverflow.com/q/25623515
tags question: http://stackoverflow.com/q/25706731

http://stackoverflow.com/comment/40114001
score: 0
type: Comment
has text: Can you Show more code please. Class `NewAray`
type: QuestionComment
comment on: http://stackoverflow.com/q/25669004

http://stackoverflow.com/comment/40160442
comment on: http://stackoverflow.com/q/25694235
has text: I always prefer the second option if possible. It can be as readable as a variable if you choose a proper name for the method.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25639855
has body: I want to know how can I get a HTTP request information from Java, I am using Restlet framework but I don't want to limit it with that. As I have been struggling to figure it out with restlet and yet I can't. I am attaching a screenshot of my GAE console log, I need to get that locahost (domain), it could be abc.com or xyz.com in actual production environment. Here is the restlet code I have for this app: Redirector proxy = new Redirector(getContext(), target, Redirector.MODE_SERVER_OUTBOUND){ String target = "https://dl.x.com/u/123/"; @Override public void handle(Request request, Response response) { String path = request.getResourceRef().getHostIdentifier() + request.getResourceRef().getPath(); try { URL url = new URL(path); String host = url.getHost(); String pathParts = url.getPath(); if(pathParts.isEmpty() || pathParts.equals(ROOT_URI)){ pathParts = "/index.html"; // Hard-wired for now } String targetPattern = target + host + pathParts; System.out.println("Target URL = " + targetPattern); this.setTargetTemplate(targetPattern); } catch (MalformedURLException e){ e.printStackTrace(); } super.handle(request, response); } }; getConnectorService().getClientProtocols().add(Protocol.HTTP); return proxy; } The problem here is the String host gets the value of app-x.appspot.com, I need to get the one shown in the picture.
type: Question
tagged with: google-app-engine
has title: Get HTTP request info with Java
has answer: http://stackoverflow.com/a/25643359
accepted answer: http://stackoverflow.com/a/25643359
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/a/25651760
answers question: http://stackoverflow.com/q/25650856
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/40084785
score: 0
has body: I'm not gonna provide you the code, cause you already have it. I'm gonna provide you with a solution: You already have a "channel" where you send a unidirectional message, SERVER -> CLIENT. If you want to send a message from you server to your client, your CLIENT must be a SERVER too.
upvote count: 1

http://stackoverflow.com/comment/39946237
comment on: http://stackoverflow.com/q/25576683
type: Comment
type: QuestionComment
score: 0
has text: Please post the full stack trace, not just the exception.

http://stackoverflow.com/comment/40146998
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25686979
has text: List<T> list = query.getResultList(); The method in which this code is a Generic method . Means that method does the same thing for some other tables (or we can say class) also . For that reason I kept it as generic.

http://stackoverflow.com/comment/40045323
has text: Great post. Thank you. Unfortunately I don't get to design advanced user interfaces so JavaFX is a bit far away from me. My question was more based on a simple swing GUI and what might be the right way to call that GUI from the main. I understand from your comment that there is no right way of doing it. Thank you.
type: AnswerComment
comment on: http://stackoverflow.com/a/25630704
score: 0
type: Comment

http://stackoverflow.com/comment/61559970
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25593783
has text: @Pratik Android != Java, see also [my post](http://stackoverflow.com/a/36773726/2491410) about non-gregorian calendars on Android
type: Comment

http://stackoverflow.com/a/25662562
score: 0
answers question: http://stackoverflow.com/q/25659126
type: Answer
has body: There is the result that my classmate tried can make the pointers right. Its not the way i want ,but the result is.it works.Post it for people who encounter the same problem to me. MainActivity.java public class MainActivity extends FragmentActivity { FaceGridView myGridview; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_main); myGridview = (FaceGridView) findViewById( R.id.facegridview); myGridview.initial(this); } } FaceGridView.java public class FaceGridView extends ViewGroup { public PageIndicator mIndicator; private ViewPager awesomePager; private PagerAdapter pm; private RelativeLayout mainRLayout; public Context myContext; public View MAIN ; ArrayList&lt;Category&gt; codeCategory; public void initial(Context ctx) { this.myContext = ctx; mIndicator = (PageIndicator) ((Activity) myContext).findViewById(R.id.pagerIndicator); awesomePager = (ViewPager) ((Activity) myContext).findViewById(R.id.pager); System.out.println( "myContext["+myContext+"] \n"+ "mIndicator["+mIndicator+"] \n"+ "awesomePager["+awesomePager+"] \n" ); InsideMethod(); } public FaceGridView(Context context, AttributeSet attrs) { super(context, attrs); System.out.println( "FaceGridView(Context context, AttributeSet attrs) ["+context+"] "); // this.myContext = context; // initial(); // InsideMethod(); } Its my first time ask question on stackoverflow,i never thought get so many replies in such short time, you guys make me feel love TAT,thank you all.
has comment: http://stackoverflow.com/comment/40239669

http://stackoverflow.com/q/25612424
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40011601
type: Question
tagged with: netbeans
has body: Hi all I have a code in java and runs great in net beans, but when I wanna run in eclipse this Exception appears Exception in thread "main" class com.aspose.ocr.internal.g: Culture Name: en-US-EN is not a supported culture com.aspose.ocr.internal.aP.b(Unknown Source) com.aspose.ocr.internal.aP.&lt;init&gt;(Unknown Source) com.aspose.ocr.internal.aP.a(Unknown Source) com.aspose.ocr.internal.dj.b(Unknown Source) com.aspose.ocr.internal.aP.c(Unknown Source) com.aspose.ocr.internal.cG.c(Unknown Source) com.aspose.ocr.z.&lt;init&gt;(Unknown Source) com.aspose.ocr.ImageStream.fromFile(Unknown Source) I.main(I.java:33) at com.aspose.ocr.internal.aP.b(Unknown Source) at com.aspose.ocr.internal.aP.&lt;init&gt;(Unknown Source) at com.aspose.ocr.internal.aP.a(Unknown Source) at com.aspose.ocr.internal.dj.b(Unknown Source) at com.aspose.ocr.internal.aP.c(Unknown Source) at com.aspose.ocr.internal.cG.c(Unknown Source) at com.aspose.ocr.z.&lt;init&gt;(Unknown Source) at com.aspose.ocr.ImageStream.fromFile(Unknown Source) at I.main(I.java:33) This is mi code import java.io.FileInputStream; import java.io.FileNotFoundException; import com.aspose.ocr.ILanguage; import com.aspose.ocr.ImageStream; import com.aspose.ocr.Language; import com.aspose.ocr.OcrEngine; public class I { public static void main(String[] args) { // Set the paths String imagePath = "samples/Sample.bmp"; String resourcesFolderPath = "../resources/resource.zip"; // Create an instance of OcrEngine OcrEngine ocr = new OcrEngine(); // Set Resources for OcrEngine try { ocr.setResource(new FileInputStream(resourcesFolderPath)); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // Set NeedRotationCorrection property to false // ocr.getConfig().setNeedRotationCorrection(false); // Set image file ocr.setImage(ImageStream.fromFile(imagePath)); // Add language ILanguage language = Language.load("spanish"); ocr.getLanguages().addLanguage(language); // Perform OCR and get extracted…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/51295758
score: 0
has comment: http://stackoverflow.com/comment/40011460
has title: Culture Name: en-US-EN is not a supported culture Ecplise
tagged with: java
answer count: 1

http://stackoverflow.com/q/25599720
favorite count: 0
has answer: http://stackoverflow.com/a/25602491
type: Question
score: 3
tagged with: rest
possible better answer: http://stackoverflow.com/a/25600288
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: JSON Parameter for Web Service
accepted answer: http://stackoverflow.com/a/25625866
has answer: http://stackoverflow.com/a/25600233
has answer: http://stackoverflow.com/a/25600288
linked to: http://stackoverflow.com/q/14600510
has answer: http://stackoverflow.com/a/25625866
has body: I am trying to create a web service which will taken in JSON response and then query the DB with it to return store details (JSON response). I intend to use this with a mobile app later on. But during the development I am testing using AJAX calls. I am using a @GET request at the moment. I was able to successfully return a JSON response. I am now facing a problem with passing the JSON Object to the @GET method. On debugging, I see that there is a null value in my input parameter. Can somebody take a look at my code and advise what I am doing wrong? import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PUT; import java.util.Iterator; import org.json.simple.JSONObject; import org.json.simple.JSONArray; import org.json.simple.JSONValue; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; /** * REST Web Service * * @author Aj * * This service will return the offers valid for the IMSI number passed */ @Path("getOffers") public class GetOffersResource { @Context private UriInfo context; /** * Creates a new instance of GetOffersResource */ public GetOffersResource() { } @GET @Consumes("application/json") @Produces("application/json") public String getJson(final String input) { JSONParser parser = new JSONParser(); String[] response = new String[5]; try { Object obj = parser.parse(input); JSONObject jsonObject = (JSONObject) obj; offerProcess ofc = new offerProcess(); ofc.setLatitude((double) jsonObject.get("latitude")); ofc.setLongitude((double) jsonObject.get("longitude")); ofc.setIMSI((long) jsonObject.get("IMSI")); response = ofc.fetchOffers(); } catch (ParseException e) { JSONObject ser = new JSONObject(); ser.put("status", "error"); ser.put("reason", "Bad request"); return ser.toJSONString(); } //TODO return proper representation object JSONObject ser = new JSONObject…
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39988459
upvote count: 3
has comment: http://stackoverflow.com/comment/39990872
tagged with: json-simple
downvote count: 0
tagged with: web-services

http://stackoverflow.com/comment/86853645
type: AnswerComment
comment on: http://stackoverflow.com/a/25673623
score: 0
has text: OAuthSecrets is undefined, from where i can get this?
type: Comment

http://stackoverflow.com/a/25689759
answers question: http://stackoverflow.com/q/25689673
downvote count: 0
has comment: http://stackoverflow.com/comment/40151612
has comment: http://stackoverflow.com/comment/40151736
has body: Generics were added to Java only in Java 5. Before that, when you use a collection, it always meant collection of objects. The old syntax is left as is for backward compatibility. So ArrayList result = new ArrayList() is actually creating an ArrayList&lt;Object&gt;. Since ArrayList is also an object, you can add content to the variable result.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/25635535
score: 1
answers question: http://stackoverflow.com/q/25635434
type: Answer
has body: Your User Object must implement UserDetails interface. When you get a reference to it cast it correctly so you can access getter methods. Let's say your user object is like public class MyUser implements UserDetails{ private int id; private String name; private String email; private String username; } After succesful login you would store an instance of MyUser in as the principal. Then MyUser userDetails = (MyUser) ((Authentication)principal).getPrincipal(); String name = userDetails.getName();
has comment: http://stackoverflow.com/comment/40054009
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25574628
score: 3
type: Answer
answers question: http://stackoverflow.com/q/25574597
has body: Yes, the HttpServletRequest has a getMethod() that returns a String value representing the HTTP method.
accepted answer of: http://stackoverflow.com/q/25574597
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25637051
score: 5
type: AcceptedAnswer
upvote count: 5
accepted answer of: http://stackoverflow.com/q/25562613
type: Answer
has comment: http://stackoverflow.com/comment/66620169
has comment: http://stackoverflow.com/comment/66614465
has comment: http://stackoverflow.com/comment/122271804
answers question: http://stackoverflow.com/q/25562613
downvote count: 0
has body: After a lot of debugging and dumping of files and so on, I proved that it had soemething to do with the digest calculation. In a specific location in the signed body part is the content MIC (base64 of the digest). Somehow this value did not match what the other side did... Once I had that, and some more time with google, I finally turned up more information on sourceforge confirming this. Helpful since it mentions my specific version of BC. To quote: The problem is that BC >= 1.27 will "canonicalize" all messages that are not sent with content-transfer-encoding binary. What does this mean? In the S/MIME rfc it says that all messages should be converted to a "canonical" form before computing the MIC. The "canonical" form for text messages is that EOL is indicated by CR, LF. The rfc's are silent on what the canonical form for other content types is. Many S/MIME implementations (e.g. openssl, Bouncy Castle after 1.27) incorrectly assume that the canonical form for all messages except those sent with content-transfer-encoding binary is that every LF should be preceeded by a CR. So if a BC 1.25 used sends a message including bare LF characters then the MIC validation will fail if the message is received by an application using BC >= 1.27, or openssl smime, or many other S/MIME implementations. OpenAS2 should be fixed to use content-transfer-encoding binary. This only appears to work if you set the encoding on the MIME Body Part I had verified the same results (that failed on the server) by doing the JCA route manually, the lightweight route, and also the CMS route. With that information I made a simple change to the sender.... MimeBodyPart part = //.. make mime body part from file part.setHeader("Content-Transfer-Encoding", "binary"); The funny part about this is that changing anything to do with the SMIMESignedGenerator() seems to have no effect: gen = SMIMESignedGenerator("binary"); // nothing, even though the docs say to set this My final signing function looks like t…

http://stackoverflow.com/comment/39922171
comment on: http://stackoverflow.com/q/25564102
type: Comment
has text: because i want to learn the difference between loops and recursion Scary Wombat i want to know what i should change in that code and yes ted it is an assignment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40184738
comment on: http://stackoverflow.com/q/25707576
has text: @SparkOn, no, that is not a dup. This is about `+` binding more tightly than `==`.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40009367
comment on: http://stackoverflow.com/q/25610749
has text: People need to get over the fact that sometimes CVS is enough.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25694465
has comment: http://stackoverflow.com/comment/40843706
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40912973
answers question: http://stackoverflow.com/q/25689910
has comment: http://stackoverflow.com/comment/40843438
type: Answer
has comment: http://stackoverflow.com/comment/40160960
has body: According to your config, property additionalDialects should assigned with a Set containing one bean. So in javaconfig just create an instance of HashSet, add to it SpringSecurityDialect bean and assign the resulting set to additionalDialects property. SpringSecurityDialect bean should be created by method annotated with @Bean to let Spring application context know about this bean to execute bean initializers and postprocessors. Following code illustrates it: @Bean public SpringTemplateEngine templateEngine() { SpringTemplateEngine engine = new SpringTemplateEngine(); engine.setTemplateResolver( templateResolver() ); engine.setMessageSource( messageSource() ); Set&lt;SpringSecurityDialect&gt; ssdSet = new HashSet&lt;SpringSecurityDialect&gt;(); ssdSet.add( springSecurityDialect() ); engine.setAdditionalDialects( ssdSet ); return engine; } @Bean public SpringSecurityDialect springSecurityDialect() { return new SpringSecurityDialect(); }
downvote count: 0

opencsv
tag name: opencsv
tags question: http://stackoverflow.com/q/25605981
type: Tag
tags question: http://stackoverflow.com/q/25575380

http://stackoverflow.com/q/25573199
has answer: http://stackoverflow.com/a/25573271
has comment: http://stackoverflow.com/comment/39940019
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25573291
score: 1
has comment: http://stackoverflow.com/comment/39939630
tagged with: java
has answer: http://stackoverflow.com/a/25573512
possible better answer: http://stackoverflow.com/a/25573381
downvote count: 1
favorite count: 0
type: Question
has title: Simple way to ignore out of bounds exceptions JAVA
has body: I am creating a minesweeper like application and have some code that aims to check around a non mined space how many mines are around it. I have created something to this effect int count = 0; if(model.get(i-1, j-1) == MinerGridCo.UNTURNED_MINE){ count++;} if(model.get(i, j-1) == MinerGridCo.UNTURNED_MINE){ count++;} if(model.get(i-1, j) == MinerGridCo.UNTURNED_MINE){ count++;} if(model.get(i+1, j) == MinerGridCo.UNTURNED_MINE){ count++;} if(model.get(i, j+1) == MinerGridCo.UNTURNED_MINE){ count++;} if(model.get(i-1, j+1) == MinerGridCo.UNTURNED_MINE){ count++;} if(model.get(i+1, j-1) == MinerGridCo.UNTURNED_MINE){ count++;} if(model.get(i+1, j+1) == MinerGridCo.UNTURNED_MINE){ count++;} String mineNum = String.valueOf(count); cell[i][j].setText(mineNum); however, this produces errors when aim to get the mine number around the edges of the board. Any useful methods to avoid this? After trying suggestions below. I am still getting the out of bounds errors. Anyone have any advice, here is the repo if anyone wants to compile it themselves https://github.com/phillolivercomp/MineSweeper.git
has answer: http://stackoverflow.com/a/25573615
has answer: http://stackoverflow.com/a/25573291
has answer: http://stackoverflow.com/a/25573482
upvote count: 2
has comment: http://stackoverflow.com/comment/39939684
answer count: 6
has answer: http://stackoverflow.com/a/25573381
has comment: http://stackoverflow.com/comment/39939642
has comment: http://stackoverflow.com/comment/39939945

http://stackoverflow.com/comment/40139832
has text: @Thomas : Thanks for your reply.It cleared difference for me. Now I am trying to do same with the apache common exec as in it sucprocess uses standard output stream (System.out).So should I just do System.out.write() and sub process will get it in it's input stream? I tried it, but that did't work
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25683098

http://stackoverflow.com/q/25669160
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40117281
has body: I have two xml reports from the execution of two programs. Such reports contain a section which lists all the i/o operation executed, along with the content of each one. Some of them are xml, others are binary, but data contained within the report is always textual, so I have something similar to this: .....0.................. .......................@........'F...O)v...O*......................0..........l...c...= Y!...!pvw.........(.........E... yY...-qVC......p...K,......Pm.........Si4........,.......C0....?0....'...................K0....0 . *...H...... ....0I1.0 ..U....US1.0...U. . Google Inc1%0#..U....Google Internet Authority G20.. 140423121609Z. 140722000000Z0f1.0 ..U....US1.0...U... California1.0...U... Mountain View1.0...U. . Google Inc1.0...U....*.google.com0...."0 . *...H...... ..........0.... ..............&amp;gt;..........:...z...S...5...%f............-....*J...i.......c}m......N%...t....G..f.......y.........0x...F.........:......k...k$......!............I...A...........A...G.......q...C...g........r.......b....6.......c...|X.........F...?qs......'.........................mrM.....D....9... ....$...v... .........=.........amAdo..V.....................@.../... U~....r......... .........g_ ...[y...7=...i... &amp;gt;......b......s...........W......#w..............e..........yI.........{..............0.....0...U.%..0...+.........+.......0.........U..........0.......*.google.com... *.android.com....*.appengine.google.com....*.cloud.google.com....*.google-analytics.com....*.google.ca....*.google.cl....*.google.co.in....*.google.co.jp....*.google.co.uk....*.google.com.ar....*.google.com.au....*.google.com.br....*.google.com.co....*.google.com.mx....*.google.com.tr....*.google.com.vn....*.google.de....*.google.es....*.google.fr....*.google.hu....*.google.it....*.google.nl....*.google.pl....*.google.pt....*.googleapis.cn....*.googlecommerce.com....*.googlevideo.com... *.gstatic.com... *.gvt1.com....*.urchin.com....*.url.google.com....*.youtube-nocookie.com... *.yo…
has title: Compare text representation of binary file
tagged with: comparison
has comment: http://stackoverflow.com/comment/40114725
tagged with: diff
has comment: http://stackoverflow.com/comment/40114640
tagged with: text
score: 0
has comment: http://stackoverflow.com/comment/40142476
tagged with: java
has comment: http://stackoverflow.com/comment/40116787
answer count: 1
has comment: http://stackoverflow.com/comment/40121339
tagged with: string
type: Question
has answer: http://stackoverflow.com/a/25710915

http://stackoverflow.com/comment/40046705
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25631537
has text: line 11: c=x.add(y); line 53: temp.m[i][j]=m[i][j]+n.m[i][j];
type: Comment

http://stackoverflow.com/a/25646668
has comment: http://stackoverflow.com/comment/40073635
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25646571
score: 1
has body: This is exactly why absolute layouts are not recommended. Your best approach will be to use something like GridBagLayout which will position the elements and then let them move as the screen resizes and reshapes. There are plenty of good documentation and tutorials online for GridBagLayout that will get you started. You can also use tools built into some IDEs (NetBeans has a good one for example) to let you lay things out graphically.

http://stackoverflow.com/comment/40079837
has text: DO the fault POJO's differ in each of your exception classes?
comment on: http://stackoverflow.com/q/25638029
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25658482
has comment: http://stackoverflow.com/comment/40095447
tagged with: sql
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40109459
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40095965
has comment: http://stackoverflow.com/comment/40100677
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40095974
has comment: http://stackoverflow.com/comment/40151836
has comment: http://stackoverflow.com/comment/40096393
has comment: http://stackoverflow.com/comment/40095496
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25659325
has comment: http://stackoverflow.com/comment/40095568
tagged with: swing
has body: I'm having a problem in my project i cant Connect the program with the data Source So if there's any help plzz assist me this is the error message and the source code below I'm in trouble plzzz help meeeeee //for creating the North Panel private JPanel northPanel = new JPanel(); //for creating the Center Panel private JPanel centerPanel = new JPanel(); //for creating the label private JLabel northLabel = new JLabel("THE LIST FOR THE BOOKS"); //for creating the button private JButton printButton; //for creating the table private JTable table; //for creating the TableColumn private TableColumn column = null; //for creating the JScrollPane private JScrollPane scrollPane; //for creating an object for the ResultSetTableModel class private ResultSetTableModel tableModel; /*************************************************************************** * for setting the required information for the ResultSetTableModel class. * ***************************************************************************/ private static final String JDBC_DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver"; private static final String DATABASE_URL = "jdbc:odbc:Telecom"; private static final String DEFAULT_QUERY = "SELECT EmployeeID,EmployeeName,ProjectName,JobTitle,MobileNumber,DateOfSim,SimNumber,MCG,Active FROM [Telecom].[dbo].[Employee];"; //constructor of listBooks public ListBooks() { //for setting the title for the internal frame super("Employee", false, true, false, true); //for setting the icon setFrameIcon(new ImageIcon(ClassLoader.getSystemResource("images/List16.gif"))); setLocale(new java.util.Locale("ar", "SA", "")); //for getting the graphical user interface components displaygvk area Container cp = getContentPane(); //for bassing the required information to the ResultSetTableModel object try { tableModel = new ResultSetTableModel(JDBC_DRIVER, DATABASE_URL, DEFAULT_QUERY); //for setting the Query try { tableModel.setQuery(DEFAULT_QUERY); } catch (SQLException sqlException) { } } catch (ClassNotFo…
has comment: http://stackoverflow.com/comment/40095689
has comment: http://stackoverflow.com/comment/40095551
has comment: http://stackoverflow.com/comment/40096124
score: 0
has title: java and database connection

http://stackoverflow.com/comment/39966406
type: Comment
type: AnswerComment
score: 0
has text: While it's true it won't compile, even if it would - it wouldn't do any work. So clearly it's not supposed to be a naked variable declaration. But still, +1 for being *technically* correct about valid statements.
comment on: http://stackoverflow.com/a/25587844

http://stackoverflow.com/comment/39931405
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25566930
has text: @Javabeginner You're recursively decrementing your s variable, given that, after you write the leading spaces and the symbols, how can you know how many ending spaces to write? Answer: by passing in and handling a variable that tells you how many ending spaces to write - handle it the same way you do the beginning spaces but after the symbols have been written.
score: 0

http://stackoverflow.com/comment/40167487
comment on: http://stackoverflow.com/a/25698178
score: 0
type: Comment
type: AnswerComment
has text: What does context root mean? Is it the project's name? Since eclipse has configured every folder by default, I don;t remember the structure. Can you provide me with an example?

http://stackoverflow.com/a/25713814
has comment: http://stackoverflow.com/comment/40196622
has comment: http://stackoverflow.com/comment/40200545
downvote count: 0
has comment: http://stackoverflow.com/comment/40310912
has comment: http://stackoverflow.com/comment/40260146
upvote count: 1
answers question: http://stackoverflow.com/q/25712314
type: Answer
has comment: http://stackoverflow.com/comment/40308410
has body: You have to register it as a provider. Did you annotate it @Provider?
score: 1

http://stackoverflow.com/a/25565400
type: Answer
has comment: http://stackoverflow.com/comment/39926064
answers question: http://stackoverflow.com/q/25563539
has body: Error code 503 means, your code is not deployed properly. In other words it is not deploy-able. It's rather unclear what causes your problem. What we can do here is provide you with some working example code snippets. I extracted these from my working programs. So please try to use these guides and give feedback. web.xml resteasy.scan true resteasy-servlet org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher resteasy-servlet /* Java code @Path("/payment") public class PaymentResource { @GET @Path("/test") @Produces("application/json") public Response doPaymentTest() { return Response.status(201).entity("success.").build(); } } Pom dependencies org.jboss.resteasy resteasy-jaxrs 2.3.1.GA org.jboss.resteasy resteasy-jackson-provider 2.3.1.GA Edit: Here is a link to my github project. Mkyong has good examples too.
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/comment/40019264
type: QuestionComment
has text: @SuneelPrakash: yes i allocated the sd card size as 9MiB
score: 0
comment on: http://stackoverflow.com/q/25616560
type: Comment

regex-negation
tags question: http://stackoverflow.com/q/25655853
type: Tag
tags question: http://stackoverflow.com/q/25553470
tags question: http://stackoverflow.com/q/25608537
tag name: regex-negation

http://stackoverflow.com/comment/40100833
has text: @Gumbo By "Clean -> Build" , I meant first clean the project and then build it. I think eclipse keeps this thing same in all versions but it is possible that they changed in newer version:)
score: 0
comment on: http://stackoverflow.com/q/25661334
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/128106223
type: Comment
score: 0
type: AnswerComment
has text: Thank you for your answer. I am unable to make any comment at this time in relation to my original question because I am not actively working on the project now; it's all a bit of a distant hazy memory!
comment on: http://stackoverflow.com/a/72513454

http://stackoverflow.com/q/25619178
upvote count: 15
has title: Eclipse. How to activate tooltip popup using shortcut?
tagged with: popup
has body: for example we have following method: ... public void method1(){ method2(); } ... method2 can throws exception and Eclipse offer either wrap by try catch or declare throws declaration. Each time I need pick up the mouse and hover mouse cursor to this row. Is it possible select wrap or throws without using mouse?
has answer: http://stackoverflow.com/a/52695406
accepted answer: http://stackoverflow.com/a/25619242
downvote count: 0
tagged with: tooltip
tagged with: keyboard-shortcuts
has answer: http://stackoverflow.com/a/25619242
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25619248
possible better answer: http://stackoverflow.com/a/35598282
tagged with: java
has answer: http://stackoverflow.com/a/35598282
score: 15
tagged with: eclipse
answer count: 4
type: Question

http://stackoverflow.com/a/25697400
answers question: http://stackoverflow.com/q/25697362
has comment: http://stackoverflow.com/comment/40185620
score: 1
has comment: http://stackoverflow.com/comment/40180465
has comment: http://stackoverflow.com/comment/40166250
downvote count: 0
has comment: http://stackoverflow.com/comment/40183130
upvote count: 1
has body: Looking at the error, it seems like you're calling getActivity() inside onCreateView(). You should be getting the activity in onActivityCreated instead where it shouldn't be null.
has comment: http://stackoverflow.com/comment/40166210
has comment: http://stackoverflow.com/comment/40185513
type: Answer
has comment: http://stackoverflow.com/comment/40200939

http://stackoverflow.com/comment/40165659
type: Comment
type: AnswerComment
has text: recursion is like a tree, once it find a leaf, it has to unwind from there
score: 1
comment on: http://stackoverflow.com/a/25696999

http://stackoverflow.com/a/25596858
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/39982968
has body: Create a StringBuilder object and a Random Repeat steps 3-4 as many times as desired: Generate a random boolean value using Random.nextBoolean(). If the value is false, append an 'A' to the StringBuilder; otherwise append a 'B' Use StringBuilder.toString() to get a String object. If you wanted to generate a string with n &gt; 2 characters, you could modify step 3 to generate a random integer between 0 (inclusive) and n (exclusive) using Random.nextInt(n) and then modify step 4 to append the character corresponding to the generated random value.
has comment: http://stackoverflow.com/comment/39982955
answers question: http://stackoverflow.com/q/25596839
upvote count: 3
downvote count: 0

mousemotionlistener
type: Tag
tag name: mousemotionlistener
tags question: http://stackoverflow.com/q/25672489

http://stackoverflow.com/comment/40193139
type: QuestionComment
comment on: http://stackoverflow.com/q/25711008
has text: @HotLicks looks like it works if I do the import AND call the method as `Commons.method()`. Which I find weird, because for Math functions for example, you can do Math.sqrt() without importing Math ¿?. I don't understand packages anymore, he he.
score: 0
type: Comment

http://stackoverflow.com/a/25609465
type: Answer
score: 2
has body: You should write a custom Jackson filter which would filter out a POJO property depending on other property value. You should override the PropertyFilter.serializeAsField() method to get access to the instance of the serialized object. Here is an example: public class JacksonFilter2 { @JsonFilter("filter") public static class Bar { public final int id; @JsonIgnore public final boolean ignoreId; public final String name; public Bar(int id, boolean ignoreId, String name) { this.id = id; this.ignoreId = ignoreId; this.name = name; } } public static class ExcludeIdFilter extends SimpleBeanPropertyFilter { @Override protected boolean include(BeanPropertyWriter writer) { return true; } @Override protected boolean include(PropertyWriter writer) { return true; } @Override public void serializeAsField(Object pojo, JsonGenerator jgen, SerializerProvider provider, PropertyWriter writer) throws Exception { if (pojo instanceof Bar &amp;&amp; "id".equals(writer.getName()) &amp;&amp; ((Bar) pojo).ignoreId) { writer.serializeAsOmittedField(pojo, jgen, provider); } else { super.serializeAsField(pojo, jgen, provider, writer); } } } public static void main(String[] args) throws JsonProcessingException { List&lt;Bar&gt; bars = Arrays.asList(new Bar(1, false, "one"), new Bar(2, true, "two")); ObjectMapper mapper = new ObjectMapper(); mapper.setFilters(new SimpleFilterProvider().addFilter("filter", new ExcludeIdFilter())); System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(bars)); } } Output: [ { "id" : 1, "name" : "one" }, { "name" : "two" } ]
has comment: http://stackoverflow.com/comment/40008859
upvote count: 2
has comment: http://stackoverflow.com/comment/40007005
downvote count: 0
has comment: http://stackoverflow.com/comment/40010539
answers question: http://stackoverflow.com/q/25603581

http://stackoverflow.com/a/25699668
score: 1
type: Answer
has body: I think you are confused about how JSP works. JSP is a graphical facade on Java Servlets, which (normally) take in an http request, and returns some html or an error code. That's the servlet's entire life span... the servlet will re-run with every incoming request. To do what it seems you want to do, you will need to find a solution in JavaScript / JQuery. A commenter has suggested you look up on AJAX programming - you should take his advice.
accepted answer of: http://stackoverflow.com/q/25699590
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25699590
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/40064499
score: 0
comment on: http://stackoverflow.com/a/25641673
type: Comment
type: AnswerComment
has text: @talex : agreed...but i am more of old school type..plus this method doesn't do any harm in terms of performance IMHO!! :)

http://stackoverflow.com/a/25597664
has body: Child views are indexed from 0. In other words, the first child view is 0, the second child view is 1... and so on. Also, why don't you just get the the ImageView by it's ID? AnimatedGifImageView musicAnim = (AnimatedGifImageView) findViewById(R.id.music_anim);
answers question: http://stackoverflow.com/q/25597647
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/40170917
type: Comment
has text: I never thought of that. Will have to see what effect that has on the rest of the System, but off the top of my head, it might be possible. Thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25700175

http://stackoverflow.com/comment/71201186
type: Comment
type: AnswerComment
score: 0
has text: Thank you for this post. Spent seven hours trying to find this information.
comment on: http://stackoverflow.com/a/25692288

http://stackoverflow.com/comment/39941576
type: QuestionComment
has text: @JasonSperske @markspace - yes, that's what I'm talking about. Executing, for example, `C:\Windows\System32\calc.exe`. I'm familiar with web servers like Glassfish and Tomcat and deploying `war` web applications there. And, as far as I know, I can't trigger execution of user local program using Java on a server side.
score: 0
comment on: http://stackoverflow.com/q/25574038
type: Comment

http://stackoverflow.com/comment/40122796
score: 0
comment on: http://stackoverflow.com/q/25673858
type: Comment
type: QuestionComment
has text: Well parse into the parts you have noted, and then add (using the right multiple. How are you handling leap years? Let's see some code.

http://stackoverflow.com/comment/40179428
score: 0
has text: It is the second time I use this site, sorry, thank you for noticing me.
comment on: http://stackoverflow.com/q/25704615
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40019123
score: 0
has text: are u testing this app on android 4.4 ?
type: Comment
comment on: http://stackoverflow.com/q/25616560
type: QuestionComment

http://stackoverflow.com/a/25673664
has body: If this is the line where your NullPointerException is: if (json.getString(KEY_SUCCESS) != null) { Most probably your json parameter passed to your method protected void onPostExecute(JSONObject json) is null. If this is the case, the statement json.getString(KEY_SUCCESS) will throw a NullPointerException since you are trying to access the method of a null object. Set a breakpoint where you call this method, and make sure that the value you pass to it is not null.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25673362
answers question: http://stackoverflow.com/q/25673362
type: Answer

http://stackoverflow.com/a/25572518
has body: Firstly, don't use Activity.RESULT_OK as a request code. That's a result code. Change the request code, something like "123" or something, I don't know. Then, secondly: inside FullImageActivity.class, make sure you build your Intent with the stuff that you need, and then you call Intent myIntent = new Intent(); myIntent.putExtra("your_stuff_here"); setResult(Activity.RESULT_OK, myIntent); finish(); so that your code execution returns the result to the fragment that called it. inside your caller fragment (Fragment1) make the call to super as last thing. Something like this: @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub if(requestCode == "123" &amp;&amp; resultCode == Activity.RESULT_OK){ Log.i("called","called"); //add your logic here } super.onActivityResult(requestCode, resultCode, data); }
has comment: http://stackoverflow.com/comment/39953735
accepted answer of: http://stackoverflow.com/q/25571921
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25571921
score: 0

http://stackoverflow.com/comment/94374960
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25554911
type: Comment
has text: "there is no need to name a variable of type Optional, so there’s no need for a naming convention." what if the optional comes from a method parameter? I know some IDEs discourage doing so but it's totally possible. In that case, you *do* need to name it. I consider this answer is totally opinionated and doesn't really answer the OP's question.

http://stackoverflow.com/q/25586519
has answer: http://stackoverflow.com/a/25586650
has comment: http://stackoverflow.com/comment/39964047
tagged with: java
has answer: http://stackoverflow.com/a/25586594
possible better answer: http://stackoverflow.com/a/25586594
answer count: 4
has title: How can I shift a int by 4n times in java?
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25586531
has comment: http://stackoverflow.com/comment/39963900
has answer: http://stackoverflow.com/a/25586564
accepted answer: http://stackoverflow.com/a/25586564
tagged with: shift
has comment: http://stackoverflow.com/comment/39963966
has body: So for example there is a function: public int shift4N(int num, int n) { num = num &lt;&lt; n &lt;&lt; n &lt;&lt; n &lt;&lt; n; return num; } Is there a less redundant way to do it? Multiplication is not allowed though... Any help would be greatly appreciated :)
type: Question

http://stackoverflow.com/a/25700354
score: 2
answers question: http://stackoverflow.com/q/25700074
has comment: http://stackoverflow.com/comment/40172005
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40172307
has comment: http://stackoverflow.com/comment/40171932
has comment: http://stackoverflow.com/comment/40171794
has comment: http://stackoverflow.com/comment/40171277
has comment: http://stackoverflow.com/comment/40171833
upvote count: 2
has comment: http://stackoverflow.com/comment/40171691
type: Answer
accepted answer of: http://stackoverflow.com/q/25700074
has body: You are already using date modifiers. Just subtract one more week/month/year: ... BETWEEN date('now', '-14 days') AND date('now', '-7 days') ... BETWEEN date('now', 'start of month', '-1 months') AND date('now', 'start of month', '-1 days') ... BETWEEN date('now', '-2 years') AND date('now', '-1 years')

http://stackoverflow.com/comment/40797062
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25776379
type: Comment
has text: This isn't an answer. It's a comment or (better) an edit to your original question.

http://stackoverflow.com/comment/40130467
has text: @DaveMcFave - Check out the Getting Started tutorial that was linked in your question as it goes through step-by-step what Hello World does and how it works. I also suggest going back to your instructor and getting them to explain the fundamentals of how a program works in Java (and in general).
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25677819
type: AnswerComment

http://stackoverflow.com/a/25650713
upvote count: 0
downvote count: 2
has body: Try this code in your form tag <form enctype="multipart/form-data" action="imgins.jsp?id=<%=id%>" method="post"> Choose the file To Upload: then you can insert image to database using the below code <% String saveFile = ""; String contentType = request.getContentType(); if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) { DataInputStream in = new DataInputStream(request.getInputStream()); int formDataLength = request.getContentLength(); byte dataBytes[] = new byte[formDataLength]; int byteRead = 0; int totalBytesRead = 0; while (totalBytesRead < formDataLength) { byteRead = in.read(dataBytes, totalBytesRead, formDataLength); totalBytesRead += byteRead; } String file = new String(dataBytes); saveFile = file.substring(file.indexOf("filename=\"") + 10); saveFile = saveFile.substring(0, saveFile.indexOf("\n")); saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1, saveFile.indexOf("\"")); int lastIndex = contentType.lastIndexOf("="); String boundary = contentType.substring(lastIndex + 1, contentType.length()); int pos; pos = file.indexOf("filename=\""); pos = file.indexOf("\n", pos) + 1; pos = file.indexOf("\n", pos) + 1; pos = file.indexOf("\n", pos) + 1; int boundaryLocation = file.indexOf(boundary, pos) - 4; int startPos = ((file.substring(0, pos)).getBytes()).length; int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length; File ff = new File(saveFile); FileOutputStream fileOut = new FileOutputStream(ff); fileOut.write(dataBytes, startPos, (endPos - startPos)); fileOut.flush(); fileOut.close(); Connection connection = null; String connectionURL = "jdbc:mysql://localhost/movie"; ResultSet rs = null; PreparedStatement psmnt = null; FileInputStream fis; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = DriverManager.getConnection(connectionURL, "root", "root"); File f = new File(saveFile); int id = Integer.parseInt(request.getParameter("id").toString()); psmnt = connection.prepareStatement("updat…
has comment: http://stackoverflow.com/comment/40085069
has comment: http://stackoverflow.com/comment/40082789
has comment: http://stackoverflow.com/comment/40082616
has comment: http://stackoverflow.com/comment/40082371
score: -2
type: Answer
answers question: http://stackoverflow.com/q/25650568

http://stackoverflow.com/a/25568736
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: If the numbers in array 1 and 2 belong together, you could create an object with the two belonging fields. Lets call that a "Pair" which has the properties "foo" and "bar". I would then create those pairs and sort them by their foo property like this: public class SortPairs { static class Pair { final int foo; final int bar; Pair(int foo, int bar) { this.foo = foo; this.bar = bar; } @Override public String toString() { return "Pair{" + "foo=" + foo + ", bar=" + bar + '}'; } } public static void main(String[] args) { List&lt;Pair&gt; pairs = Arrays.asList( new Pair(3, 1), new Pair(4, 2), new Pair(2, 3), new Pair(1, 4), new Pair(5, 5)); System.out.println(pairs); Collections.sort(pairs, (pair1, pair2) -&gt; pair1.foo - pair2.foo); System.out.println(pairs); } }
answers question: http://stackoverflow.com/q/25568525
score: 3
accepted answer of: http://stackoverflow.com/q/25568525
upvote count: 3

http://stackoverflow.com/comment/39965174
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25587173
has text: @user3081098 you need super.method() only if you are inside method() and want to call the same method in a super class. And this does not work in static.
score: 0

http://stackoverflow.com/q/25603366
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39994985
tagged with: java
has body: I have a JCheckBox, where I need the value different from the Text displayed as processing needs some other name and the name to be displayed is a shorter name. The only method I saw for JCheckBox is setText("Text") which just handles the display part.
has answer: http://stackoverflow.com/a/25603480
accepted answer: http://stackoverflow.com/a/25603480
type: Question
has comment: http://stackoverflow.com/comment/39995728
upvote count: 2
tagged with: jcheckbox
has comment: http://stackoverflow.com/comment/39994927
has comment: http://stackoverflow.com/comment/39995022
answer count: 1
downvote count: 0
has title: Create a JCheckBox with text as columnName but value as "schema.table.columnname"
tagged with: swing
favorite count: 0
score: 2

http://stackoverflow.com/q/25629804
tagged with: java
has body: public A { public A(String arg0) { ... } public A(String arg0, String arg1) { ... } } public B extends A { } I would like B to automatically have the constructors inherited from A without having to implement them explicitly like: public B(String arg0) { super(arg0); } public B(String arg0, String arg1) { super(arg0, arg1); } How can I achieve this?
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25630025
has title: Constructor inheritance
answer count: 4
has answer: http://stackoverflow.com/a/25629815
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25629815
score: 0
has answer: http://stackoverflow.com/a/25629871
possible better answer: http://stackoverflow.com/a/25629871
has answer: http://stackoverflow.com/a/25629830
upvote count: 1

http://stackoverflow.com/comment/40061493
type: Comment
comment on: http://stackoverflow.com/q/25639870
type: QuestionComment
score: 0
has text: i am not using the maven release plugin yet because i won't be able to scp the file as the name will change - and jenkins is responsible for picking up this file and copying it

http://stackoverflow.com/comment/40182523
comment on: http://stackoverflow.com/q/25706385
score: 0
has text: What kind of double-quotes is it: `”` or `"` ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40067921
has text: i m using json..how that spring security will get to know that i m enetring right username ad password?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25643610

http://stackoverflow.com/q/25706990
has answer: http://stackoverflow.com/a/25707026
has comment: http://stackoverflow.com/comment/40183539
score: 1
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25707043
upvote count: 1
possible better answer: http://stackoverflow.com/a/25707026
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25707059
has body: My question is how initialize an 2-D array outside of the main, lets say I want to print number[0][0] How would I go about accessing that specific variable from the main public class Example{ public static void main(String[] args) { Example myexample = new Example(); myexample.definenumbers(); } public void definenumbers() { int [][] number = { {2,0},{3,1} }; }
has title: Initialization outside of main Java
accepted answer: http://stackoverflow.com/a/25707017
has answer: http://stackoverflow.com/a/25707017
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/a/25631037
answers question: http://stackoverflow.com/q/25630906
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40046152
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40045887
has comment: http://stackoverflow.com/comment/40046044
has comment: http://stackoverflow.com/comment/40045758
has comment: http://stackoverflow.com/comment/40046231
type: Answer
accepted answer of: http://stackoverflow.com/q/25630906
has body: Calling setbounds from your reshape method would be causing stackoverflowerror. If you look at the source code of Component class the setBounds method calls the reshape method. So from your reshape method when you call super (Component) class setbounds method then from this Component setbounds method again your reshape overridden method is called which is why there is a recursive call and hence statckoverflowerror. To fix this you need to call super.reshape(...) instead of super.setBounds(..) A sample code demonstrating this is given below:- public class MyClass { public static void main(String[] args) { // TODO Auto-generated method stub MyClassB obj = new MyClassB(); obj.reshape(0, 2, 4, 6); } } class MyClassA { public void setBounds(int x,int y,int width,int height) { reshape(x, y, width, height); // This calls the child class reshape method if it is overridden and hence can be recursive call } public void reshape(int x,int y,int width,int height) { } } class MyClassB extends MyClassA { public void reshape (int x, int y, int w, int h) { super.setBounds(x, y, w, h); }; }

http://stackoverflow.com/a/25737290
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25685387
has body: I faced similar issue in my framework as well but while investigating the root cause I found that the culprit was a java script based wait method. So I replaced that method and it worked for me. But your code does not have such kind java script based wait method. I feel there is something wrong with selenium wait conditions and in your case execution gets stuck at wait.until(ExpectedConditions.presenceOfElementLocated(By.className("cart-scroll"))); It means it keep waiting for expected and never time out without any exception. Have a look here: https://code.google.com/p/selenium/issues/detail?id=6955 Selenium webdriver execution gets stuck due to a javascript wait condition

http://stackoverflow.com/comment/40169948
comment on: http://stackoverflow.com/q/25698620
type: Comment
has text: @MarkoTopolnik Yes, that is my best guess: Somewhere in creating the `new Runnable()` the exception occurs. I cannot catch the exception in c++ since the function returns normally (Whether I catch the exception in java or not it is not passed to c++).
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40046496
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25628454
has text: @PabloMatíasGomez I added the last section as an answer to your comment. Also, search StackOverflow before posting, as these issues have been discussed hundreds of times.
type: AnswerComment

http://stackoverflow.com/q/25627617
answer count: 1
tagged with: sonarqube
favorite count: 0
type: Question
upvote count: 4
has body: I have some trouble using SonarQube on an extern server. I'm working with SonarQube just for a couple days now and when I analyze my Maven project local everything is working fine. We are using a Postgresql database. But there are some problems when I try to analyze a project on an extern SonarQube server. The Environment: I'm using SonarQube 4.4 and Maven 3.3. Please find my Maven settings.xml down below. &lt;profile&gt; &lt;id&gt;sonar&lt;/id&gt; &lt;activation&gt; &lt;activeByDefault&gt;true&lt;/activeByDefault&gt; &lt;/activation&gt; &lt;properties&gt; &lt;sonar.jdbc.url&gt; jdbc:postgresql://databaseadress/sonarqube?useUnicode=true&amp;amp;characterEncoding=utf8 &lt;/sonar.jdbc.url&gt; &lt;sonar.jdbc.username&gt;username&lt;/sonar.jdbc.username&gt; &lt;sonar.jdbc.password&gt;password&lt;/sonar.jdbc.password&gt; &lt;sonar.host.url&gt; http://hostAdress &lt;/sonar.host.url&gt; &lt;/properties&gt; &lt;/profile&gt; I already added the correct database connection. I set up the SonarQoube server by myself and the sonar.propterties was changed correctly.The project is written in Java. Running an analysis it connects to the database and it starts analysing. The Problem: If I analyze the project with mvn sonar:sonar I get the following message: ... INFO: SonarQube Server 4.4 [INFO] [17:07:01.958] Load global settings [INFO] [17:07:02.137] User cache: C:\Users\christian.braun.sonar\cache [INFO] [17:07:02.142] Install plugins [INFO] [17:07:02.159] Install JDBC driver [INFO] [17:07:02.163] Create JDBC datasource for jdbc:postgresql://databaseadress /sonarqube?useUnicode=true&amp;characterEncoding=utf8 [INFO] [17:07:02.229] Initializing Hibernate [INFO] [17:07:04.077] Loading technical debt model... [INFO] [17:07:04.089] Loading technical debt model done: 12 ms [INFO] [17:07:04.090] Load project settings [INFO] [17:07:04.170] Apply project exclusions [INFO] [17:07:04.257] ------------- Scan TestMaven [INFO] [17:07:04.259] Load module settings [INFO] [17:07:04.394] Loading r…
tagged with: report
downvote count: 0
has answer: http://stackoverflow.com/a/25641327
accepted answer: http://stackoverflow.com/a/25641327
tagged with: maven
score: 4
type: AnsweredQuestion
has title: Analysing with SonarQube causes 0 files indexed and no reports (Maven Project)
tagged with: java

http://stackoverflow.com/q/25578549
tagged with: printing
tagged with: filter
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39967976
has body: I'm trying to run this java code: public class Lector{ public static void main(String[] args) { int numVentaint; try{ List&lt;Guardar&gt; guardar = new ArrayList&lt;Guardar&gt;(); CsvReader ventas_import = new CsvReader("C:\\Users\\Karen Jaure\\Downloads\\Kubii-Sushi-Ventas.csv"); // ac· se agrega la ruta de csv ventas_import.readHeaders(); while (ventas_import.readRecord()){ String numVenta= ventas_import.get(0); String fechaVenta= ventas_import.get(1); String horaVenta= ventas_import.get(2); String nombreProducto = ventas_import.get(4); String montoTotal= ventas_import.get(7); String codProducto= ventas_import.get(3); String precioUnitarioProducto= ventas_import.get(5); String cantidadUnidades = ventas_import.get(6); guardar.add(new Guardar(numVenta, fechaVenta, horaVenta, codProducto, nombreProducto, precioUnitarioProducto, cantidadUnidades)); } ventas_import.close(); for(Guardar us:guardar){ System.out.println(us.getNumVenta()); } } catch (FileNotFoundException e){ e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } I want to show only "numVenta" attribute of "Guardar" class but when I run it, the system out print method doesn't filter the attribute given by the "Guardar" class method ".getNumVenta()". I just can't find the error! Help will be very appreciated. UPDATED Here is the "Guardar" class: public class Guardar { private String numVenta; private String fechaVenta; private String horaVenta; private String codProducto; private String nomProducto; private String precioUnitario; private String cantidadUnidades; public Guardar(String numVenta, String fechaVenta, String horaVenta, String codProducto, String nomProducto, String precioUnitario, String cantidadUnidades) { this.numVenta = numVenta; this.fechaVenta = fechaVenta; this.horaVenta = horaVenta; this.codProducto = codProducto; this.nomProducto = nomProducto; this.precioUnitario = precioUnitario; this.cantidadUnidades = cantidadUnidades; } public String getNumVenta() { return numVenta…
tagged with: system
type: Question
tagged with: out
has comment: http://stackoverflow.com/comment/40937033
type: UnansweredQuestion
has title: When running my Java code System.out.println() doesn't recognize a condition
has comment: http://stackoverflow.com/comment/39950622

http://stackoverflow.com/comment/40163532
type: AnswerComment
comment on: http://stackoverflow.com/a/25695889
type: Comment
has text: thank you so much for the quick update...!!!! I am checking this out right now!! I really appreciate you updating your source for this use case in I think less than 1 hour? :-)
score: 0

http://stackoverflow.com/comment/40008890
has text: Thanks for making me understand about it but know app is force closing Collections.addAll(values, result); // Log.v(sid,"working here"); adapter.notifyDataSetChanged(); // Here it stops
type: Comment
comment on: http://stackoverflow.com/a/25610480
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40178554
type: Comment
has text: Hmm, that middle snippet doesn't work at all, haha. Just looked at it, after seeing your comment, and saw it instantly. I'll just remove it. No time to fix it atm.
comment on: http://stackoverflow.com/a/25701173
type: AnswerComment
score: 0

http://stackoverflow.com/a/25701419
answers question: http://stackoverflow.com/q/25701147
score: 0
has body: Piece of code using only arrays. String[] x = {"1","2","3",null,"4","5","6",null,"7","8","9"}; String[] a = new String[x.length]; int i = 0; for(String s : x) { if(s != null) a[i++] = s; } String[] arr = Arrays.copyOf(a, i); Or this: String[] xx = {"1","2","3",null,"4","5","6",null,"7","8","9"}; int pos = 0, i = 0; String tmp; for(String s : xx) { if(s == null) { tmp = xx[pos]; xx[pos] = s; xx[i] = tmp; pos++; } i++; } String[] arr = Arrays.copyOfRange(xx, pos, xx.length);
type: Answer

http://stackoverflow.com/q/25609720
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40006716
tagged with: long-integer
has comment: http://stackoverflow.com/comment/40007124
score: -1
has comment: http://stackoverflow.com/comment/40006341
has answer: http://stackoverflow.com/a/25610036
has comment: http://stackoverflow.com/comment/40006397
accepted answer: http://stackoverflow.com/a/25610036
type: AnsweredQuestion
has body: I am required specifically to use BigInteger in place of long. This is so if the fibonacci number is too large, it won't return a negative. We haven't done some of the more complicated functions that java has built in, so I'm going to have to do it as simple as possible. import java.util.Scanner; public class FibBigInt{ public static long fib_l(int n){ long result = 0; long f0 = 1, f1 = 1; while(n &gt; 0){ f0 = f1; f1 = result; result = f0 + f1; n--; } return result; } public static long fib_r(int n){ long result = 1; if(n &lt;= 2){ return result; } else{ result = fib_r(n - 1) + fib_r(n - 2); } return result; } public static long fval[]; public static long fib_r_Memo(int n){ long result = 1; if(n &gt; 2) { if(fval[n] != 0){ result = fval[n]; } else{ result = fib_r_Memo(n - 1) + fib_r_Memo(n - 2); fval[n] = result; } } return result; } public static void main(String [] args){ Scanner s = new Scanner(System.in); System.out.print("Please enter an integer: "); int n = s.nextInt(); long t1 = System.currentTimeMillis(); //System.out.println("Fibonacci number " + n + " is " + fib_l(n)); //System.out.println("Fibonacci number " + n + " is " + fib_r(n)); fval = new long[n + 1]; for(int i = 0; i &lt; fval.length; ++i){ fval[i] = 0; } System.out.println("Fibonacci number " + n + " is " + fib_r_Memo(n)); long t2 = System.currentTimeMillis(); System.out.println("Elapsed time: " + (t2 - t1)/1000 + " seconds. "); } }
upvote count: 0
tagged with: biginteger
has comment: http://stackoverflow.com/comment/40006373
has comment: http://stackoverflow.com/comment/40007235
tagged with: java
answer count: 1
downvote count: 1
has title: Class assignment requires me to have two versions of the same code. This one, and one using BigInteger. Need help converting to BigInteger
tagged with: string
has comment: http://stackoverflow.com/comment/40006791

http://stackoverflow.com/a/25678733
type: Answer
has body: Use Date-Time Type The answer by MadProgrammer is correct. When working with date-time values, work with them as date-time data types. That's generally best. If you had a bunch of strings representing numbers, wouldn't you convert to numeric data types for your business logic? Avoid java.util.Date My only improvement to the other answer is to advise against using java.util.Date. Both that class and .Calendar that are bundled with Java are notoriously troublesome and should be avoided. Instead use the Joda-Time library or the new java.time package in Java 8 inspired by Joda-Time. Date-Only Both Joda-Time and java.time offer a LocalDate class to handle a date-only value without any time-of-day or time zone. Just the thing for this Question. Joda-Time We use a DateTimeFormatter to parse the string by calling parseLocalDate. If you do not trust your data source, trap for IllegalArgumentException. Here is some code using Joda-Time 2.4. List&lt;LocalDate&gt; list = new ArrayList&lt;LocalDate&gt;(); DateTimeFormatter formatter = DateTimeFormat.forPattern( "dd-MM-yyyy" ); String dates[] = { "05-11-2014" , "23-08-2014" , "05-02-2013" }; for ( String string : dates ) { LocalDate localDate = formatter.parseLocalDate( string ); list.add( localDate ); } Collections.sort( list ); Dump to console. Output in original format. System.out.println( "list: " + list ); StringBuilder output = new StringBuilder( "Localized sorted list of dates: " ); for ( LocalDate localDate : list ) { output.append( formatter.print( localDate ) ).append( " | " ); } System.out.println( output ); When run. list: [2013-02-05, 2014-08-23, 2014-11-05] Localized sorted list of dates: 05-02-2013 | 23-08-2014 | 05-11-2014 | Or, using the new Java 8 syntax with lambdas. Not really sure if that's an improvement or not. List&lt;LocalDate&gt; list = new ArrayList&lt;&gt;(); DateTimeFormatter formatter = DateTimeFormat.forPattern( "dd-MM-yyyy" ); String[] dateStringsArray = { "05-11-2014" , "23-08-2014" , "05-02-2013"…
downvote count: 0
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25677690

http://stackoverflow.com/a/25551240
has comment: http://stackoverflow.com/comment/39898402
answers question: http://stackoverflow.com/q/25551057
has comment: http://stackoverflow.com/comment/39898327
has comment: http://stackoverflow.com/comment/39899249
type: Answer
has body: If you are using something before Java 8, you can use the Calendar class, specifically the overloaded getInstance method that takes a TimeZone as a parameter or the getInstance method that takes a TimeZone and a locale as a parameter. You can use any time zone, but it seems like Greenwich Mean Time or Universal Coordinated Time would be most appropriate for your needs. Java 8 provides a new date/time package that you could use. Unfortunately, I'm not as familiar with this interface, but I would look at the Clock class and the Instant class.
score: 0
has comment: http://stackoverflow.com/comment/39901640

http://stackoverflow.com/comment/39925001
comment on: http://stackoverflow.com/q/25561820
score: 0
type: Comment
type: QuestionComment
has text: What do you mean by "freeze" ? Do you have to forcefully kill the webbrowser? At which point does it freeze? You can look at the network traffic in the console of FF for example. (Does the request go to the server, does a answer come back from server etc.)

http://stackoverflow.com/q/25579636
has comment: http://stackoverflow.com/comment/39951675
has answer: http://stackoverflow.com/a/25579919
answer count: 4
type: Question
has comment: http://stackoverflow.com/comment/39951645
linked to: http://stackoverflow.com/q/1192534
has answer: http://stackoverflow.com/a/25579751
has comment: http://stackoverflow.com/comment/39951807
has answer: http://stackoverflow.com/a/25579695
type: UnansweredQuestion
tagged with: arrays
tagged with: variables
has comment: http://stackoverflow.com/comment/39951775
has comment: http://stackoverflow.com/comment/39951755
has answer: http://stackoverflow.com/a/25579735
score: 0
has title: Creating chronological variable names automatically
has body: I am writing a program that will take input of polynomials. Needing to create a new ArrayList for each polynomial input, I am needing a way to name each list without knowing the amount of polynomial beforehand. If a file has 2 polynomials I will need to name 2 arrays, but if more polynomials I will need to name more arrays. Is there anyway to automatically name arrays or variables with the iteration of a loop. I cannot figure out how. Variable names such as : P1 , P2, P3 etc. as the number of Polynomials increases is what I am searching for. Each polynomial will be read in line by line. I have attached my code, Though it is nowhere near complete. I imagine I will need to move the PolyCalc creation into the while loop and create a new PolyCalc for each line of input. I am looking to add this feature to the while loop in the main method. import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class PolyProcessor { static int polyNum = 0; public static void main(String[] args) throws FileNotFoundException{ File polyfile = new File("polyinput.txt"); Scanner read = new Scanner(polyfile); while (read.hasNextLine()){ PolyCalc c = new PolyCalc(); String j = read.nextLine(); c.add(j.split(";")); polyNum++;} } } class PolyCalc{ static int polyCount = 0; static ArrayList polynomials = new ArrayList(); static void add(String[] strings){ for(int i = 0; i&lt;strings.length;i++){ polynomials.add(strings[i]); polyCount++;} } static Object get(int i){ return polynomials.get(i); } }
tagged with: java

http://stackoverflow.com/q/25701642
has answer: http://stackoverflow.com/a/25701697
type: AnsweredQuestion
tagged with: linked-list
answer count: 3
accepted answer: http://stackoverflow.com/a/25701722
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25701722
has title: Create an Linked List array of linked lists with a loop java
downvote count: 0
tagged with: loops
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25701698
has body: I have successfully implemented Radix sort but I have the following code that I would like to convert to be created by a loop. private static LinkedList[] bucket = { new LinkedList(), // -9 new LinkedList(), // -8 new LinkedList(), // -7 new LinkedList(), // -6 new LinkedList(), // -5 new LinkedList(), // -4 new LinkedList(), // -3 new LinkedList(), // -2 new LinkedList(), // -1 new LinkedList(), // 0 new LinkedList(), // 1 new LinkedList(), // 2 new LinkedList(), // 3 new LinkedList(), // 4 new LinkedList(), // 5 new LinkedList(), // 6 new LinkedList(), // 7 new LinkedList(), // 8 new LinkedList() // 9 }; However I cannot figure out how I might go about doing this. I tried this but I get compiler errors. private static LinkedList[] bucket; int thing = 19; while(thing != 0){ bucket = new LinkedList(); thing--; } This is not critical to the functionality of my radix sort as it works flawlessly, I just think it would be cleaner to initialize my buckets with a loop. That said if someone could enlighten me on how to do this I would be very grateful.
upvote count: 1
possible better answer: http://stackoverflow.com/a/25701697
has comment: http://stackoverflow.com/comment/40173461

http://stackoverflow.com/a/25610430
score: 0
answers question: http://stackoverflow.com/q/25609732
has body: It's a little unclear what you're looking for, but if I am guessing correctly, something like the below might run in average O(n) time: Map&lt;MyElement, Integer&gt; nOcurrences = new HashMap&lt;MyElement, Integer&gt;(); for(ElementType element : myList) { if(nOccurrences.contains(element) { nOcurrences.put(element, nOcurrences.get(element) + 1); } else { nOcurrences.put(element, 1); } } for(ElementType element : nOcurrences.keySet()) { System.out.format("%s occurs %d times.%n", element, nOcurrences.get(element)); } For obvious reasons you'll have to override equals() and hashCode() accordingly.
type: Answer

http://stackoverflow.com/comment/40029997
type: QuestionComment
comment on: http://stackoverflow.com/q/25622793
type: Comment
score: 0
has text: This question must have been asked a thousand times here. Possible [duplicate](http://stackoverflow.com/q/5192574/697630).

http://stackoverflow.com/q/25707234
has answer: http://stackoverflow.com/a/25707243
tagged with: java
tagged with: regex
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/25707348
has comment: http://stackoverflow.com/comment/40314721
possible better answer: http://stackoverflow.com/a/25707348
has body: I want to remove "ing" from word, example i want "watching" become "watch" by removing "ing" from the end of the word. Using regex in java. i use this pattern: String pattern = "$ing"; and use it to remove: String word = "watching"; word = word.replaceAll(pattern,""); but the result is still "watching" not "watch"
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25707243
answer count: 2
downvote count: 0
favorite count: 0
has title: how to remove ing from the end of word using regex in java
type: Question

http://stackoverflow.com/a/25624597
downvote count: 4
has comment: http://stackoverflow.com/comment/40051322
has comment: http://stackoverflow.com/comment/40053223
upvote count: 1
has comment: http://stackoverflow.com/comment/40053165
answers question: http://stackoverflow.com/q/25624317
has comment: http://stackoverflow.com/comment/40063550
has body: If you instanciate new FileNotFoundException() you call the constuctor of the Class FileNotFoundException. In this constructor a IOException can theroretically be thrown by calling the native method fillInStackTrace - the compiler may not know whats the content of the Constructor, maybe a IOException will be thrown. See this article: https://community.oracle.com/thread/1445008?start=0 in example. If the compiler looks into the constructor FileNotFoundException() for every occourcence: its a overhead java neglect for performance.
score: -3
has comment: http://stackoverflow.com/comment/40033907
type: Answer
has comment: http://stackoverflow.com/comment/40053701
has comment: http://stackoverflow.com/comment/40053798
has comment: http://stackoverflow.com/comment/40034485
has comment: http://stackoverflow.com/comment/40042037

http://stackoverflow.com/comment/39996813
score: 1
comment on: http://stackoverflow.com/a/25589139
type: Comment
type: AnswerComment
has text: @ user23123412 'I'll try and let you know. Thanks for your time.'

http://stackoverflow.com/comment/40017174
type: Comment
has text: @PMF I'm going to hand over an ArrayList<String> to an adapter in Android, so I think I needed to do this conversion ahead or override things in the adapter.
score: 0
comment on: http://stackoverflow.com/q/25611965
type: QuestionComment

http://stackoverflow.com/comment/40161371
has text: @tobias_k Can you explain how I'm overwriting str? Shouldn't it be going str + str + ... etc? Each str holding the String that was assigned during that iteration then concatenating . Setting str to "No" by default did help btw.
score: 0
comment on: http://stackoverflow.com/q/25694669
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39957654
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25582262
has text: How are you packaging your applications? Are you using some build tool?

http://stackoverflow.com/comment/40006985
type: AnswerComment
score: 0
has text: Sorry I didn't mean to be rude to u, I just got confused with the editing the comment. Apparently I gave the wrong impression :(
comment on: http://stackoverflow.com/a/25608863
type: Comment

http://stackoverflow.com/comment/40017681
comment on: http://stackoverflow.com/q/25615895
score: 0
type: Comment
has text: Please edit that into your question. The stack trace mentions `PublisherLookupItem`. What is that?
type: QuestionComment

aes
tag name: aes
tags question: http://stackoverflow.com/q/25571431
tags question: http://stackoverflow.com/q/25590953
type: Tag
tags question: http://stackoverflow.com/q/25587090
tags question: http://stackoverflow.com/q/25682037

http://stackoverflow.com/a/25587355
downvote count: 0
answers question: http://stackoverflow.com/q/25587208
upvote count: 1
score: 1
type: AcceptedAnswer
has body: I think the problem is, that immediately after you have started the swingworker by calling the worker.execute() method you check if stopped == true. As the execute() method is non blocking the if-statement gets evaluated just after the call to execute(). At this time, the value of stopped can only be true, thus your worker won't get canceled. One solution would be, to make your worker an instance member and do it more like this: private SwingWorker worker; // ... stopButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (worker != null &amp;&amp; !worker.isCanceled()) { worker.cancel(true); } } }); Additionally if you have members that are accessed and changed from different threads you should synchronize that access.
type: Answer
accepted answer of: http://stackoverflow.com/q/25587208

http://stackoverflow.com/a/25553146
type: Answer
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39901686
answers question: http://stackoverflow.com/q/25552980
has comment: http://stackoverflow.com/comment/39901901
has body: It seems you're using the substring function as (start index, length), which is unfortunately not how it works in Java's string class. From the documentation, the two arguments to the substring function are the start index (inclusive) and the end index (exclusive). So if you want a length 1 substring starting at a: index.substring(a, a+1); Specifically, your current code is probably throwing an IndexOutOfBoundsException because sometimes the beginIndex (a) is larger than endIndex (1).

http://stackoverflow.com/comment/39978049
type: Comment
score: 0
type: QuestionComment
has text: Is the problem that getSubject() always returns the same subject? Please show the line that initializes rand.
comment on: http://stackoverflow.com/q/25592312

http://stackoverflow.com/q/25635699
has comment: http://stackoverflow.com/comment/40059393
answer count: 0
has comment: http://stackoverflow.com/comment/40056444
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/40055420
has title: Glassfish 4 do not load js files
tagged with: glassfish
score: 3
has body: I have moved recently from glassfish 3.1, jsf 2.0, primefaces 3.5, java 6 to glassfish 4, jsf 2.2, primefaces 5, java 8 Javascript files(Primefaces javascript files usually) not being loaded often, but sometimes it being loaded and everything works fine. It gives the following exception [2014-09-03T08:49:30.421+0400] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=23 _ThreadName=Thread-3] [timeMillis: 1409719770421] [levelValue: 800] entered to constructor [2014-09-03T08:49:30.437+0400] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=23 _ThreadName=Thread-3] [timeMillis: 1409719770437] [levelValue: 800] done constructor [2014-09-03T08:49:30.578+0400] [glassfish 4.0] [WARNING] [] [javax.enterprise.web.core] [tid: _ThreadID=21 _ThreadName=http-listener-1(3)] [timeMillis: 1409719770578] [levelValue: 900] [[ Error invoking requestInitialized method on ServletRequestListener org.jboss.weld.servlet.WeldListener java.lang.IllegalStateException: isHexDigit at org.glassfish.grizzly.http.util.URLDecoder.decode(URLDecoder.java:470) at org.glassfish.grizzly.http.util.Parameters.processParameters(Parameters.java:652) at org.glassfish.grizzly.http.util.Parameters.processParameters(Parameters.java:687) at org.glassfish.grizzly.http.util.Parameters.handleQueryParameters(Parameters.java:335) at org.glassfish.grizzly.http.server.Request.parseRequestParameters(Request.java:1995) at org.glassfish.grizzly.http.server.Request.getParameter(Request.java:1052) at org.apache.catalina.connector.Request.getParameter(Request.java:1547) at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:448) at org.jboss.weld.servlet.ConversationContextActivator.getConversationId(ConversationContextActivator.java:115) at org.jboss.weld.servlet.ConversationContextActivator.activateConversationContext(ConversationContextActivator.java:82) at org.jboss.weld.servlet.WeldListener.requestInitialized(WeldListener.java:201) at org.apache.catalina.core.StandardContext.fireRequestInitialize…
has comment: http://stackoverflow.com/comment/40055737
tagged with: jsf
tagged with: primefaces
upvote count: 3
tagged with: java
tagged with: jboss
linked to: http://stackoverflow.com/q/24981151
favorite count: 0
type: Question

http://stackoverflow.com/q/25654945
type: Question
has body: I've got a strange Shiro problem I'm trying to track down where sometimes (race condition, likely) a session ends up containing the Authentication setting as true, but doesn't have a principal. Here is what seems to be happening: User accesses our system with a URL. The URL contains a magic path that authenticates them and logs them in. The Subject now is Authenticated and has a Principal. The requested web page is sent to them. The web page includes other pages (JavaScript, CSS, etc.). The second request sometimes fails (accessing JavaScript) because the Subject is now Authenticated, but doesn't have a Principal, so we can't Authorize them. Here is the code that performs the login (step 2): if(!subject.isAuthenticated()) { // Log the user in LegacyAuthenticationToken token = new LegacyAuthenticationToken(site, facility, authUrl); subject.login(token); } The LegacyJDBCRealm extends AuthenticatingRealm and overrides doGetAutheticationInfo to return a SimpleAuthenticationInfo object which has the principal in it: return new SimpleAuthenticationInfo(userKey.toString(), authUrl, getName()); userKey.toString() is the principal. AuthUrl is the URL provide that authenticates the user and getName() is the name of the Realm. I do have two different Realms in play - legacy and non-legacy. Could that be causing a problem? With various break points, I can tell that the first subject is generated correctly and seems to be saved to the session correctly. The second subject is generated incorrectly because the session (same session ID, I checked) does not have a Principal (even though it does have an Authenticated value of true). I've not had any luck figuring out what code is removing the Principal from the session, so I'm hoping for some pointers or debugging ideas. Setting a break point SessionDAO.upgdate(Session) has not proven helpful.
has comment: http://stackoverflow.com/comment/40096309
has answer: http://stackoverflow.com/a/26041794
has title: Shiro Subject Authenticated but missing Principal
has comment: http://stackoverflow.com/comment/40115009
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/26041794
tagged with: java
has comment: http://stackoverflow.com/comment/40097530
answer count: 1
tagged with: shiro

http://stackoverflow.com/comment/40173142
score: 0
type: QuestionComment
has text: Can you please unzip the war file and check if this class was packaged by maven as a part of war?
type: Comment
comment on: http://stackoverflow.com/q/25701285

http://stackoverflow.com/comment/39929949
type: QuestionComment
has text: what exception please post may be internet permission not added
comment on: http://stackoverflow.com/q/25568402
score: 0
type: Comment

http://stackoverflow.com/comment/39996318
type: QuestionComment
has text: I cannot find read method of ImageIO, which accepts String as argument.
comment on: http://stackoverflow.com/q/25604094
score: 1
type: Comment

http://stackoverflow.com/comment/40063761
has text: have you checked the json is Valid. please post what jsobobj contains. i cant help u without the details
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25637701
type: Comment

http://stackoverflow.com/a/25589069
has body: Why do you need that absolutePath thing if you have the mapping of the url of the servlet you want to redirect in the web.xml or as annotation this simple lines shall do the work RequestDispatcher requestDispatcher=servletContext.getRequestDispatcher("/Home"); requestDispatcher.forward(request, response); Or this response.sendRedirect("/Home");
has comment: http://stackoverflow.com/comment/39969062
has comment: http://stackoverflow.com/comment/39969076
has comment: http://stackoverflow.com/comment/39970673
has comment: http://stackoverflow.com/comment/39969272
type: Answer
answers question: http://stackoverflow.com/q/25588917
score: 0
has comment: http://stackoverflow.com/comment/39969335

http://stackoverflow.com/q/25601973
favorite count: 0
type: Question
tagged with: broadcastreceiver
tagged with: android
score: 6
has title: How to start an IntentService from a WakefulBroadcastReceiver
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25601998
has comment: http://stackoverflow.com/comment/49164447
has body: I have an application, which you should be able to recreate entirely and very easily with the code I'll post in this question. Here's the Manifest file: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="21" /> <uses-permission android:name="android.permission.WAKE_LOCK"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.example.broadcasttest.MonitorService" /> As you can see, the contains an activity, a (wakeful) broadcast receiver and an intentservice, all in the same package. The activity gets started at launch, here's the code: package com.example.broadcasttest; import android.app.Activity; import android.content.Intent; import android.os.Bundle; 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); sendBroadcast(new Intent(this, TestReceiver.class)); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } This succesfully triggers the onReceive function of TestReceiver. package com.example.broadcasttest; import android.content.Context; import android.content.Intent; import android.support.v4.content.WakefulBroadcastReceiver; public class TestReceiver extends WakefulBroadcastReceiver { @Override public void onReceive(Context context, Intent inte…
has answer: http://stackoverflow.com/a/25601998
tagged with: android-intentservice
linked to: http://stackoverflow.com/q/20937679
tagged with: java
answer count: 1
upvote count: 7
downvote count: 1

http://stackoverflow.com/comment/40137946
score: 1
type: Comment
type: QuestionComment
has text: We're in software engineering country here. You have to lay down specifications. What is a word? In the sentence "I have 5 eggs; who want's to have 'm?" - what is the third word? '5' or 'eggs' ? And what is the last word? "'m" or "m" ? (note the quote) Is that even a word at all?
comment on: http://stackoverflow.com/q/25682189

http://stackoverflow.com/comment/40067351
has text: Use image processing using interpolation techniques with matrix, will resolve your problem, just get the bitmap from the image and process it using some interpolation algos to get the result.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25582226
score: 0

http://stackoverflow.com/comment/39927058
type: AnswerComment
score: 1
has text: your scrollbar is not appearing at all because `this.add(textArea, BorderLayout.SOUTH);` should be `this.add(scrollpane, BorderLayout.SOUTH);` there is also typo `textArea.setLineWrap(truea);` should be `textArea.setLineWrap(true);`. And for the JOptionPane, you should can solve it by yourself. Btw don't edit your question based on answer (my answer) !!! so we could see clearly what you problem are.
type: Comment
comment on: http://stackoverflow.com/a/25565468

http://stackoverflow.com/q/25638639
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25638836
favorite count: 0
type: Question
type: UnansweredQuestion
has body: I need to separate fractional part from BigDecimal and convert to Integer. Eg: 1.05(BigDecimal) =&gt; 5(int) 1.30(BigDecimal) =&gt; 30(int) Note: Decimal part won't exceed 2 digits
tagged with: bigdecimal
has answer: http://stackoverflow.com/a/25638908
has answer: http://stackoverflow.com/a/25638765
has title: Separate BigDecimal Fraction Part
answer count: 3
score: 1
tagged with: java

http://stackoverflow.com/comment/40254940
type: Comment
has text: @leonardo, have a read of the link in the last message. I give up now :( good luck with it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25686662

http://stackoverflow.com/comment/40147543
comment on: http://stackoverflow.com/q/25687407
has text: I'm not sure if I understand. I edited my question to make it more clear what I was expecting, but thank you anyway
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25554033
answers question: http://stackoverflow.com/q/25553981
downvote count: 0
score: 2
type: Answer
has comment: http://stackoverflow.com/comment/39903226
has body: You could just read the entire file into a String and then use String.split(String regex)
upvote count: 2

http://stackoverflow.com/a/25688969
answers question: http://stackoverflow.com/q/25687833
downvote count: 0
has body: Whilst the other answers will work fine for your needs, you should never use public static on a mutable (changeable) field - this means that anyone can change the field anywhere in your application and cause unknown behaviour. Primitives (int double float) won't change if you add final modifier, but an Object like an array can have it's contents modified - only the object reference itself will be constant. As a result - the array is mutable, so you shouldn't use public static on it. It appears that your String[][] is almost meant to represent a table, with the first element in the String[][] being a header, and each other row being a new row in this table. As a result of this, we can turn your String[][] into something more idiomatic. We can make each row of your String[][] be represented by an instance of a class. There are a few benefits of this, but namely it means that you can look at it and say "this is X", rather than "this is an array of strings". public class Account { private final String name; private final String a, b, c, d, e; public Account(String name, String a, String b, String c, String d, String e) { this.a = a; this.b = b; this.c = c; this.d = d; this.e = e; this.name = name; } public string getName() { return this.name; } public string getA() { return this.a; } public string getB() { return this.b; } public string getC() { return this.c; } public string getD() { return this.d; } public string getE() { return this.e; } } This encapsulates those fields inside of an object. This is great because it means that first of all, you have control over where your fields are assigned and where they can be changed as well. Now, we can turn your String[][] into an Account[]. As mentioned above, sharing an array directly is bad practise. How do we get around this? Well, we can create another class that controls the lifetime of these accounts. Since it is a data store, let's call it a repository (NB: This is known as the repository pattern). public class AccountR…
type: Answer
accepted answer of: http://stackoverflow.com/q/25687833
score: 5
upvote count: 5
type: AcceptedAnswer

http://stackoverflow.com/q/25565171
has comment: http://stackoverflow.com/comment/39924038
has comment: http://stackoverflow.com/comment/39924266
favorite count: 0
has comment: http://stackoverflow.com/comment/39923864
type: Question
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39924155
has answer: http://stackoverflow.com/a/25565412
tagged with: java
has comment: http://stackoverflow.com/comment/39924301
accepted answer: http://stackoverflow.com/a/25565412
has body: I want to convert my char array to multiple string array's indexes. Like, char[] c = {'a','n','i','k','s','m','r','j'}; I want it to be in a string and in a format like "anik", "sm" , "rj" suppose I have a text file, and it is formatted like "anik" then in a new line "sm" and so on. I am reading it character by character and storing it in a char array, then want to convert it in the string of my question's format help me with this. Thanks
has comment: http://stackoverflow.com/comment/39924151
has comment: http://stackoverflow.com/comment/39923964
tagged with: arrays
answer count: 1
has title: how to convert char array to multiple string indexes in java
upvote count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/39923944
downvote count: 1

http://stackoverflow.com/comment/40098097
type: AnswerComment
comment on: http://stackoverflow.com/a/25658128
score: 0
has text: i think this would be your best bet, you could just modify your POJO(ArrayClass) or else you would do the if-else in for loop to check every index of the array
type: Comment

http://stackoverflow.com/a/25591650
has comment: http://stackoverflow.com/comment/39973992
score: 0
has body: This may help you adapt your code. import java.util.regex.* ; public class Find_Dogs_And_Gods { public static void main(String []args) { String line = "2ldoghmDoggod" ; Pattern p = Pattern.compile("[d,D,g,G][o,O][d,D,g,G]") ; Matcher m = p.matcher(line) ; while(m.find() ) { System.out.println( m.group() ) ; } } }
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/25591464
type: Answer

http://stackoverflow.com/q/25677974
has answer: http://stackoverflow.com/a/25678201
possible better answer: http://stackoverflow.com/a/25678201
tagged with: servlets
type: AnsweredQuestion
answer count: 2
tagged with: url-mapping
tagged with: java
downvote count: 0
tagged with: jsp
has body: I have a servlet called User.java. It is mapped to the url pattern User /user/* Inside the Servlet, the path following the slash in user/ is analyzed, data about that user is retrieved from the database, set in attributes, and then the page user_home.jsp is to be displayed. The code to make this happen is: User user = UserManager.getUserInfoById(userPath); request.getSession().setAttribute("user", user); request.getRequestDispatcher("resources/jsp/user_home.jsp").forward(request, response); The problem is, that rather than opening this user_home.jsp, the request is mapped once again to the same servlet User.java. It does nothing. I've put output statements at the beginning of the doGet method, so I can see that the URL is http://localhost:8080/myproj/user/resources/jsp/user_home.jsp so it seems the obvious problem is that it's mapping right back to the user/* pattern. How do I get the Servlet to display this page without going through URL mapping, and properly display the jsp I need it to?
has comment: http://stackoverflow.com/comment/40130262
accepted answer: http://stackoverflow.com/a/25678465
favorite count: 0
type: Question
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/25678465
has title: RequestDispatcher forwarding is getting rerouted back to the same Servlet

http://stackoverflow.com/a/25683826
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25667809
has comment: http://stackoverflow.com/comment/51618290
has body: Vaadin states (see https://vaadin.com/book/vaadin7/-/page/layout.accordion.html): You can use an Accordion identically to a TabSheet. If you have a look at the TabSheet documentation you'll find something like this: tabsheet.removeTab(tab); And this: tabsheet.addTab(myTab).setCaption("My Tab"); So you may refresh the title, close the tab or just change the component inside by using the replaceComponent() method.

http://stackoverflow.com/comment/39901549
has text: I would do a search for "implements Parcelable" and look through those classes. Make sure that you are reading from the Parcel in the same order in which you write to the Parcel.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25552874

http://stackoverflow.com/a/25738517
type: Answer
score: 11
has body: I solved my problem using the annotation @AssistedInject. Quote from the javadoc: When used in tandem with FactoryModuleBuilder, constructors annotated with @AssistedInject indicate that multiple constructors can be injected, each with different parameters. So i add the annotation and a constructor to the SimpleData class: public class SimpleData implements Data { @AssistedInject public SimpleData(@Assisted Path path) { } @AssistedInject public SimpleData() { } } i removed the @Nullable annotation from the factory: import java.nio.file.Path; public interface Factory { Data create(); Data load(Path path); }
upvote count: 11
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25642021
downvote count: 0
answers question: http://stackoverflow.com/q/25642021

http://stackoverflow.com/comment/40334188
comment on: http://stackoverflow.com/q/25685973
type: QuestionComment
type: Comment
has text: I'm trying to reconstruct the image, saying that black pixels are missing part, so replacing them with neighbours color. My desired output image should be completely red. I've managed to do it in processing using a similar algorithm but in Java it does not work
score: 0

http://stackoverflow.com/comment/40007060
comment on: http://stackoverflow.com/q/25610043
type: Comment
type: QuestionComment
has text: You mean that I should nest two synchronized? But it is not efficient!
score: 0

http://stackoverflow.com/comment/40165641
comment on: http://stackoverflow.com/a/25696987
has text: @J.Lucky you right but name isn't really an instance variable. in this case program get the name once but it may change to get name in every loop iteration...
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40074148
has text: The famous and so ugly empty "for(;;)" and the "break" that reminds us of Basic.
type: Comment
comment on: http://stackoverflow.com/a/25647022
type: AnswerComment
score: 0

http://stackoverflow.com/q/25703762
tagged with: chat
answer count: 2
has comment: http://stackoverflow.com/comment/40177784
tagged with: java
has answer: http://stackoverflow.com/a/25704106
has comment: http://stackoverflow.com/comment/40177515
downvote count: 1
has comment: http://stackoverflow.com/comment/40177689
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40177591
upvote count: 0
type: UnansweredQuestion
has body: So I am trying to make a simple chat client but somehow the connection doesn't work. Can you help me? This is what i wrote: import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.util.*; public class game implements ActionListener{ JTextArea incoming; JTextField outgoing; BufferedReader reader; PrintWriter writer; Socket sock; public static void main(String [] args){ game g = new game(); g.go(); }public void go(){ JFrame frame = new JFrame("Chat"); JButton sendB = new JButton("Send"); JPanel mainPanel = new JPanel(); incoming = new JTextArea(15,50); incoming.setLineWrap(true); incoming.setWrapStyleWord(true); incoming.setEditable(false); JScrollPane s = new JScrollPane(incoming); s.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); s.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); outgoing = new JTextField(25); sendB.addActionListener(this); mainPanel.add(s); mainPanel.add(outgoing); mainPanel.add(sendB); setUpnetworking(); Thread readerThread = new Thread( new IncomingReader()); readerThread.start(); frame.getContentPane().add(BorderLayout.CENTER, mainPanel); frame.setVisible(true); frame.setSize(800,500); frame.setResizable(false); }public void actionPerformed(ActionEvent e){ try{ writer.println(outgoing.getText()); writer.flush(); }catch(Exception ex){ ex.printStackTrace(); } outgoing.setText(""); outgoing.requestFocus(); }public void setUpnetworking(){ try { sock = new Socket("127.0.0.1", 5000 ); InputStreamReader streamreader = new InputStreamReader(sock.getInputStream()); reader = new BufferedReader(streamreader); writer = new PrintWriter(sock.getOutputStream()); System.out.println("Connection Established"); } catch (IOException exx) { exx.printStackTrace(); } }public class IncomingReader implements Runnable{ public void run(){ String message; try{ while ((message = reader.readLine()) != null){ System.out.println("read" + message); incoming.append(…
score: -1
has title: Chat connection doesn't work
has answer: http://stackoverflow.com/a/54791226

http://stackoverflow.com/comment/40039954
score: 0
comment on: http://stackoverflow.com/q/25627941
has text: Right click on the project and select 'Restore from Local History...' to if Eclipse has a backup.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25571051
type: Question
has body: I have a BufferedWriter as shown below: BufferedWriter writer = new BufferedWriter(new OutputStreamWriter( new GZIPOutputStream( hdfs.create(filepath, true )))); String line = "text"; writer.write(line); I want to find out the bytes written to the file with out querying file like hdfs = FileSystem.get( new URI( "hdfs://localhost:8020" ), configuration ); filepath = new Path("path"); hdfs.getFileStatus(filepath).getLen(); as it will add overhead and I don't want that. Also I cant do this: line.getBytes().length; As it give size before compression.
has title: Count the bytes written to file via BufferedWriter formed by GZIPOutputStream
score: 2
has comment: http://stackoverflow.com/comment/39935468
type: AnsweredQuestion
upvote count: 3
tagged with: bufferedwriter
tagged with: java
downvote count: 1
tagged with: outputstream
has answer: http://stackoverflow.com/a/46109187
answer count: 4
has answer: http://stackoverflow.com/a/58567307
has answer: http://stackoverflow.com/a/25571341
accepted answer: http://stackoverflow.com/a/25571341
possible better answer: http://stackoverflow.com/a/46109187
tagged with: gzipoutputstream
has answer: http://stackoverflow.com/a/25571099
favorite count: 0

http://stackoverflow.com/q/25599739
downvote count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: java
score: -1
tagged with: regex
tagged with: whois
type: Question
has title: regex extraction of data
has comment: http://stackoverflow.com/comment/39988360
upvote count: 0
accepted answer: http://stackoverflow.com/a/25599908
answer count: 1
has answer: http://stackoverflow.com/a/25599908
has body: I have a hundred Whois files of different top level domains(.com, .se, .uk, .cz etc.). Each has a different format. My main task is to extract information such as registrar, registrant, expiry date, updated date etc. The below code works for com. net. org &amp; info. I am using Java SE 6. Admin contact: "\\bAdmin\\sEmail:\\s*\\w+\\-*\\w*\\.*\\w*@\\w+(\\.\\w+)+" Technical contact: "\\bTech\\sEmail:\\s*\\w+\\-*\\w*\\.*\\w*@\\w+(\\.\\w+)+" Whois Registrant: "\\bRegistrant\\sName:\\s*\\w+\\-*\\.*\\w+\\s*\\w*" Registrar: "\\bRegistrar:\\w+\\.*\\w*" Registered on Date: "\\bCreation\\sDate:\\s*\\d+-\\d+-\\d+T\\d+:\\d+:\\d+Z" Expiry Date: "\\bExpiry\\sDate:\\s*\\d+-\\d+-\\d+T\\d+:\\d+:\\d+Z" Updated Date: "\\bUpdated\\sDate:\\s*\\d+-\\d+-\\d+T\\d+:\\d+:\\d+Z" Name Servers: "\\bName\\sServer:\\s*\\w+\\d*\\.*\\w*\\-*\\w*(\\.\\w+)+" Registrant Status: "\\bDomain\\sStatus:\\s*\\w+" How do I add alternatives for each of the above points for other TLDs. For example : I would like to have Name Servers: "\\bName\\sServer:\\s*\\w+\\d*\\.*\\w*\\-*\\w*(\\.\\w+)+" OR alternative pattern OR alternative Pattern Is it doable? If not is there an alternative way?

http://stackoverflow.com/comment/40121806
has text: @KumarAbhinav `start` internally calls `run()`. When `run()` completes, `start` (presumably) calls `notifyAll()`.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25672797

http://stackoverflow.com/a/25675997
answers question: http://stackoverflow.com/q/25675577
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40153392
type: Answer
has body: Here is a CookieCounter singleton class for you. Use CookieCounter.getInstance().increaseCount(int amount) to increase the count by amount. Use CookieCounter.getInstance().getCount() to get the current count. public class CookieCounter { private static CookieCounter instance; int count = 0; public static CookieCounter getInstance() { if(instance == null) { instance = new CookieCounter(); } return instance; } public void increaseCount(int amount) { count += amount; } public int getCount() { return count; } }
accepted answer of: http://stackoverflow.com/q/25675577
score: 0
has comment: http://stackoverflow.com/comment/40153634

http://stackoverflow.com/comment/39970577
has text: Can you please post the example of it?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25590112
type: Comment

http://stackoverflow.com/q/25699428
has title: How to resolve the Exception org.hibernate.SessionException: Session was already closed
has comment: http://stackoverflow.com/comment/40169753
has comment: http://stackoverflow.com/comment/40170038
type: Question
has answer: http://stackoverflow.com/a/39786801
answer count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40169942
downvote count: 0
has answer: http://stackoverflow.com/a/25699706
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40169814
score: 1
has body: I am new to Hibernate and I was doing some programming myself until I encountered this problem. I am trying to add a object into the database and then retrieve that object from the database. I have tried looking online for help but haven't been able to resolve this error. Any help would be appreciated. The stack trace I get: Exception in thread "main" org.hibernate.SessionException: Session was already closed at org.hibernate.internal.SessionImpl.close(SessionImpl.java:359) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:356) at com.sun.proxy.$Proxy6.close(Unknown Source) at com.project.hibernate.HibernateTest.main(HibernateTest.java:39) This is the code I have written so far: HiberateTest.java public class HibernateTest { public static void main(String[] args) { Logger log = LoggerFactory.getLogger(HibernateTest.class); UserDetails user = new UserDetails(); log.debug("Testing"); user.setUserId(1); user.setUserName("First User"); user.setAddress("First user's address"); user.setJoinedDate(new Date()); user.setDescription("user description"); Configuration configuration = new Configuration(); configuration.configure("com/project/hibernate/hibernate.cfg.xml"); ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings( configuration.getProperties()).build(); SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry); Session session = sessionFactory.getCurrentSession(); //add object session.beginTransaction(); session.save(user); session.getTransaction().commit(); session.close(); //retrieve object that was added session = sessionFactory.openSession(); user = null; session.beginTransaction(); user = (U…
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/49299325
comment on: http://stackoverflow.com/a/29179722
has text: But there is a problem which every time it will create a new file in the temp folder, if you run the program for many times, the C drive will become full day by day. 1Mb for 3 run
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25706224
has comment: http://stackoverflow.com/comment/40182271
has title: I keep getting this "HTTP Status 405 - HTTP method POST is not supported by this URL"
tagged with: post
type: Question
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11222695
has comment: http://stackoverflow.com/comment/40182383
tagged with: http
has body: I keep getting this error when I am using Netbeans and the internet. "HTTP Status 405 - HTTP method POST is not supported by this URL" I don't know just what is going on here, and I will be happy if someone here could help me out. Here is what I got down. It goes like this. package servlets; import business.*; import business.User; import data.*; import data.UserIO; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import static javax.ws.rs.client.Entity.html; /** * FFilename: AddDisplayInput.java Date: August September 23, 2014 Author Russell Lindsey */ public class AddDisplayInput extends HttpServlet { /** * Processes requests for both HTTP POST</code * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOExceptin if an I/O errr occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // the next 7 lines are the same as in the display_email_entry.jsp file String firstName = request.getParameter("firstName"); String lastName = request.getParameter("lastName"); String emailAddress = request.getParameter("emailAddress"); User user = new User(firstName, lastName, emailAddress); ServletContext sc = this.getServletContext(); String path =sc.getRealPath("/Web-INF/EmailList.txt"); UserIO.add(user, path); response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use the following sample code. */ out.println(" \n"); out.println(" \n"); out.println(" \n"); out.println(" Servlet AddDisplayInput \n"); out.println(" "); out.println(" <body\n" + " Thanks for Joining Russell Lindsey's email list \n" + " \n" + " Here is the information you entered \n" + " \n" + " \n" + " First Name: " + user.getFirstName() +" \n" + " \n" + " \n" + " Last Name: " + user.getLastName() +" \n" + " \n" + " \n" + " Email Addres…
score: 0
has comment: http://stackoverflow.com/comment/40182559
has comment: http://stackoverflow.com/comment/40182269
tagged with: java

http://stackoverflow.com/comment/78898554
type: Comment
type: AnswerComment
has text: Edited to clarify. If I lowercase a type name, I get this error ```error code [17060]; Fail to construct descriptor: Unable to resolve type "MYSCHEMA.mytype"; nested exception is java.sql.SQLException: Fail to construct descriptor: Unable to resolve type "MYSCHEMA.mytype```
score: 0
comment on: http://stackoverflow.com/a/45867910

http://stackoverflow.com/q/25584789
answer count: 1
has title: Java sun.uil.ResourceBundleEnumeration cannot be cast to java.lang.String
has body: I am creating a Bukkit plugin, but I have problems loading a .properties file. I am getting "sun.util.ResourceBundleEnumeration cannot be cast to java.lang.String" I am trying to add all keys that arent in 2 .properties files (ENf and LANGf) from another properties file. File tempFile = null; try { tempFile = File.createTempFile("temp_EN", ".properties"); } catch (IOException e) { e.printStackTrace(); } try (FileOutputStream out = new FileOutputStream(tempFile)) { tempFile.deleteOnExit(); copy(r.getUC().getResource("Messages/EN.properties"), out); } catch (IOException e) { e.printStackTrace(); } ResourceBundle tempR = null; try { tempR = new PropertyResourceBundle(new FileInputStream(tempFile)); } catch (IOException e) { e.printStackTrace(); } Enumeration&lt;String&gt; keys = tempR.getKeys(); //EN Properties propsEN = new Properties(); Properties propsCU = new Properties(); try { propsEN.load(new FileInputStream(ENf)); propsCU.load(new FileInputStream(LANGf)); } catch (IOException e) { e.printStackTrace(); } while(keys.hasMoreElements()){ String key = keys.nextElement(); // if(!r.en.containsKey(key)){ propsEN.put(keys, tempR.getString(key)); } if(!r.cu.containsKey(key)){ propsCU.put(keys, tempR.getString(key)); } } try { FileOutputStream ENo = StreamUtil.createOutputStream(ENf); FileOutputStream CUo = StreamUtil.createOutputStream(LANGf); propsEN.store(ENo, ""); propsCU.store(CUo, ""); ENo.close(); CUo.close(); } catch (SecurityException | IOException e) { e.printStackTrace(); } tempFile.delete(); LANGf = Some .properties file ENf = Some .properties file r.getUC().getResource() returns a InputStream of a certain .properties file, where I am trying to copy all missing keys from. copy(File, File) just copies a file. java.lang.ClassCastException: sun.util.ResourceBundleEnumeration cannot be cast to java.lang.String at java.util.Properties.store0(Unknown Source) ~[?:1.7.0_21] at java.util.Properties.store(Unknown Source) ~[?:1.7.0_21] at Bammerbom.UltimateCore.UltimateF…
type: Question
has comment: http://stackoverflow.com/comment/39961001
tagged with: classcastexception
tagged with: java
accepted answer: http://stackoverflow.com/a/25586089
tagged with: properties
has answer: http://stackoverflow.com/a/25586089
type: AnsweredQuestion
score: 0
tagged with: resourcebundle
has comment: http://stackoverflow.com/comment/39962996

http://stackoverflow.com/comment/40168540
score: 0
comment on: http://stackoverflow.com/q/25698753
type: Comment
has text: i dont understand "offset". how are offset and temp related>
type: QuestionComment

http://stackoverflow.com/q/25581878
has comment: http://stackoverflow.com/comment/39955654
has comment: http://stackoverflow.com/comment/39955710
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/63576483
has title: how to refer jars present in other war file in my own webb applications manifest file
type: Question
has answer: http://stackoverflow.com/a/25582262
type: UnansweredQuestion
answer count: 1
has body: My requirement is I have to refer the jars present in other war file in my web application. I am thinking to edit the manifest file of my web application to add the jars of other war file, but I do not know exactly what to add in the manifest file. Could any one please help me on this.

http://stackoverflow.com/comment/40186065
comment on: http://stackoverflow.com/q/25708421
type: QuestionComment
score: 0
has text: On what line are you getting the error?
type: Comment

http://stackoverflow.com/comment/40063538
type: QuestionComment
score: 0
has text: The logs are telling you that the `SHA224` class bytecode verification failed while trying to load it in the VM. If I understand it correctly, it tells you that the bytecode which corresponds to the call to `processChunk()` in the `engineDigest()` method is trying to call the implementation of `processChunk()` in the parent class, which doesn't exist. Why the compiler doesn't see `SHA224#processChunk()` unless it is `protected` I have no idea yet. I tried to copy-paste your code in a dummy gradle project and it worked fine.Are you sure nothing is different in your project?Which SDK do you use?
type: Comment
comment on: http://stackoverflow.com/q/25639449

http://stackoverflow.com/a/25651003
downvote count: 0
answers question: http://stackoverflow.com/q/25646482
score: 2
has comment: http://stackoverflow.com/comment/40097369
has comment: http://stackoverflow.com/comment/40096962
type: Answer
upvote count: 2
has body: First of all, it doesn't matter if the datastructure is a linked list or an array, so I will use array for simplicity. I don't really understand your algorithm, but it seems that you are going to do something like duplicate the array at the back of the original, and run the Kadane's algorithm on this doubled-array. This is a wrong approach, and a counter example has been given by @RanaldLam. To solve it, we need to discuss it in three cases: All negative. In this case, the maximum of the array is the answer, and an O(N) scan will do the job; The maximum sub-array does not require a wrapping, for example a = {-1, 1, 2, -3}. In this case, a normal Kadane's algorithm will do the job, time complexity O(N); The maximum sub-array requires a wrapping, for example a = {1, -10, 1}. Actually, this case implies another fact: since elements inside the maximum sub-array requires a wrapping, then the elements that are not inside the maximum sub-array does not require a wrapping. Therefore, as long as we know the sum of these non-contributing elements, we can calculate the correct sum of contributing elements by subtracting max_non_contributing_sum from total sum of the array. But how to calculate max_non_contributing_sum in case 3? This is a bit tricky: since these non-contributing elements do not require wrapping, so we can simply invert the sign of every elements and run Kadane's algorithm on this inverted array, which requires O(N). Finally, we should compare the sum of non-wrapping (case 2) and wrapping (case 3), the answer should be the bigger one. As a summary, all cases require O(N), thus the total complexity of the algorithm is O(N).

http://stackoverflow.com/q/25578210
has title: Is this piece of Java code thread safe?
answer count: 3
has comment: http://stackoverflow.com/comment/39961438
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39986765
tagged with: thread-safety
downvote count: 0
has answer: http://stackoverflow.com/a/25578248
score: 1
upvote count: 1
linked to: http://stackoverflow.com/q/1386275
has comment: http://stackoverflow.com/comment/39949309
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39949134
has comment: http://stackoverflow.com/comment/39949238
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39949311
has comment: http://stackoverflow.com/comment/39949369
has body: public class TestConcurrentForList { List&lt;Integer&gt; mainList = new ArrayList&lt;Integer&gt;(); ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1); Random r = new Random(); public void start() throws InterruptedException { Runnable cmd = new Runnable() { @Override public void run() { List&lt;Integer&gt; tempList = mainList; mainList = new ArrayList&lt;Integer&gt;(); for (Integer i: tempList) { System.out.println("subThread:" + i); } } }; scheduledExecutorService.scheduleAtFixedRate(cmd, 1, 1, TimeUnit.MILLISECONDS); while (true) { mainList.add(r.nextInt(200)); Thread.sleep(100); } } public static void main(String[] args) { TestConcurrentForList tester = new TestConcurrentForList(); try { tester.start(); } catch (Exception e) { e.printStackTrace(); System.err.println(e.getMessage()); } } } Part of our product code likes this, the main thread and subthread share the mainList. I run the test serval times but never reproduce the ConcurrentModificationException. update： thanks for all your replying，this code is actually a brief abstraction of our production code. What I wanna do actually is very simply: the main thread hold a list to receive data from some source, when the list reaches a certain size the main thread pass the list to a sub thread which stores the data to a data base. Maybe a more safer way to accomplish this is to extract the List&lt;Integer&gt; tempList = mainList; mainList = new ArrayList&lt;Integer&gt;(); to the main thread, and pass the templist to sub thread. The code I list before is a legacy code, and I want to fix this code.
has answer: http://stackoverflow.com/a/25578367
has answer: http://stackoverflow.com/a/25578356

http://stackoverflow.com/comment/40172465
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25700987
has text: You should tell us what pattern is not matched, or better what's the principle of matching or not.
score: 0

http://stackoverflow.com/comment/40109547
score: 0
comment on: http://stackoverflow.com/a/25664287
type: Comment
has text: Maybe I wasn't clear about the fact that the Panel does not overlap the Menuitem, e.g. both the Menu and the Popup are visible at the same time. So when you click on the MenuItem while the Popup is showing, the Popup autocloses (which is triggered by the MOUSEDOWN event), **then** the _menuItem.scheduledCommand_ gets executed (on the MOUSECLICK event after). But at this very moment, the Popup isn't visible, so it get displayed again. I want this to be avoided. In fact, in your code, the `if(window.isShowing()){...}` block will never run.
type: AnswerComment

http://stackoverflow.com/q/25607495
has comment: http://stackoverflow.com/comment/40030671
answer count: 0
has title: Create Dynamic client from WSDL in java
upvote count: 2
type: UnansweredQuestion
tagged with: java
tagged with: wsdl
downvote count: 0
tagged with: web-services
has body: I am new to web-services and trying to create dynamic client in java from WSDL file. I searched on internet but didn’t find any useful information. I have to deploy this on to a cloud based system and can’t use any third party library. What is the whole procedure of that? Any idea or information will be really helpful.
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40019189
tagged with: soap
has comment: http://stackoverflow.com/comment/40002649
score: 2

http://stackoverflow.com/q/25657257
has title: Good practices to bind OSGi services in a 0..n cardinality?
has body: Let's say that I have a bundle that wants to broadcast an information to all its listeners. Considering that I'm using declarative services in which MyComponent is consuming 0..n ComponentListeners, I would have something like this: public class MyComponent { private List&lt;ComponentListener&gt; listeners; private String data; public MyComponent() { listeners = new ArrayList&lt;&gt;(); } // Someone else will call this public void updateData(String newData) { data = newData; notifyAll(data); } // Broadcasts the data to all listeners private void notifyAll(String data) { for (ComponentListener listener : listeners) { listener.updateData(data); } } // Declarative Service binding methods public void bindComponentListener(ComponentListener cl) { listeners.add(cl); } public void unbindComponentListener(ComponentListener cl) { listeners.remove(cl); } } My questions are: Is the 0..n cardinality recommended? The only example that I have found was from an Apache Felix tutorial, which is similar to the one above. Is the observer/observable approach considered a good practice in OSGi? If I want to notify all listeners, I should call listener.updateData(data); in a different thread for each listener, right? This way, I'm ensuring that all listeners will be notified at the same time.
possible better answer: http://stackoverflow.com/a/25657663
type: Question
has answer: http://stackoverflow.com/a/25657663
tagged with: declarative-services
tagged with: osgi
has answer: http://stackoverflow.com/a/25663935
type: AnsweredQuestion
score: 0
answer count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/25663935

http://stackoverflow.com/comment/40234380
comment on: http://stackoverflow.com/q/25671326
type: Comment
has text: What are you trying to accomplish with pooling bigquery connections? Most web containers actually do pooling for keep alive http connections without holding a reference to httpurlconnection
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40195134
score: 0
has text: Awesome! I tried for hours to remember this solution.
comment on: http://stackoverflow.com/a/25712556
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25627246
has body: I'm trying to execute a Java program from a perl script. In the command line I wrote: java -cp C:\\Users\\Ivan\\workspace2\\Algo\\bin gale_shapely.gs1 1000 and it worked just fine. When I try to transport it to my perl script like this: #!/usr/bin/perl use warnings; use strict; system("java -cp C:\\Users\\Ivan\\workspace2\\Algo\\bin gale_shapely.gs1 1000"); I run into the error: 'java' is not recognized as an internal or external command, operable program or batch file I'm fairly certain that I added Java to my PATH variable as well. My PATH variable is: %JAVA_HOME%;C:\Ruby193\bin;%PYTHONDIR%;%PERLDIR%; with JAVA_HOME as: C:\Program Files (x86)\Java\jdk1.8.0_11\bin
tagged with: perl
tagged with: path
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25627320
tagged with: classpath
type: Question
has answer: http://stackoverflow.com/a/25627320
has title: Error when trying to execute a java program from a perl script

http://stackoverflow.com/comment/40000205
comment on: http://stackoverflow.com/a/25576464
score: 0
type: Comment
type: AnswerComment
has text: @EricS.: I can't compare both table simply repairing the file. Because Excel is actually removing this table completely. So it is taking the table as an invalid object. Still I have updated the question with the excel before removing the table.

http://stackoverflow.com/q/25711413
has body: I ma using JSpinner in my java code, in JSpinner the the value of the JSpinner is appearing at the right side of the JSpinner but I want that the value of JSpinner should appears at the left side of JSpinner, so please tell how can I do that???
type: Question
has comment: http://stackoverflow.com/comment/40191560
tagged with: java
has title: how to set position of value of JSpinner
score: 0
has comment: http://stackoverflow.com/comment/40191423
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25711682
answer count: 1
tagged with: swing

http://stackoverflow.com/q/25635696
has comment: http://stackoverflow.com/comment/40054407
score: 0
has comment: http://stackoverflow.com/comment/40054284
has answer: http://stackoverflow.com/a/25636816
tagged with: java
has title: Creating a return type of a recursive method
has answer: http://stackoverflow.com/a/25635901
has comment: http://stackoverflow.com/comment/40054109
answer count: 2
type: UnansweredQuestion
tagged with: jsp
has body: I have the following recursive method that generates permutations for a given string. I am trying to create a return type for the generated strings in an arraylist, more specifically I am trying to printout the out put in a jsp page. public static void permutation(String str) { permutation("", str); } private static void permutation(String prefix, String str) { int n = str.length(); if (n == 0) System.out.println(prefix); else { for (int i = 0; i &lt; n; i++) permutation(prefix + str.charAt(i), str.substring(0, i) + str.substring(i+ n)); } }
type: Question
tagged with: arraylist
tagged with: recursion

http://stackoverflow.com/comment/40096576
has text: Are you trying to sett a variable from native side and make it accessible in js side? Why don't you add a getValue type of method to your plugin? I suppose I didn't understand the question...
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25657749
type: QuestionComment

http://stackoverflow.com/a/25667442
score: 0
has comment: http://stackoverflow.com/comment/40111041
answers question: http://stackoverflow.com/q/25666995
type: Answer
upvote count: 1
downvote count: 1
has body: I use a PoolingHttpClientConnectionManager in a considerably multi-threaded environment and it works very well. Here's an implementation of a Client pool: public class HttpClientPool { // Single-element enum to implement Singleton. private static enum Singleton { // Just one of me so constructor will be called once. Client; // The thread-safe client. private final CloseableHttpClient threadSafeClient; // The pool monitor. private final IdleConnectionMonitor monitor; // The constructor creates it - thus late private Singleton() { PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); // Increase max total connection to 200 cm.setMaxTotal(200); // Increase default max connection per route to 200 cm.setDefaultMaxPerRoute(200); // Make my builder. HttpClientBuilder builder = HttpClients.custom() .setRedirectStrategy(new LaxRedirectStrategy()) .setConnectionManager(cm); // Build the client. threadSafeClient = builder.build(); // Start up an eviction thread. monitor = new IdleConnectionMonitor(cm); // Start up the monitor. Thread monitorThread = new Thread(monitor); monitorThread.setDaemon(true); monitorThread.start(); } public CloseableHttpClient get() { return threadSafeClient; } } public static CloseableHttpClient getClient() { // The thread safe client is held by the singleton. return Singleton.Client.get(); } public static void shutdown() throws InterruptedException, IOException { // Shutdown the monitor. Singleton.Client.monitor.shutdown(); } // Watches for stale connections and evicts them. private static class IdleConnectionMonitor implements Runnable { // The manager to watch. private final PoolingHttpClientConnectionManager cm; // Use a BlockingQueue to stop everything. private final BlockingQueue&lt;Stop&gt; stopSignal = new ArrayBlockingQueue&lt;Stop&gt;(1); IdleConnectionMonitor(PoolingHttpClientConnectionManager cm) { this.cm = cm; } public void run() { try { // Holds the stop request that stopped the process. Stop stopRequest; // …

on-the-fly
type: Tag
tag name: on-the-fly
tags question: http://stackoverflow.com/q/25669197

http://stackoverflow.com/comment/40177946
type: AnswerComment
has text: There is transparent tick under my answer vote. I think if you click that it means you accepted my answer. That's what I saw on other answeres for questions. I'm also knew so that's what I think.
type: Comment
comment on: http://stackoverflow.com/a/25703884
score: 0

http://stackoverflow.com/a/25708807
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40188811
has comment: http://stackoverflow.com/comment/40187790
answers question: http://stackoverflow.com/q/25705278
has comment: http://stackoverflow.com/comment/40188994
score: 1
type: Answer
has body: The statement crs.moveToCurrentRow() have to be added after crs.insertRow() and before crs.acceptChanges(c) For example: // Inserting rows crs.moveToInsertRow(); crs.updateInt("Id", 5); crs.updateString("Name", "E"); crs.insertRow(); crs.moveToCurrentRow(); // NEW STATEMENT crs.acceptChanges(c); // Updating Data Sources For more information visit: http://docs.oracle.com/javase/tutorial/jdbc/basics/cachedrowset.html#inserting-and-deleting-rows
has comment: http://stackoverflow.com/comment/40230424

http://stackoverflow.com/comment/41038564
type: QuestionComment
has text: @Joop Eggen: I added the call for setBaseURL and my ClasspathUriResolver to the question. Thanks for your help.
comment on: http://stackoverflow.com/q/25708992
type: Comment
score: 0

http://stackoverflow.com/a/25712696
accepted answer of: http://stackoverflow.com/q/25712658
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25712658
upvote count: 3
score: 3
type: Answer
has body: A Date does not have a format. It simply represents a specific instant in time, with millisecond precision What you see in your logs is the result of Date#toString(). So either use a SimpleDateFormat to format(Date) your Date object or use the original String value you had.
downvote count: 0

http://stackoverflow.com/q/25580854
has comment: http://stackoverflow.com/comment/39958143
favorite count: 0
type: Question
has title: @Around not getting called in Spring AOP
has comment: http://stackoverflow.com/comment/39954582
type: UnansweredQuestion
tagged with: spring
has body: I am trying to log a method using AOP in Spring. I tried the following code with just System.out.println() but it's not getting called. Created annotation: @Retention(value = RetentionPolicy.RUNTIME) @Target(value = ElementType.METHOD) public @interface Loggable { } Created Aspect @Aspect public class MethodLogger { @Around("execution(* *(..)) &amp;&amp; @annotation(Loggable)") public Object around(ProceedingJoinPoint point) throws Throwable { System.out.println("this is called"); return result; } } Used logging in a method in service layer @Service("RegionService") @Transactional(readOnly = false) public class RegionService implements IRegionService{ @Loggable @Override public List&lt;&gt; fetch() { return dao.xyz(); } } Spring configuration 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 http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd" &gt; &lt;context:component-scan base-package="com.sst.tender.spring"/&gt; &lt;context:annotation-config/&gt; &lt;context:spring-configured/&gt; &lt;/beans&gt;
tagged with: spring-aop
downvote count: 0
upvote count: 1
score: 1
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25585925

http://stackoverflow.com/comment/40007482
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25598719
type: Comment
has text: I see your solution and your suggestion ... The point of my code is to keep flipping the coin till you reach tail and you gain all the money in the pot ... And you have money you keep playing it . therefore the code must be able to run over and over .. So do you have any idea I could change my code in to something like that ...

http://stackoverflow.com/a/25634118
has body: The catch (Exception ...) block will catch runtime exceptions. It's never unreachable in principle. FileNotFoundException is a checked exception. A catch block for it is only reachable if something in the try block throws it, or one of its child classes. [in response to requests]
answers question: http://stackoverflow.com/q/25624317
type: Answer
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/40019786
comment on: http://stackoverflow.com/q/25582746
has text: Generally yes, the truncated entries are usually the same as those of the enclosing exception. See [Throwable.printStackTrace](http://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace--).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25599655
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25599708
has comment: http://stackoverflow.com/comment/39987995
downvote count: 1
has answer: http://stackoverflow.com/a/25599780
tagged with: date
tagged with: memory
has answer: http://stackoverflow.com/a/25599786
favorite count: 0
linked to: http://stackoverflow.com/q/258120
type: Question
has body: How to effectively determine the size of a Date object in my memory? Initially I went through this link which talks about 9 bytes for a date object.. I was trying to find it out when I found this link, where it talks about 32 bytes!!!! for a date object in memory. Date Object Size in Memory Kindly help. Reason for thinking on these lines: I am loading millions of objects of a certain class into memory, for some computation. One of the variables in that class is a Date object. I can store the value as a long, but that would require minor quirks in the code. I am thinking on keeping the memory footprint to the least value possible. To do that, I need to know the exact memory requirements in each case to take a call on the same.
score: 5
has comment: http://stackoverflow.com/comment/39987922
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39988925
upvote count: 6
has title: Java 'Date' object size
linked to: http://stackoverflow.com/q/4681960

http://stackoverflow.com/q/25666851
has comment: http://stackoverflow.com/comment/40110556
type: Question
linked to: http://stackoverflow.com/q/2030434
has answer: http://stackoverflow.com/a/25666991
accepted answer: http://stackoverflow.com/a/25666991
has title: My Eclipse wont run because a JRE environment is needed, and it cant find one
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40110459
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/40109842
has comment: http://stackoverflow.com/comment/40109783
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25666916
answer count: 3
has body: My eclipse has always worked for about a year, until recently i updated my Java, and when i tried using it this error popped: A java runtime Enviorment must be available in order to run eclipse. Also i use intellij and that works perfectly fine. I am using windows 7 64bit java version 7 and latest eclipse.
has answer: http://stackoverflow.com/a/25667000
possible better answer: http://stackoverflow.com/a/25667000

http://stackoverflow.com/comment/40179310
type: QuestionComment
has text: If you did something like that, please delete the question
score: 0
comment on: http://stackoverflow.com/q/25689872
type: Comment

http://stackoverflow.com/a/25634234
has comment: http://stackoverflow.com/comment/50624805
has comment: http://stackoverflow.com/comment/50601058
has comment: http://stackoverflow.com/comment/50635423
has comment: http://stackoverflow.com/comment/40179257
answers question: http://stackoverflow.com/q/25572667
type: Answer
score: 0
has body: Is it possible to check in Servlet that connection is closed by client? Eventually an exception will be thrown: either an IOException: connection reset if you are streaming directly to the socket, or an OutOfMemoryError if the container is streaming to memory, which it does when you aren't using a fixed-length or chunked transfer mode. The loop while(true) in Servlet is infinite even if client browser is closed. No it isn't.

http://stackoverflow.com/comment/40160208
comment on: http://stackoverflow.com/a/25692570
score: 0
has text: I suppose I could change the structure of the database to make it hold the parent class in a table. But wouldn't that require inner join every single time we want to access the create date of any item ever made?
type: Comment
type: AnswerComment

http://stackoverflow.com/a/29022370
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25617490
has body: If you are just trying to make the word row optional, you can surround it with parenthesis and use the question mark to say you want zero or one of the parenthesis contents. I have shown below: (row:)? This will find zero or one of "row:". I would recommend also adding the ?: operator inside the open parenthesis if you are not trying to creating match groups: (?:row:)? Adding the ?: operator tells the program that the parenthesis is not part of a match group, and you are using the parenthesis just to group the letters. So putting this into your regular expression looks like this: .*((?:row:)?([0-9]{1,}))?;.*field:([0-9]{1,});.*name:([0-9]{1,}); If you want this applied to "field:" and "name:", then you would get this: .*((?:row:)?([0-9]{1,}))?;.*(?:field:)?([0-9]{1,});.*(?:name:)?([0-9]{1,}); If you do not want the other parenthesis in your expression to create match groups, I would also change them. Also, to shorten the expression a little and make it cleaner I would change [0-9] to \d which means any digit, and I would replace {1,} with + which means "one or more", and remove the unnecessary parens which results in this: .*(?:(?:row:)?\d+)?;.*(?:field:)?\d+;.*(?:name:)?\d+; I'm not really sure that this is the final expression that you want, since your question was not very descriptive, but I have shown you how to find one or more of "row:" and clean up the expression a little without changing its meaning.
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25692933
tagged with: javabeans
has answer: http://stackoverflow.com/a/25693003
has comment: http://stackoverflow.com/comment/40157864
favorite count: 0
type: Question
tagged with: constructor
score: 3
has body: I was looking to JavaBean advtanges and disadvantages. In the disadvantages section, I came across this: A class with a nullary constructor is subject to being instantiated in an invalid state. Wikipedia - JavaBeans What exactly does this mean? How does this opppse to constructors that have parameter arguments?
has answer: http://stackoverflow.com/a/25693021
possible better answer: http://stackoverflow.com/a/25693021
accepted answer: http://stackoverflow.com/a/25693003
answer count: 4
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/40157777
has comment: http://stackoverflow.com/comment/40157899
has comment: http://stackoverflow.com/comment/40157844
has title: Why are no-arg constructors subject to being instantiated in an invalid state?
has answer: http://stackoverflow.com/a/25694556
tagged with: java
has answer: http://stackoverflow.com/a/44831083
has comment: http://stackoverflow.com/comment/40157825
downvote count: 0

http://stackoverflow.com/comment/40097593
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25648248
has text: I've ended up creating an aggregator with the main project and another aggregator _and_ parent project that will make its children `wsdl2java` to a single jar every `wsdl` in the children's folder. Not exactly what I wanted but works fine (involves writing a dummy `pom.xml` file to specify artifact name and groupId and adding it to the `<modules>` of the parent for each new WS client to add).

http://stackoverflow.com/comment/39997717
score: 0
type: AnswerComment
has text: I know I probably sound stupid, but when I define my parameters how do I define it so they are equal to the user inputs?
comment on: http://stackoverflow.com/a/25604822
type: Comment

http://stackoverflow.com/a/25706369
answers question: http://stackoverflow.com/q/25706352
has comment: http://stackoverflow.com/comment/40182465
type: Answer
has body: Of course they keep blocking. accept() is a blocking method. You need two accept() loops, in two threads.
score: 0
has comment: http://stackoverflow.com/comment/40183231
has comment: http://stackoverflow.com/comment/40182613
has comment: http://stackoverflow.com/comment/40182778
has comment: http://stackoverflow.com/comment/40182693

http://stackoverflow.com/a/25664543
accepted answer of: http://stackoverflow.com/q/25664401
has body: You could use lookbehind also. Regex: (?&lt;=,) ?, Replacement string: Empty string DEMO System.out.println("hihibjj,,,,,,,ghjjjj, , ,kartik.isworking@gmail.com,,,,karan.adep@gmail.com, android-developer-support@google.com, prerna.mungekar@hamarisuraksha.com".replaceAll("(?&lt;=,) ?,", "")); Output: hihibjj,ghjjjj,kartik.isworking@gmail.com, karan.adep@gmail.com, android-developer-support@google.com, prerna.mungekar@hamarisuraksha.com
has comment: http://stackoverflow.com/comment/40111854
has comment: http://stackoverflow.com/comment/40111967
has comment: http://stackoverflow.com/comment/40111906
answers question: http://stackoverflow.com/q/25664401
has comment: http://stackoverflow.com/comment/40111926
type: Answer
has comment: http://stackoverflow.com/comment/40111508
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/25588080
downvote count: 1
upvote count: 5
has body: Tell us your whole command line, I suspect you use: java -jar file.jar -Xmx 4G or java -cp file.jar package.Main -Xmx 4G Both are wrong, you can use one of the following instead: java -Xmx4G -jar file.jar java -Xmx4G -cp file.jar package.Main
answers question: http://stackoverflow.com/q/25587106
type: Answer
score: 4

http://stackoverflow.com/comment/39943925
has text: JFrame doesn't have a paintComponent method
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25574426

xsd-1.0
tags question: http://stackoverflow.com/q/25666135
type: Tag
tag name: xsd-1.0

http://stackoverflow.com/comment/39960381
has text: There is no mapping. These are the official PMD ruleset names.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25584501

http://stackoverflow.com/q/25616249
possible better answer: http://stackoverflow.com/a/25616294
accepted answer: http://stackoverflow.com/a/25616975
has answer: http://stackoverflow.com/a/25616975
has comment: http://stackoverflow.com/comment/40019424
type: Question
has title: Best practice for writing multiple SQL queries
tagged with: database
has body: I have 2 tables which will update at the same time. As a example an employee table and a department table with many to many relationship so when new employee add to the table his department(s) will get inserted in a tertiary table. for now I first insert part of employee details to employee table then get that employees ID and then combined it with his department details I insert them to employee-departments table. for do this I currently use 3 separated SQL queries. I need to rollback the first insert(employee) if error occurred in last query(employee-department) or could not get last inserted employee. can I achieve this with my current queries (delete on failure as another query) or will it be more clean if I use a stored procedure to do the whole thing. thanks in advance :)
has answer: http://stackoverflow.com/a/25616294
type: AnsweredQuestion
score: 0
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/40018244
tagged with: java
has comment: http://stackoverflow.com/comment/40018231
tagged with: mysql

http://stackoverflow.com/a/25667940
type: Answer
has body: I found a solution for the problem: System.setProperty("gnu.io.rxtx.SerialPorts", "/dev/tty.usbArduino"); the line above has to be commented out and you have to delete your lock files for a "fresh" USB connection! Thanks to all the answers that lead me to the right way! edit: it was "/dev/tty.usbArduino" because i made a symlink of my ports! I deleted the symlink afterwards
answers question: http://stackoverflow.com/q/25647786
has comment: http://stackoverflow.com/comment/63259834
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25647786
upvote count: 6
score: 6

abstract-syntax-tree
tags question: http://stackoverflow.com/q/25607336
tags question: http://stackoverflow.com/q/25579172
type: Tag
tag name: abstract-syntax-tree

classpath
tags question: http://stackoverflow.com/q/25645944
tags question: http://stackoverflow.com/q/25564149
tags question: http://stackoverflow.com/q/25671262
tags question: http://stackoverflow.com/q/25683965
tags question: http://stackoverflow.com/q/25575591
type: Tag
tags question: http://stackoverflow.com/q/25687229
tags question: http://stackoverflow.com/q/25604532
tags question: http://stackoverflow.com/q/25658772
tags question: http://stackoverflow.com/q/25556354
tags question: http://stackoverflow.com/q/25565512
tag name: classpath
tags question: http://stackoverflow.com/q/25627246
tags question: http://stackoverflow.com/q/25627990
tags question: http://stackoverflow.com/q/25663882
tags question: http://stackoverflow.com/q/25598077
tags question: http://stackoverflow.com/q/25558414

http://stackoverflow.com/a/26527946
has body: Maybe that small piece of information helps anybody out: It is also mandatory to have the form attributed with th:action. Just attributing plain HTML action won't do and the hidden CSRF input filed won't be added automatically. Couldn't find that piece of information documented anywhere and spent 2h research on that. I had attributed the form with action="#" and set the corresponding value by javascript. The CSRF token input field wasn't added automatically until added th:action="@{#}" to the form. Works like a charm now.
answers question: http://stackoverflow.com/q/25692735
score: 1
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/39973905
type: AnswerComment
has text: Just saw your edit and I see where the confusion is coming from. It's not that `char c...` isn't **enough** for the loop, it's that it's not **valid** there. You can have a loop with no statements, e.g. `for(;;);` will loop infinitely, doing nothing but generating heat. But `for (;;) char c;` is not the same as `for (;;) {char c;}` - the first won't compile and the second will.
type: Comment
comment on: http://stackoverflow.com/a/25587786
score: 0

http://stackoverflow.com/q/25648274
tagged with: numbers
accepted answer: http://stackoverflow.com/a/25648551
tagged with: java
tagged with: range
has answer: http://stackoverflow.com/a/25648551
has title: simplifyfing a lot of ifs for numbers range folder check
has comment: http://stackoverflow.com/comment/40078487
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40076478
has comment: http://stackoverflow.com/comment/40079351
answer count: 1
upvote count: 1
has body: i have a folder structure that i need to open the folders based on the in the given number like this: Folder: -1000 --1000 --1001 --1002 --1003.. --1250 -1251 --1251 --1252 --1253 --1254 ... --1500 -1501 --1501 and go on, for each 250 files, create a new folder LastNumber+1 is there a way to make it simple i just know doing it by this: int typedNumber = 1501; if(typedNumber &gt; 1000 &amp;&amp; typedNumber &lt; 1250) { OpenFolder(1000) } if(typedNumber &gt; 1251 &amp;&amp; typedNumber &lt; 1500) { OpenFolder(1251) } if(typedNumber &gt; 1501 &amp;&amp; typedNumber &lt; 1700) { OpenFolder(1501) } why if will not be a way, cuz i have more than 15000 files, so 15000/250 = 60 IFS is this possible? like someMethodToGetTypedNumberRange(int number) { //something do know where folder range the number is in } obs: cant do the File.. to search cuz it take ages i appreciate tutorial or any direction
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40078804

http://stackoverflow.com/comment/40028800
type: Comment
has text: remove create(), give same error.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25619916

http://stackoverflow.com/comment/40362911
has text: The method always returns a non-empty string since it is only called (I believe) when the mouse is on a datapoint. The problem occurs when the mouse is not on a datapoint (in which case method generateToolTip(dataset, row, column) is not called. Thx anyway !
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25781224

http://stackoverflow.com/comment/40155619
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25691530
has text: Well you can't access `titles.length;` until you get the result from the task so I'm not sure what you want to do. I don't see the problem with running the task then run the remaining code afterwards.
type: Comment

http://stackoverflow.com/comment/40101046
type: Comment
has text: I am not still clear .can you tell me where to make the change?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25659422

http://stackoverflow.com/a/25580572
has comment: http://stackoverflow.com/comment/39953289
score: 6
downvote count: 0
has comment: http://stackoverflow.com/comment/39953334
upvote count: 6
type: Answer
answers question: http://stackoverflow.com/q/25580477
has body: You should define a class for the data: public class Whatever { private final String name; private final int someValue; public Whatever(String name, int someValue) { this.name = name; this.someValue = someValue; } public String getName() { return name; } public in getSomeValue() { return someValue; } } Then use it like this: Map&lt;Integer, Whatever&gt; theData = new HashMap&lt;&gt;(); theData.put(121, new Whatever("Name_1", 1)); (Of course, give the class and its fields meaningful names!)
has comment: http://stackoverflow.com/comment/39953318

http://stackoverflow.com/q/25648446
type: Question
has title: @RequestMapping with @PathVariable URI is different
has comment: http://stackoverflow.com/comment/40077112
has body: hi i have a problem i am learnig how to pass values with PathVariable, i have a form with a input text and a button when you press the buttom it takes you to other page and show the value but it dont work when i press the buttom it takes me to this URL: http://localhost:8080/appThyme/shoForm1.html?firstname=MyName&submit= and i get this error HTTP 404 - /appThyme/showForm1.html but if i put this URL: http://localhost:8080/appThyme/respuesta/Myname it works it shows me my page with my name, how can i make that work with only pressing the buttom, why when i press the buttom it add question marks and equals symbols to my URI @Controller public class HomeController { @RequestMapping(value = "/form1", method = RequestMethod.GET) public String showFormulario2(Model model) { logger.info("***PAG formulario***"); return "form1.html"; } @RequestMapping(value = "/showForm1/{id}", method = RequestMethod.GET) public String showForm(Model model, @PathVariable("id") String id) { String theId= id; model.addAttribute("TheID", theId); return "showForm1.html"; } my form1.html page Submit my showForm1.html page enter code here Home Hello world! The value is ${nombre}
has comment: http://stackoverflow.com/comment/40079100
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/40077250
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/25648769
score: 0
has comment: http://stackoverflow.com/comment/40076921
has comment: http://stackoverflow.com/comment/40076765
tagged with: java
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has comment: http://stackoverflow.com/comment/40077417
has comment: http://stackoverflow.com/comment/40077260

wrapper
tag name: wrapper
type: Tag
tags question: http://stackoverflow.com/q/25698687
tags question: http://stackoverflow.com/q/25654862

http://stackoverflow.com/comment/39993214
has text: Well, it would be better if Java, like C# would implement a `var` keyword: this keyword tries to determine the type at compile time. Thus one does not pay a performance price (possibly) and still can modify the code without having to worry about types.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25602347

http://stackoverflow.com/comment/40164817
comment on: http://stackoverflow.com/a/25696270
type: AnswerComment
score: 0
type: Comment
has text: @Arvind wheww yes it's all working just want to mention it's okay for me to use int instead of double because the user doesn't require the real number (with dash small point) in the result

http://stackoverflow.com/comment/40400783
has text: I changed it to CurrentHeight++ and it worked but it ended up making blocks in the same size in every blocks until it maybe could be because of those two for loops that's been a part of that caused it to do that. but anyways thanks for the issue.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25808227
score: 0

http://stackoverflow.com/q/25624012
tagged with: java
answer count: 1
has body: I want to access a series of functions found inside a program's dll (called SAP2000v15.dll) in Java. I'm using JNA to load the file. Here's my code: package testdll; import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.*; public class Testdll { public interface SapObject extends Library { SapObject SAP = (SapObject) Native.loadLibrary("SAP2000v15.dll", SapObject.class); public abstract int ApplicationExit(boolean FileSave); public abstract int ApplicationStart(eUnits units, boolean visible, String filename); public abstract int Hide(); public abstract int Unhide(); public abstract boolean Visible(); public void _VtblGap8(); } public static void main(String[] args) { SapObject test = SapObject.SAP; test.ApplicationStart(eUnits.lb_in_F, true, "test.sdb"); test.ApplicationExit(false); test.Unhide(); test.Visible(); test.Hide(); test._VtblGap8(); } } It seems the DLL has been successfully loaded, but I get the following error whenever I try to access one of these functions: Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'ApplicationStart': The specified procedure could not be found. at com.sun.jna.Function.&lt;init&gt;(Function.java:179) at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:347) at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:327) at com.sun.jna.Library$Handler.invoke(Library.java:203) at com.sun.proxy.$Proxy0.ApplicationStart(Unknown Source) at testdll.Testdll.main(Testdll.java:47) Java Result: 1 The program's documentation (SAP2000 OAPI help file) states the following: Next an instance of the SAP2000 object must be created (also known as instantiating the object) within your application. In VBA this could be accomplished as: Dim SapObjectAs SAP2000.SapObject Set SapObject = New SAP2000.SapObject The first line creates the object variable and the second line creates the instance of the SAP2000 object. Now that an instance of the SAP2000 object has been created in your applicat…
downvote count: 0
tagged with: vba
favorite count: 0
type: Question
tagged with: jna
has answer: http://stackoverflow.com/a/53808028
tagged with: dll
upvote count: 2
has comment: http://stackoverflow.com/comment/40053907
type: UnansweredQuestion
has title: How to load and use functions of third party .dll in Java
score: 2

session
tags question: http://stackoverflow.com/q/25639866
tags question: http://stackoverflow.com/q/25674582
tags question: http://stackoverflow.com/q/25563062
tags question: http://stackoverflow.com/q/25642353
tags question: http://stackoverflow.com/q/25551639
tags question: http://stackoverflow.com/q/25577414
tags question: http://stackoverflow.com/q/25625641
tags question: http://stackoverflow.com/q/25670581
tags question: http://stackoverflow.com/q/25680401
tags question: http://stackoverflow.com/q/25636732
tags question: http://stackoverflow.com/q/25589180
tag name: session
type: Tag
tags question: http://stackoverflow.com/q/25622776
tags question: http://stackoverflow.com/q/25673761

properties
tags question: http://stackoverflow.com/q/25666669
tags question: http://stackoverflow.com/q/25584789
type: Tag
tag name: properties
tags question: http://stackoverflow.com/q/25640323
tags question: http://stackoverflow.com/q/25661420

http://stackoverflow.com/a/25686194
has comment: http://stackoverflow.com/comment/40145467
has body: You should use Autowired and Qualifier annotation.. @Autowired @Qualifier("lastName") private String lastName; Try this configuration public class Test { public static void main(String[] args) { ApplicationContext context=new ClassPathXmlApplicationContext("app-context.xml"); String s = (String) context.getBean("lastName"); } }
has comment: http://stackoverflow.com/comment/40145699
has comment: http://stackoverflow.com/comment/40145106
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40145058
has comment: http://stackoverflow.com/comment/40144987
answers question: http://stackoverflow.com/q/25686116
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/40144868

http://stackoverflow.com/comment/40181100
type: AnswerComment
has text: so if i dont use any new thing in this class from jdk 8, i can use -target 1.7. is this true?
score: 0
comment on: http://stackoverflow.com/a/25705596
type: Comment

http://stackoverflow.com/comment/39920702
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25562984
has text: @Duncan and I'll add the `volatile` - thanks for the corrections.
score: 0

http://stackoverflow.com/comment/40046253
comment on: http://stackoverflow.com/a/25621815
score: 0
has text: Right. Your html page seems to require that the browser execute all the scripts referenced by the page. It's unlikely you'll get an email reader to do that, even if the email reader happens to be running in a browser.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39984849
type: AnswerComment
has text: @user2864740 dnt know, hot post output
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25597825

http://stackoverflow.com/comment/39971675
type: QuestionComment
has text: Did you follow the tutorial? If yes, then there should be an image at the end showing how it works.
score: 0
comment on: http://stackoverflow.com/q/25588359
type: Comment

http://stackoverflow.com/q/25592573
upvote count: 1
linked to: http://stackoverflow.com/q/5700135
has answer: http://stackoverflow.com/a/25592610
type: UnansweredQuestion
answer count: 1
duplicate of: http://stackoverflow.com/q/2651819
downvote count: 1
tagged with: collections
has body: I was reading Java Collection Framework at its official website. There is one point - "A Map is not a true Collection" What does it mean ? Why map is not a part of Collection ? Then I came to know Map does not extends Collection. What is the purpose of doing this ? It would be better if Map is a part of Collection, isn't it ? Please refer below hierarchy for Collection framework :-
favorite count: 0
tagged with: oop
has title: Why A Map is not a true Collection?
tagged with: java
tagged with: dictionary
type: Question
score: 0
has comment: http://stackoverflow.com/comment/39975114
linked to: http://stackoverflow.com/q/2651819

http://stackoverflow.com/comment/96771195
type: Comment
has text: One More, Treeset is homogeneous means allow only same type of data while Hashset is heterogeneous.
type: AnswerComment
score: 5
comment on: http://stackoverflow.com/a/25602519

http://stackoverflow.com/comment/39994182
type: AnswerComment
has text: i tried to upvote but i have less reputations. But i have done as accepted answer. sorry for upvote
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25602855

http://stackoverflow.com/comment/40388564
comment on: http://stackoverflow.com/q/25651586
score: 0
has text: @Code-Apprentice done but that really isn't necessarily an issue. If I can get it to work on the Tab 4 with 4.4.2 then I can adjust things to work with that.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25609088
has body: Could you try public class MyClass implements WithBoolean { @Override public Option&lt;? super Boolean&gt; doSth() { return null; } }
has comment: http://stackoverflow.com/comment/40006058
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25608974
downvote count: 0
type: Answer

http://stackoverflow.com/q/25703348
tagged with: android-activity
has answer: http://stackoverflow.com/a/25703426
has answer: http://stackoverflow.com/a/27980078
has comment: http://stackoverflow.com/comment/40176706
type: AnsweredQuestion
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/885009
has title: Why am I getting 'R cannot be resolved to a variable' on a previously working project(JAVA 8)?
has body: I know that it has been asked thousands of times, but I really can't fix this at this momment. I'm trying to update an old project(already submitet to the play store). The only dependency was the v7 appcompact lybrary and so I added it to the new workspace and updated the existing project dep[endencie, but I'm still getting the strange R cannot be resolved to a variable error. Here is what I'm doing and even if I'm 99% sure that it is what I have to do, it's not working. Updating the project dependencie: everything looks nice, but when I clean and rebuild the project, here is what happens: and the problem is still there. I'm really going to start crying, because it was a working project, buta after switching to a new workspace and checking it out from my git repository, I can't get it working. Do you have an idea what is going on? I know that I miss something small here, I know that it has been asked so many times, but I can't find an answer fitting on my case.
type: Question
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25703426
possible better answer: http://stackoverflow.com/a/27980078

http://stackoverflow.com/q/25561624
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39919485
tagged with: opencv
has comment: http://stackoverflow.com/comment/39927143
tagged with: java
has title: how to draw lines with opencv in java
has comment: http://stackoverflow.com/comment/39924933
type: Question
score: 0
has comment: http://stackoverflow.com/comment/39925939
has body: The problem is that i can not make the lines using the homography matrix, the function core.line doesn't work or I made something wrong, because I dont have error on the console. at the end I have the two images, but both are the same, the only diference is a black point almost imperceptible. images firstmatching: https://www.dropbox.com/s/0hse2pk8a6tx6xj/firstMatching.png?dl=0 images finalMatching: https://www.dropbox.com/s/yust0wjnbkziq7a/final.png?dl=0 public class SearchObject { void run(String pathObject, String pathScene, String pathResult) { System.out.println("\n searching Object"); // hier I define my images variables Mat myObject = Highgui.imread("C:/Users/Angel/Documents/mySpace/EncontrarObjeto/".concat(pathObject), 0); //0 = CV_LOAD_IMAGE_GRAYSCALE Mat myScene = Highgui.imread("C:/Users/Angel/Documents/mySpace/EncontrarObjeto/".concat(pathScene), 0); FeatureDetector detector = FeatureDetector.create(FeatureDetector.SIFT); // creamos el object para detectar por puntos claves, para este caso usaremos 4 = SURF MatOfKeyPoint keyPointsObject = new MatOfKeyPoint(); // I create the matrix kexPoints MatOfKeyPoint keyPointsScene = new MatOfKeyPoint(); detector.detect(myObject, keyPointsObject); // here I use the function detect of detector object detector.detect(myScene, keyPointsScene); DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.SIFT); // I create an object for extract the descriptors with SIFT Mat descriptorsObject = new Mat(); Mat descriptorsScene = new Mat() ; extractor.compute(myObject, keyPointsObject, descriptorsObject); extractor.compute(myScene, keyPointsScene, descriptorsScene); // creating the object to matching with FLANNBASES DescriptorMatcher matcher = DescriptorMatcher.create(1); MatOfDMatch matches = new MatOfDMatch(); matcher.match(descriptorsObject, descriptorsScene, matches); List&lt;DMatch&gt; listaMatching = matches.toList(); Double dist_max = 0.0; // definimos los maximos y minimos Double dist_min = 100.0;…
has comment: http://stackoverflow.com/comment/39924804
answer count: 0

http://stackoverflow.com/comment/39925592
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25565095
has text: You mean the: 'bufferSize * 40' part? That was something I tried but it didn't help. I edited it now so it is no longer there.

http://stackoverflow.com/comment/39916283
type: QuestionComment
has text: @Thilo, will it hang if not shut down?
score: 0
comment on: http://stackoverflow.com/q/25560878
type: Comment

http://stackoverflow.com/a/25694163
type: Answer
has body: Java 3D is one of the most high-level APIs available for 3D in Java and will probably require the least amount of coding to get something up and running. However, the project has long since been abandoned. I don't think there has been any effort to maintain the project in the past half-decade (let alone advance it) and you may find it difficult to find current online tutorials or online help. You may want to look into a more modern 3D API: JavaFX -- http://docs.oracle.com/javase/8/javafx/graphics-tutorial/shape3d.htm#CJAHFAHA jMonkey -- http://hub.jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_simpleapplication Or to go lower level, JOGL: http://www.land-of-kain.de/docs/jogl/ Personally, I feel JOGL is the best choice. The learning curve is higher, but since you are working with standard OpenGL APIs, any knowledge you gain is easily portable to other platforms.
answers question: http://stackoverflow.com/q/25694000
score: 0
has comment: http://stackoverflow.com/comment/40337793
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40160715
accepted answer of: http://stackoverflow.com/q/25694000
type: AcceptedAnswer

versioning
tags question: http://stackoverflow.com/q/25619910
type: Tag
tag name: versioning

http://stackoverflow.com/a/25557338
upvote count: 1
has comment: http://stackoverflow.com/comment/39910017
has comment: http://stackoverflow.com/comment/39909694
type: Answer
has body: You can simply use a SimpleDateFormatter. The below example shows how to use one of two instances depending on the length of the input date: String dateString = "Wed, 28 Aug 2014 15:47"; SimpleDateFormat dateFormatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm"); SimpleDateFormat dateFormatter2 = new SimpleDateFormat("EEE, dd MMM yyyy"); Date date = null; if(dateString.length() == "EEE, dd MMM yyyy HH:mm".length()) { date = dateFormatter.parse(dateString); } else { date = dateFormatter2.parse(dateString); } SimpleDateFormat destinationFormatter = new SimpleDateFormat("dd/MM/yyyy"); System.out.println(destinationFormatter.format(date));
accepted answer of: http://stackoverflow.com/q/25557255
has comment: http://stackoverflow.com/comment/39909755
has comment: http://stackoverflow.com/comment/39909615
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25557255
downvote count: 0

http://stackoverflow.com/a/25610769
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25610290
type: Answer
answers question: http://stackoverflow.com/q/25610290
has body: you don't need abc==true and if when no is typed you can just either break or you can make it equals to false while(abc){ try{ System.out.println("do you like me?") bucket = keys.nextLine(); *//user types in some string..* if(bucket.equals("yes")){ System.out.println("Yay! I love you too! :P"); } else { abc = false; } System.out.println("How much money do you have on you?"); numbers = keys.nextInt(); *//user types in **ex**. "no"* System.out.println(numbers); } catch(Exception a){ abc == true; } finally{ if(abc == false){ keys.close; } } }
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40057987
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25616349
score: 0
has text: Thank you so much. That Door example really helped me :D

http://stackoverflow.com/comment/40097508
type: Comment
has text: okey so i need to add this Swingworker thread into the Render that i am using isnt it?
type: AnswerComment
comment on: http://stackoverflow.com/a/25659714
score: 0

http://stackoverflow.com/q/25671865
has body: i want to add image to my panel which is created by Netbeans GUI Designer. here's my canvas class private static class GraphicsClass extends JPanel { @Override public void paintComponent(Graphics g) { super.paintComponent(g); Toolkit tkit; tkit=getToolkit(); Image img=tkit.getImage("ampera.jpg"); g.drawImage(img,0,0,this); } } and this is how i use it in JFrame class constructor this.Jpanel1=new GraphicsClass(); but the image doesnt show. How to fix it?
possible better answer: http://stackoverflow.com/a/25671927
type: Question
score: 2
tagged with: netbeans
answer count: 2
tagged with: canvas
upvote count: 2
downvote count: 0
tagged with: swing
has answer: http://stackoverflow.com/a/25671927
favorite count: 0
has answer: http://stackoverflow.com/a/25672637
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25672637
has title: add image in Jpanel using canvas
tagged with: java
tagged with: jpanel

http://stackoverflow.com/comment/57426655
comment on: http://stackoverflow.com/a/25704914
score: 0
type: AnswerComment
has text: In Eclipse I use plugin: 'M2E - Maven Integration for Eclipse'. Then you can right click on your project -> Configure -> Convert to Maven project. Then you will see the pom.xml file.
type: Comment

http://stackoverflow.com/comment/40042607
has text: Hmm. What do you think the `final` keyword does?
type: Comment
comment on: http://stackoverflow.com/q/25629379
score: 3
type: QuestionComment

http://stackoverflow.com/q/25644292
type: Question
has comment: http://stackoverflow.com/comment/40069043
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40069285
downvote count: 3
has comment: http://stackoverflow.com/comment/40069401
has comment: http://stackoverflow.com/comment/40069124
score: 1
has title: What's the point of package modifiers?
favorite count: 0
upvote count: 4
has comment: http://stackoverflow.com/comment/40069304
has comment: http://stackoverflow.com/comment/40068952
has answer: http://stackoverflow.com/a/25644403
accepted answer: http://stackoverflow.com/a/25644403
has comment: http://stackoverflow.com/comment/40069033
has comment: http://stackoverflow.com/comment/40069138
has body: I don't understand package modifiers (not annotations) like this: public package foo; public class Bar { } Do they have any meaning?
has comment: http://stackoverflow.com/comment/40069785
answer count: 1
tagged with: modifier
has comment: http://stackoverflow.com/comment/40069020

http://stackoverflow.com/q/25603632
score: 1
has title: Validate multiple XSD against XML
has answer: http://stackoverflow.com/a/25604647
has answer: http://stackoverflow.com/a/25604026
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question
answer count: 2
downvote count: 0
upvote count: 1
tagged with: xsd
type: AnsweredQuestion
has body: I'm currently fighting with problem with writing some unit tests to check whether XSD are valid with sample XML files. I'm getting following error: org.xml.sax.SAXParseException; cvc-elt.1: Cannot find the declaration of element 'VMS'. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1906) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:746) at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.beginNode(DOMValidatorHelper.java:277) at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:244) at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:190) at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:109) My XSD files: &lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;!-- Messages header --&gt; &lt;xs:complexType name="VMS_TYPE"&gt; &lt;!-- Recipient of message --&gt; &lt;xs:attribute name="TO" type="xs:string"/&gt; &lt;!-- Sender of message --&gt; &lt;xs:attribute name="FR" type="xs:string" /&gt; &lt;!-- Message identification number consists --&gt; &lt;xs:attribute name="VN" type="xs:string" /&gt; &lt;!-- Message creation date --&gt; &lt;xs:attribute name="OD" type="xs:date" /&gt; &lt;!-- Message creation time --&gt; &lt;xs:at…
tagged with: validation
tagged with: java
possible better answer: http://stackoverflow.com/a/25604647
accepted answer: http://stackoverflow.com/a/25604026

http://stackoverflow.com/comment/39908637
score: 1
type: Comment
has text: To expand on Roman's correct explanation, `%{level}` isn't meaningful on its own. You could use `%{#session.level}` or `%{#attr.level}` to access session-scoped values, but this seems like a strange workaround when you could just set `submitPage`.
type: QuestionComment
comment on: http://stackoverflow.com/q/25555907

http://stackoverflow.com/q/25644620
has comment: http://stackoverflow.com/comment/40069889
has comment: http://stackoverflow.com/comment/40069601
has title: Unable to find string in Java File
score: -2
has comment: http://stackoverflow.com/comment/40069565
has comment: http://stackoverflow.com/comment/40069621
has comment: http://stackoverflow.com/comment/40069602
has comment: http://stackoverflow.com/comment/40069662
has comment: http://stackoverflow.com/comment/40069573
has comment: http://stackoverflow.com/comment/40069642
type: Question
upvote count: 0
downvote count: 2
has answer: http://stackoverflow.com/a/25644878
type: UnansweredQuestion
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40069693
favorite count: 0
has body: I have a Java program that works without issue for searching most strings but for some reason I am unable to have it find the below ina file which I know appears in the file. I am obviously trying to locate a certain element that has the value of 999 but i am unable to do so. Again this works for other strings just not the one below. for(int i=0;i&lt; inputFile.length;i++) try { br = new BufferedReader(new FileReader(inputFile[i])); try { while((line = br.readLine()) != null) { countLine++; //System.out.println(line); String[] words = line.split(" "); for (String word : words) { if (word.equals(inputSearch)) { count++; countBuffer++; } } if(countBuffer &gt; 0) { countBuffer = 0; lineNumber += countLine + ","; } } br.close();

http://stackoverflow.com/q/25644714
upvote count: 2
tagged with: java
tagged with: opengl-es-3.0
answer count: 1
downvote count: 0
tagged with: opengl-es
accepted answer: http://stackoverflow.com/a/25647863
has title: How to use OpenGL ES extensions on Android
favorite count: 0
type: Question
has body: I am developing a OpenGL ES 3.0 application on Android, mainly in Java and I need to use floating point render textures. GLES30.glGetString(GLES30.GL_EXTENSIONS) returns a string containing GL_EXT_color_buffer_half_float, and GL_EXT_color_buffer_float among others => my device supports floating point textures, obviously. However, I am a bit lost right now how to use those extensions. Calling GLES30.glTexImage2D(GLES30.GL_TEXTURE_2D, 0, GLES30.GL_RGBA16F, 512, 512, 0, GLES30.GL_RGBA, GLES30.GL_UNSIGNED_BYTE, null); results in an glError 1282. Everything works when I use GL_RGBA instead of GL_RGBA16F. I wanted to try GL_RGBA16F_EXT, but that's not contained in GLES30. So, I tried to pass the value 0x881A which is how GL_RGBA16F_EXT is defined, I think. But, same error: glError 1282. There is that function eglGetProcAddress which is sometimes needed to use OpenGL ES extensions, but since I don't need the address of a function, I suspect that won't help me either. I don't really know what to try next. How can i create floating point FBOs?
has answer: http://stackoverflow.com/a/25647863
tagged with: android
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/39961276
score: 0
type: Comment
type: QuestionComment
has text: The "... 6 more" entries in the ClassNotFoundException stack trace are exactly the six entries in the NoClassDefFoundError trace.
comment on: http://stackoverflow.com/q/25582746

http://stackoverflow.com/comment/76448103
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25617143
has text: i used you answer but it didn't work.i get this error in extension side : Native application tried to send a message of 977472013 bytes, which exceeds the limit of 1048576 bytes.
type: Comment

http://stackoverflow.com/q/25554968
has answer: http://stackoverflow.com/a/25558282
answer count: 1
has title: GWT compile causes SIGSEGV
downvote count: 0
tagged with: gwt-maven-plugin
tagged with: maven
upvote count: 1
tagged with: segmentation-fault
favorite count: 0
type: Question
tagged with: gwt
type: UnansweredQuestion
score: 1
has body: Does anyone know what could be causing GWT compilation failure between gwt-maven-plugin start and "Compiling module" statement? We run GWT with info normally so all I see in my log is plugin start followed by SIGSEGV soon after. When I run with debug locally and don't see the problem I can see that the violation gets thrown while GWT plugin is performing one of these steps: loads inherited modules reviews "Public resources found in..." (I see two warnings for .pom files found in the classpath) Translatable source found in... Persistent unit cache dir set Looking for previously cached Compilation Units. I'm starting from a clean directory so I and my cache is under target so I don't think it is in the last two. Since the error relates to a zip lib entry, I suspect classpath and resolution is the likely issue. env jdk 1.7.0 u55 + gwt 2.5.1 + gwt-maven-plugin 2.5.1-rc1 Please let me know if you have any ideas, I'm increasing log level, changing memory and hoping for a reproducible case. Thanks Options Increase GWT memory and limit worker threads (DONE: 1 thread, 4g heap, no change) upgrade plugin to 2.5.1 or 2.6.1 upgrade jdk to u67 upgrade gwt to 2.6.1 except [INFO] --- gwt-maven-plugin:2.5.1-rc1:compile (default) @ mymodule --- # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00000036a3089aab, pid=14610, tid=140310347593472 # # JRE version: Java(TM) SE Runtime Environment (7.0_55-b13) (build 1.7.0_55-b13) # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.55-b03 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [libc.so.6+0x89aab] memcpy+0x15b ... ... Stack: [0x00007f9c8c5d3000,0x00007f9c8c6d4000], sp=0x00007f9c8c6d0c68, free space=1015k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [libc.so.6+0x89aab] memcpy+0x15b C [libzip.so+0x50b0] ZIP_GetEntry+0xd0 C [libzip.so+0x3eed] Java_java_util_zip_ZipFile_getEntry+0xad J java.util.zip.ZipFile.getEntry(J[BZ)J Java frames: (J=comp…
tagged with: java

http://stackoverflow.com/q/25639336
type: Question
possible better answer: http://stackoverflow.com/a/43902813
tagged with: java
has title: What's the difference between -DskipTests and -Dmaven.test.skip=true
has answer: http://stackoverflow.com/a/43902813
score: 67
upvote count: 67
has answer: http://stackoverflow.com/a/25639474
type: AnsweredQuestion
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/21933895
tagged with: maven
accepted answer: http://stackoverflow.com/a/25639474
favorite count: 0
tagged with: hive
has body: I was trying to build hive-0.13. When using -Dmaven.test.skip=true, it will not build the test jars but it will check test dependency. When using -DskipTests, it will not build the test jars and also not check test dependency. What's the difference between -DskipTests and -Dmaven.test.skip=true?

http://stackoverflow.com/q/25676175
has comment: http://stackoverflow.com/comment/40127128
has comment: http://stackoverflow.com/comment/40132074
type: AnsweredQuestion
upvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/19744943
answer count: 1
has body: I am a noobie at programming and I can't seem to figure out what to do. I am to write a Java program that reads in any number of lines from a file and generate a report with: the count of the number of values read the total sum the average score (to 2 decimal places) the maximum value along with the corresponding name. the minimum value along with the corresponding name. The input file looks like this: 55527 levaaj01 57508 levaaj02 58537 schrsd01 59552 waterj01 60552 boersm01 61552 kercvj01 62552 buttkp02 64552 duncdj01 65552 beingm01 I program runs fine, but when I add in score = input.nextInt(); and player = input.next(); The program stops working and the keyboard input seems to stop working for the filename. I am trying to read each line with the int and name separately so that I can process the data and complete my assignment. I don't really know what to do next. Here is my code: import java.io.BufferedReader; import java.io.FileReader; import java.util.Scanner; public class Program1 { private Scanner input = new Scanner(System.in); private static int fileRead = 0; private String fileName = ""; private int count = 0; private int score = 0; private String player = ""; public static void main(String[] args) { Program1 p1 = new Program1(); p1.getFirstDecision(); p1.readIn(); } public void getFirstDecision() { //************************************* System.out.println("What is the name of the input file?"); fileName = input.nextLine(); // gcgc_dat.txt } public void readIn(){ //********************************************* try { FileReader fr = new FileReader(fileName + ".txt"); fileRead = 1; BufferedReader br = new BufferedReader(fr); String str; int line = 0; while((str = br.readLine()) != null){ score = input.nextInt(); player = input.next(); System.out.println(str); line++; score = score + score; count++; } System.out.println(count); System.out.println(score); br.close(); } catch (Exception ex){ System.out.println("There is no shop named: " + fileName); } } }
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/2231369
type: Question
has comment: http://stackoverflow.com/comment/40127323
accepted answer: http://stackoverflow.com/a/25676767
has title: Reading in a file and processing data
score: -1
has answer: http://stackoverflow.com/a/25676767
has comment: http://stackoverflow.com/comment/40127354

http://stackoverflow.com/comment/39930052
comment on: http://stackoverflow.com/a/25568358
has text: Happens a lot with me too :p
type: Comment
score: 0
type: AnswerComment

rabbitmq
tags question: http://stackoverflow.com/q/25681520
tags question: http://stackoverflow.com/q/25573124
tag name: rabbitmq
tags question: http://stackoverflow.com/q/25625330
type: Tag

http://stackoverflow.com/q/25567428
downvote count: 0
tagged with: swing
favorite count: 0
type: Question
tagged with: position
upvote count: 2
has comment: http://stackoverflow.com/comment/39928155
type: UnansweredQuestion
has body: I am trying to create a translucent window which has no border or background other than the JLabel image's I put in it, using OverlayLayout and an extended JPanel... My problem is when I try to add more components over the one I initially added which would be the background, I have no idea how to enable changing of the new components position.. x,y etc... Please if possible show me what I can do and don't just point me to layoutmanagers, I need an example please if anyone is willing to show me. Or better yet, show me what I need to do to my code in order to get the desired effect.. like changing "text" (A JLabel) position to be 10,10 ... x and y. package core; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.LayoutManager; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JWindow; import javax.swing.OverlayLayout; public class App { // Window &amp; Panel... public JWindow frame; public TranslucentPanel panel; // OverlayLayout public LayoutManager overlay; // Components public JLabel bg; public JLabel test; // Constructor public App() { try { // Basics... frame = new JWindow(); frame.setBackground(new Color(0, 0, 0, 0)); // Overlay panel = new TranslucentPanel(); overlay = new OverlayLayout(panel); panel.setLayout(overlay); frame.setContentPane(panel); // initComponents initComponents(); // Finalize Frame frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } catch(Exception e) { e.printStackTrace(); } } // Initialize Additional Components public void initComponents() throws Exception { test = new JLabel("test"); test.setForeground(Color.WHITE); frame.add(test); bg = new JLabel(new ImageIcon(ImageIO.read(getClass().getResource("/ball.png")))); frame.add(bg); // What must I do to be able to do this??? test.setLocation(10, 0); } // TranslucentPanel Class... public class TranslucentPanel extend…
has title: How do I change the position of JLabel or any other Component I add?
score: 2
tagged with: components
has comment: http://stackoverflow.com/comment/39928301
has answer: http://stackoverflow.com/a/25567614
answer count: 2
has answer: http://stackoverflow.com/a/25589730
tagged with: java
has comment: http://stackoverflow.com/comment/39928057

http://stackoverflow.com/comment/40184685
comment on: http://stackoverflow.com/a/25707708
type: Comment
type: AnswerComment
score: 1
has text: OP wants an output of `s1==s2::false`. Your answer does not address it at all.

http://stackoverflow.com/q/25646698
has answer: http://stackoverflow.com/a/25646803
has answer: http://stackoverflow.com/a/25646840
has comment: http://stackoverflow.com/comment/40073563
downvote count: 0
possible better answer: http://stackoverflow.com/a/25646752
score: 4
favorite count: 0
type: Question
tagged with: try-catch
tagged with: javac
has body: I am having trouble with Javac on compiling this piece of code: public static int getYear() { Console input = System.console(); Boolean gotYear = false; int year; String userInput = input.readLine(); while (!gotYear) { try { year = Integer.parseInt(userInput); gotYear = true; } catch (Exception e) { System.out.print("Please insert a valid date. "); userInput = input.readLine(); } } return year; } Javac gives me the error on line return year; that "variable 'year' might not have been initialized". But since it's inside a while loop, I know for sure it will have been initialized. I asked my T.A. about this and he was not able to answer me why this happens. His best guess is that Javac is not a very good compiler for figuring this kind of stuff out. Basically, why is this error happening? I know I can fix it by initializing year before I enter the while loop, but I wanted to know if there is another way of achieving what I'm trying to achieve.
has answer: http://stackoverflow.com/a/25646837
has answer: http://stackoverflow.com/a/25646810
tagged with: java
has answer: http://stackoverflow.com/a/25647022
answer count: 6
has comment: http://stackoverflow.com/comment/40073684
has comment: http://stackoverflow.com/comment/40073674
has answer: http://stackoverflow.com/a/25646752
accepted answer: http://stackoverflow.com/a/25646840
upvote count: 4
type: AnsweredQuestion
has title: "variable might not have been initialized" even though I make sure it is

http://stackoverflow.com/comment/40081599
score: 0
type: Comment
has text: not clear, what is your input and what is it that you are trying to match?
comment on: http://stackoverflow.com/q/25651092
type: QuestionComment

http://stackoverflow.com/comment/39996657
score: 0
comment on: http://stackoverflow.com/q/25603949
type: Comment
type: QuestionComment
has text: Valid tables have only few records like 10-20 records only

velocity
tags question: http://stackoverflow.com/q/25625056
tags question: http://stackoverflow.com/q/25622995
tags question: http://stackoverflow.com/q/25673761
tag name: velocity
type: Tag

http://stackoverflow.com/comment/40006971
type: AnswerComment
has text: My teacher said I cant use anything but arrays, so no lists or hashsets. Im super new to all of this
comment on: http://stackoverflow.com/a/25610026
score: 0
type: Comment

http://stackoverflow.com/comment/40124530
type: Comment
comment on: http://stackoverflow.com/a/25671927
type: AnswerComment
score: 0
has text: JPanel, by extension, is a ImageConsumer, there by passing "this" to drawImage, it will take care of scheduling repaints as required.

http://stackoverflow.com/a/25947956
score: 2
has body: I got the solution for my problem. Here is the code. BufferedReader br = new BufferedReader(new InputStreamReader(blob.openInputStream())); String line; while ((line = br.readLine()) != null) { System.out.println(line); } It may help someone.
answers question: http://stackoverflow.com/q/25665118
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40101642
score: 0
type: AnswerComment
has text: How ever Thank you very much. I think, adding this solved entire problem. ( it seemed that maven compiler has some caches..if those not removed, expected final build may not come. earlier my project was building failed... . may be I am wrong.). Thansks BatScream
type: Comment
comment on: http://stackoverflow.com/a/25659127

http://stackoverflow.com/comment/40157893
type: AnswerComment
score: 0
type: Comment
has text: consider a case say there as 10 elements in the array & you want to delete 5 element so the counter will take you to the 5 element and then the counter1 loop will move the 6 element to the 5 elements place and the last one will become null ...
comment on: http://stackoverflow.com/a/25692673

http://stackoverflow.com/comment/39934104
type: Comment
has text: `double` gives you better precision than `float` but they are both **not** suitable for decimal arithmetics
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25570425

http://stackoverflow.com/comment/39926061
type: Comment
comment on: http://stackoverflow.com/q/25560878
type: QuestionComment
has text: Thanks @coffeeaddict (+1) - yes I'm explicitly disconnecting in a `finally` block. Basilevs - yes I'm using a `finally` block. So there.
score: 0

http://stackoverflow.com/a/25681802
answers question: http://stackoverflow.com/q/25681386
accepted answer of: http://stackoverflow.com/q/25681386
type: AcceptedAnswer
downvote count: 0
score: 16
upvote count: 16
has comment: http://stackoverflow.com/comment/40137615
has body: You can use hibernate's naming strategy. Such naming strategy class describes how to generate database names for given java names. See: naming strategy example second example very good oracle naming strategy - it converts camel to underscore convention, and much more
type: Answer

http://stackoverflow.com/comment/39972885
type: Comment
has text: Yes my reg was not correct the brackets are especial characters in regex! This link may help others http://regexr.com/39ds6
type: AnswerComment
comment on: http://stackoverflow.com/a/25581870
score: 0

text
tags question: http://stackoverflow.com/q/25588685
tags question: http://stackoverflow.com/q/25602478
tags question: http://stackoverflow.com/q/25558488
tags question: http://stackoverflow.com/q/25669160
tags question: http://stackoverflow.com/q/25712810
tags question: http://stackoverflow.com/q/25594101
tags question: http://stackoverflow.com/q/25591402
type: Tag
tags question: http://stackoverflow.com/q/25670444
tags question: http://stackoverflow.com/q/25553981
tags question: http://stackoverflow.com/q/25597088
tags question: http://stackoverflow.com/q/25677384
tag name: text
tags question: http://stackoverflow.com/q/25585742
tags question: http://stackoverflow.com/q/25599227

http://stackoverflow.com/a/25654589
type: Answer
has body: According to the ZipFile docs, you need to pass in a File object or a file path; an InputStream isn't supported. With that in mind, you could write that InputStream to a temporary file and then pass that file in to your existing method: ... is = zipX.getInputStream(zipEntry); File tmpDir = new File(System.getProperty("java.io.tmpdir")); //For production, generate a unique name for the temp file instead of using "temp"! File tempFile = createTempFile("temp", "zip", tmpDir); this.getFileAsBytes(tempFile.getPath(), name); break; ...
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25654475
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25654475
score: 1

http://stackoverflow.com/comment/40200421
has text: @SotiriosDelimanolis I moved to question [25715891](http://stackoverflow.com/questions/25715891/whats-the-correct-way-to-write-a-form-for-spring-mvc-with-forminput) and I will delete this quesiton soon.
score: 0
comment on: http://stackoverflow.com/q/25712830
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40150659
type: Comment
type: QuestionComment
has text: If you're asking whether 10^9+7 is some special number that's relevant to the problem--I don't think so. I think the problem setter just sort of came up with it at random.
comment on: http://stackoverflow.com/q/25689186
score: 0

http://stackoverflow.com/comment/39919431
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25562746
has text: check context of your war file and hit that. like http://`AIPADDRES:port`/`yourwebappcontext`
score: 1

http-post
tags question: http://stackoverflow.com/q/25649512
type: Tag
tags question: http://stackoverflow.com/q/25654455
tags question: http://stackoverflow.com/q/25704303
tags question: http://stackoverflow.com/q/25618859
tag name: http-post

http://stackoverflow.com/q/25656963
possible better answer: http://stackoverflow.com/a/40860506
accepted answer: http://stackoverflow.com/a/25699639
has title: Stripe Card id using token in Android
tagged with: token
answer count: 3
score: 1
has comment: http://stackoverflow.com/comment/44860361
tagged with: credit-card
tagged with: java
has answer: http://stackoverflow.com/a/25699639
downvote count: 0
upvote count: 1
tagged with: stripe-payments
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40094692
has body: I am integrating Stripe Payment module in my application. In that I use this Stripe Library. Now using this code I generating token. Using this token I need card id before payment. How to get this card id'. ? Here I show you response of Stripe. When I enter Card Information about the card Like this : Stripe_Token::create(array( "card" =&gt; array( "number" =&gt; "4242424242424242", "exp_month" =&gt; 8, "exp_year" =&gt; 2015, "cvc" =&gt; "314" ) )); After that Stripe give me this response : { "id": "tok_14WdJ02eZvKYlo2CyaZ49ZP7", "livemode": false, "created": 1409272314, "used": false, "object": "token", "type": "card", "card": { "id": "card_14WdJ02eZvKYlo2C5nE5XjtP", "object": "card", "last4": "4242", "brand": "Visa", "funding": "credit", "exp_month": 8, "exp_year": 2015, "fingerprint": "Xt5EWLLDS7FJjR1c", "country": "US", "name": null, "address_line1": null, "address_line2": null, "address_city": null, "address_state": null, "address_zip": null, "address_country": null, "customer": null } } Before payment and after token created I need this card id : "card": { "id": "card_14WdJ02eZvKYlo2C5nE5XjtP", } Hope you get my question.
has answer: http://stackoverflow.com/a/40860506
has comment: http://stackoverflow.com/comment/44823640
tagged with: android
has answer: http://stackoverflow.com/a/25665362
has comment: http://stackoverflow.com/comment/40094711
type: AnsweredQuestion

http://stackoverflow.com/comment/40121946
score: 0
comment on: http://stackoverflow.com/q/25673433
type: QuestionComment
type: Comment
has text: This is servlet application. I forget to mention.

http://stackoverflow.com/q/25680401
has title: Session management in Java Web App
tagged with: servlets
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/40134530
downvote count: 2
answer count: 1
tagged with: jsp
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25680444
has comment: http://stackoverflow.com/comment/40166118
score: -2
has answer: http://stackoverflow.com/a/25680444
tagged with: session
tagged with: java
has body: I am creating an E shopping project in Java and I'm stucked due to session in my project. I had a user login page, when user logged in, it will validate through the Servlet and it creates a new session, then it will go to productslist.jsp Now my problem is, if the user copy the url of productslist.jsp and re-entered it in the address bar, he can directly go to the productslist.jsp page, what can I do to restrict the user to login before browsing to pages?

http://stackoverflow.com/q/25589523
has answer: http://stackoverflow.com/a/25589727
has title: ImageView.setImageResource is not displaying correct drawable
accepted answer: http://stackoverflow.com/a/25589727
has comment: http://stackoverflow.com/comment/40092479
favorite count: 0
type: Question
tagged with: imageview
tagged with: android
tagged with: java
tagged with: drawable
score: -1
type: AnsweredQuestion
upvote count: 0
tagged with: view
downvote count: 1
has body: I have this app, it's basically a 'make fun' app I made with a person's face and the ability to either shoot it with a pistol, automatic rifle, or grenade (more weapons to come :-)). I have a Weapon class, with the following code. (I'm pretty new to java so forgive me if I failed to follow proven ways, or do things as efficiently as I should) public class Weapon { // Parent public static MainActivity ma; // Constants public static final int BULLET_WIDTH = 97; public static final int BULLET_HEIGHT = 92; public static final int EXPLOD_WIDTH = 299; public static final int EXPLOD_HEIGHT = 237; public static final int PISTOL = 0; public static final int RIFLE = 1; public static final int GRENADE = 2; protected static int[] position = {0, 0}; protected static RelativeLayout rl = null; protected static MediaPlayer mp; // Protected stuff // Object variables. protected int type; protected int drawableEffect; protected int soundEffect; // Functionals protected ImageView effectImage; public void equipWeapon() { // Clear any existing listeners and assign a new one. MainActivity.mainImage.setOnTouchListener(null); MainActivity.mainImage.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // Which weapon are we using? switch (type) { case Weapon.PISTOL: case Weapon.GRENADE: if (event.getAction() == MotionEvent.ACTION_DOWN) { // Fire the weapon. fireWeapon(v, event); } case Weapon.RIFLE: switch (event.getAction()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_MOVE: // This doesn't work ??? // Fire the weapon. fireWeapon(v, event); } } // perfomClick needed. return v.performClick(); } }); } public void fireWeapon(View v, MotionEvent event) { // Reference the layout. Weapon.rl = (RelativeLayout)Weapon.ma.findViewById(R.id.relativeLayout); // Define properties. RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); // Get the t…
answer count: 1

http://stackoverflow.com/q/25660816
downvote count: 0
has answer: http://stackoverflow.com/a/25668752
has answer: http://stackoverflow.com/a/25661356
upvote count: 10
favorite count: 0
has comment: http://stackoverflow.com/comment/40099897
has comment: http://stackoverflow.com/comment/40100139
has comment: http://stackoverflow.com/comment/40099607
has title: Lexicographic minimum permutation such that all adjacent letters are distinct
has comment: http://stackoverflow.com/comment/40100602
type: Question
linked to: http://stackoverflow.com/q/25285792
tagged with: algorithm
tagged with: arrays
has answer: http://stackoverflow.com/a/25663156
has body: It's a bonus school task for which we didn't receive any teaching yet and I'm not looking for a complete code, but some tips to get going would be pretty cool. Going to post what I've done so far in Java when I get home, but here's something I've done already. So, we have to do a sorting algorithm, which for example sorts "AAABBB" to the ABABAB. Max input size is 10^6, and it all has to happen under 1 second. If there's more than one answer, the first one in alphabetical order is the right one. I started to test different algorithms to even sort them without that alphabetical order requirement in mind, just to see how the things work out. First version: Save the ascii codes to the Integer array where index is the ascii code, and the value is amount which that character occurs in the char array. Then I picked 2 highest numbers, and started to spam them to the new character array after each other, until some number was higher, and I swapped to it. It worked well, but of course the order wasn't right. Second version: Followed the same idea, but stopped picking the most occurring number and just picked the indexes in the order they were in my array. Works well until the input is something like CBAYYY. Algorithm sorts it to the ABCYYY instead of AYBYCY. Of course I could try to find some free spots for those Y's, but at that point it starts to take too long.
has answer: http://stackoverflow.com/a/25661216
tagged with: sorting
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40101979
score: 10
has answer: http://stackoverflow.com/a/25666791
answer count: 6
has answer: http://stackoverflow.com/a/25661601
has comment: http://stackoverflow.com/comment/40099662
has comment: http://stackoverflow.com/comment/40099796
has comment: http://stackoverflow.com/comment/40099409
has comment: http://stackoverflow.com/comment/40099721
has comment: http://stackoverflow.com/comment/40099477
tagged with: java

http://stackoverflow.com/q/25697558
tagged with: java
has body: I am using Spring MVC and I am trying to pass both HashMap and ArrayList values to my view file. But I can't find a way to achive this. Could you please help me? My Controller Mehtod @RequestMapping(value="/do_register", method= RequestMethod.GET) public ModelAndView RegistrationForm(@ModelAttribute Subscriber subscriber, BindingResult result) { HashMap<Integer, String> interest = new HashMap<Integer, String>(); interest.put(1,"Java"); interest.put(2,"PHP"); interest.put(3, "Both"); List<City> myCities = subService.getCity(); // I want to pass both "myCities" and "interest" to my view File return new ModelAndView("regForm", "records", " "); } Form <c:url var="action" value="/register" ></c:url> <form:form action="${action}" modelAttribute="subscriber" method="POST" > City <form:select path="city"> <c:forEach items="${records}" var="city"> ${city.cityName} </c:forEach> </form:select> Interests <form:checkboxes path="interest" items="${records.interests}"/> </form:form>
possible better answer: http://stackoverflow.com/a/25697844
type: Question
linked to: http://stackoverflow.com/q/18247896
has answer: http://stackoverflow.com/a/25697844
has answer: http://stackoverflow.com/a/25697928
accepted answer: http://stackoverflow.com/a/25697928
has title: Passing both HashMap and ArrayList values to view file
tagged with: arrays
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
answer count: 2

http://stackoverflow.com/comment/40184995
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25707836
has text: One small improvement can be to check if the files[i] is a directory before making the recursive call. This will save a lot of needless recursive calls.
score: 0

http://stackoverflow.com/comment/40010115
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25609940
type: Comment
has text: so i can't do anything?

http://stackoverflow.com/a/25580262
has comment: http://stackoverflow.com/comment/39952836
has comment: http://stackoverflow.com/comment/39952829
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39952971
has body: problem: return 0; You are return 0 means there would be no list items to be displayed in your ListView thus giving you 0 result. You need to return the number of item in your array or the length of it. sample: @Override public int getCount() { // TODO Auto-generated method stub return mystringlist.length; }
has comment: http://stackoverflow.com/comment/39952876
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/39952894
accepted answer of: http://stackoverflow.com/q/25580253
type: Answer
answers question: http://stackoverflow.com/q/25580253

http://stackoverflow.com/comment/40132372
type: QuestionComment
has text: @chrylis This is not a duplicate of the question you mention. I am not using new anywhere in the code. Thanks.
comment on: http://stackoverflow.com/q/25677003
score: 0
type: Comment

http://stackoverflow.com/q/25677194
tagged with: arrays
downvote count: 0
upvote count: 1
score: 1
tagged with: java
answer count: 1
has body: So i have this code so far and i want the scanner to read from a file and i want the second array to increment every time a word is repeated from the first array...but it messes up for the first category....any ideas? Scanner sc=new Scanner(new File("Categories.txt")); String category=sc.nextLine(); int catnum=sc.nextInt(); int count[]=new int[catnum]; ArrayList&lt;String&gt;anim=new ArrayList&lt;String&gt;(); while(sc.hasNextLine()) { String temp=sc.nextLine(); anim.add(temp); } Collections.sort(anim); System.out.println(anim); for(int i=0;i&lt;count.length;i++) { String x=anim.get(0); for(int j=0;j&lt;anim.size();j++) { if(anim.get(j).equals(x)) { count[i]++; anim.remove(j--); } } } for(int i=0;i&lt;count.length;i++) { System.out.println(count[i]); }
has title: parallel arrays read from textfile
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25677245
type: UnansweredQuestion

http://stackoverflow.com/q/25681115
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/8121551
has body: How to verify internal proxy calls in unit testing by using Mockito framework? I am trying to write a test for doAllTasks() method and verify that doSingleTask() was called a certain amount of times. Obviously I can not split my service into two because these methods have the same meaning. The simplest solution is to add setProxy() method but disadvantage of this is that I will need to add test related code to my service definition. Any ideas? @Service public class XXXServiceImpl implements XXXService, BeanNameAware { private String name; private XXXService proxy; @Autowired private ApplicationContext applicationContext; @Override public void setBeanName(String name) { this.name = name; } @PostConstruct public void postConstruct() { proxy = (XXXService)applicationContext.getBean(name); } @Transactional public void doAllTasks(){ for(...) proxy.doSingleTask(...); } @Transactional(propagation = Propagation.REQUIRES_NEW) public void doSingleTask(...){ } }
tagged with: spring-transactions
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25681228
answer count: 2
accepted answer: http://stackoverflow.com/a/25681249
has answer: http://stackoverflow.com/a/25681228
tagged with: mockito
tagged with: junit
has answer: http://stackoverflow.com/a/25681249
tagged with: spring
type: Question
has title: Verifying internal proxy calls in Mockito

semaphore
type: Tag
tags question: http://stackoverflow.com/q/25562784
tag name: semaphore
tags question: http://stackoverflow.com/q/25563640

http://stackoverflow.com/q/25626757
score: 1
linked to: http://stackoverflow.com/q/11345193
tagged with: jvm
favorite count: 0
has body: I'm building a JVM diagnostics tool and I'm connecting to the JVMs using JMX, the Issue I'm facing here is that I need to be able to load tools.jar in a way that is compatible throughout unixes and windows, currently I'm using the gradle-generated run scripts to load the tools.jar to the classpath but it seems this method depends on too many factors. Does anyone knows the recommended or elegant way of making this jar available on the classpath without actually blindly guessing where is it?
accepted answer: http://stackoverflow.com/a/25628156
has title: Correct way of referencing tools.jar in a cross-platform way
downvote count: 0
has answer: http://stackoverflow.com/a/25628156
upvote count: 1
answer count: 1
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: tooling

http://stackoverflow.com/a/25566025
upvote count: 1
has body: Yes it's possible and should be done through your ExpandableListView's OnGroupClickListener. First make the children array in your adapter public and initialized by default: public HashMap&lt;Date, List&lt;OnlineProperty&gt;&gt; _listDataChild = new HashMap&lt;Date, List&lt;OnlineProperty&gt;&gt;(); Next Override the groupClickListener: mExpList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView p, View v, int grpPos, long id) { // Check if children not yet fetched if (mExpAdapter._listDataChild.get(date) == null) { // Fetch list of children for group "grpPos" // Add the children to your adapters HashMap mExpAdapter._listDataChild.put(date, children); } return false; } }); Notes: To avoid loading too much, you can Override onGroupCollapsed in your adapter to make it un-load the children that aren't being used. The code I supplied might be incorrect as I don't know your data structure. You'll have to adapt.
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25565880
has comment: http://stackoverflow.com/comment/41318081
downvote count: 0

http://stackoverflow.com/comment/40187768
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25705864
has text: I just tried that, still not quite right though. I added some pictures of what happens. Would it have something to do with the order of transformations, I think I am currently scaling, rotating then translating.
type: AnswerComment

http://stackoverflow.com/q/25706044
score: 0
tagged with: java
tagged with: elasticsearch
has body: Im using Elasticsearch Java API in my program that implements multi-threading. Ive created all my indexes and necessary DB (CouchDB) with records. GetResponse getResponse = elasticClient .prepareGet("elastestdb", "elastestdb", "id1" ).execute() .actionGet(); Map&lt;String, Object&gt; source = getResponse.getSource(); System.out.println(source); The above code works when I call it directly from a function or with in function. However, if I place in Java Multi-threading run() method, it doesnt execute although thread is running. public synchronized void run() { // System.out.println("Worker Thread started"); while (!stopping) { //not stopped if (!running) { //not running try { this.wait(); // wait until notify() } catch (InterruptedException e) { // TODO Auto-generated catch block System.out.println("[Thread " + workerID + "] interrupted"); } } else { // Actual code start here if (!stopping) { System.out.println("Im running workerID " + workerID); GetResponse getResponse = elasticClient .prepareGet("elastestdb", "elastestdb", "id1" ).execute() .actionGet(); Map&lt;String, Object&gt; source = getResponse.getSource(); System.out.println(source); } else { //Do nothing } } } }
has comment: http://stackoverflow.com/comment/40181969
type: Question
tagged with: multithreading
answer count: 1
accepted answer: http://stackoverflow.com/a/25706347
has title: Elasticsearch Java API in Java multithreading program
has answer: http://stackoverflow.com/a/25706347
has comment: http://stackoverflow.com/comment/40182083
type: AnsweredQuestion

http://stackoverflow.com/q/25618315
tagged with: java-native-interface
tagged with: java
has answer: http://stackoverflow.com/a/25618503
tagged with: http://stackoverflow.com/tag/c
tagged with: eclipse
tagged with: c++
has answer: http://stackoverflow.com/a/25942073
upvote count: 2
type: AnsweredQuestion
answer count: 2
score: 1
has body: This has been asked several time and have different accepted answers. but none of them worked for me. I have made a jni dll from my project to use in 64x windows 7 working with eclipse and jdk1.7.0_10 (64bit). but after loading my DLL i get java.lang.UnsatisfiedLinkError. I started to create a helloworld project based on this guide. and i do everything it said. but i already get this error: Exception in thread "main" java.lang.UnsatisfiedLinkError: test.HelloWorld.print()V at test.HelloWorld.print(Native Method) at test.HelloWorld.main(HelloWorld.java:24) Yes I have included the library path and yes i have build the C project for x64 and yes i'm using 64bit jvm. Codes: package test; public class HelloWorld { public native void print(); //native method static //static initializer code { try{ System.loadLibrary("CLibHelloWorld"); } catch (UnsatisfiedLinkError e) { System.err.println("Native code library failed to load.\n" + e); System.exit(1); } } public static void main(String[] args) { HelloWorld hw = new HelloWorld(); hw.print(); // ==&gt; i get error on this line } } and /* DO NOT EDIT THIS FILE - it is machine generated */ #include &lt;jni.h&gt; /* Header for class HelloWorld */ #ifndef _Included_HelloWorld #define _Included_HelloWorld #ifdef __cplusplus extern "C" { #endif /* * Class: HelloWorld * Method: print * Signature: ()V */ JNIEXPORT void JNICALL Java_HelloWorld_print (JNIEnv *, jobject); #ifdef __cplusplus } #endif #endif and #include "HelloWorld.h" #include "jni.h" #include "stdio.h" JNIEXPORT void JNICALL Java_HelloWorld_print(JNIEnv *env, jobject obj) { printf("Hello world\n"); return; }
downvote count: 1
possible better answer: http://stackoverflow.com/a/25942073
favorite count: 0
has comment: http://stackoverflow.com/comment/40022162
type: Question
accepted answer: http://stackoverflow.com/a/25618503
has title: JNI : Get java.lang.UnsatisfiedLinkError

http://stackoverflow.com/a/25642336
answers question: http://stackoverflow.com/q/25642104
has comment: http://stackoverflow.com/comment/40066120
has comment: http://stackoverflow.com/comment/40066538
score: 0
type: Answer
has body: Looks like your proxy host is not set. Try setting it, then it should work. See this page for more information on proxy properties.

http://stackoverflow.com/a/25676812
type: Answer
score: 0
has body: It looks like you're using package hw1; at the top of your java file. You can remove that line if you don't need the package, in which case your javac HW1.java java HW1 commands should work fine. Otherwise Dici's indication to use java hw1.HW1 from the root folder should work.
answers question: http://stackoverflow.com/q/25676777

http://stackoverflow.com/comment/40074844
score: 0
type: AnswerComment
has text: Yeah, I'd like to write that as comment to that IBM article, but you need IBM ID to do that :)
comment on: http://stackoverflow.com/a/25647316
type: Comment

http://stackoverflow.com/q/25701601
possible better answer: http://stackoverflow.com/a/25701769
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25701769
score: 0
tagged with: android
tagged with: java
has body: How do i set the text of a TextView to a value of an integer from another class. the main activity where i want the text set below @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); TextView counterText = (TextView) findViewById(R.id.counter); counterText.setText(); } the class below public class Ship implements Serializable { private static int counter = 0; public int getCounter() { return counter; } }
answer count: 3
accepted answer: http://stackoverflow.com/a/25701616
has answer: http://stackoverflow.com/a/25701616
has answer: http://stackoverflow.com/a/25703055
has title: How do i set the text of a TextView to a value of an integer from another class

http://stackoverflow.com/comment/40090876
has text: Why not just make two separate functions, one that returns an int and the other a string?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25655909

http://stackoverflow.com/q/25612093
answer count: 4
possible better answer: http://stackoverflow.com/a/25612115
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25612116
accepted answer: http://stackoverflow.com/a/25612116
has answer: http://stackoverflow.com/a/25612115
has title: How to compare values (integers) in an Array and store lowest value as a separate variable?
downvote count: 0
has comment: http://stackoverflow.com/comment/40010537
upvote count: 1
score: 1
tagged with: compare
tagged with: java
has comment: http://stackoverflow.com/comment/40010807
has comment: http://stackoverflow.com/comment/40010669
has body: double lowestNum = priceArray[0]; //setting a default value just in case none of the //cases passes the if statement for (int i = 1; i &lt; priceArray.length; i++) { if (priceArray[i] &lt; priceArray[i - 1]) { lowestNum = priceArray[i]; //what I'm trying to do is rewrite this //value to the "leastCost" variable } } System.out.println("The lowest number is: " + lowestNum); } In this code, I'll end up getting a 0, with priceArray[3] = {2.2, 2.4, 3.3}. If I change: lowestNum = priceArray[i]; to lowestNum += priceArray[i]; I'll end up getting 3.3, when I should be getting 2.2. Any suggestions for how I can do this?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40010561
has answer: http://stackoverflow.com/a/25612205
tagged with: for-loop
tagged with: if-statement
has answer: http://stackoverflow.com/a/25612119
tagged with: arrays

http://stackoverflow.com/a/25614462
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25613642
has body: I am not sure but may be its because of finish(); As finish destroys the activity after moving into another activity ,so you cannot go back to previous activity. Try removing finish (); hope this helps :)
score: 1

http://stackoverflow.com/comment/40012010
comment on: http://stackoverflow.com/q/25611701
type: Comment
type: QuestionComment
has text: is a borderlayout...
score: 0

amazon-ec2
tags question: http://stackoverflow.com/q/25693041
type: Tag
tag name: amazon-ec2

http://stackoverflow.com/a/25643365
type: AcceptedAnswer
downvote count: 0
has body: DisplayMetrics metrics = getResources().getDisplayMetrics(); int densityDpi = (int)(metrics.density) depends on your density you can set font type to textview and other controls like below code use Typeface font = Typeface.createFromAsset(getAssets(), "/fonts/Avenir.ttf"); textView.setTypeface(font);
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25642691
has comment: http://stackoverflow.com/comment/40124909
answers question: http://stackoverflow.com/q/25642691
score: 1
type: Answer

http://stackoverflow.com/q/25601765
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/11244167
score: 1
has comment: http://stackoverflow.com/comment/39991973
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39993160
has body: When upgrading the app, i am reading the data from db and moving data to new Db. On the DBClass constructor, calling getReadableDatabase to call oncreate\onupgrade. I am getting exception android.database.sqlite.SQLiteException: cannot rollback - no transaction is active (code 1) Please help me to solve this
has comment: http://stackoverflow.com/comment/39992011
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/39991779
type: UnansweredQuestion
has title: Android SQLiteException: cannot rollback - no transaction is active
tagged with: sqlite
duplicate of: http://stackoverflow.com/q/11244167
tagged with: android-sqlite
downvote count: 1

http://stackoverflow.com/comment/40037885
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25626841
has text: The generated `Set` is never modified.

http://stackoverflow.com/q/25656094
type: Question
tagged with: treeview
answer count: 1
accepted answer: http://stackoverflow.com/a/25666214
tagged with: inheritance
has answer: http://stackoverflow.com/a/25666214
type: AnsweredQuestion
score: 0
has body: I have a Goal, which has a list of Objectives. An objective has a list of Strategies. A strategy has a list of Tactics. A tactic has a list of Tasks. I want to be able to display this in a TreeView, and I want for the tree to be synchronized to the items. That is, if I delete an Objective, that Objective, along with its children, will disappear from the TreeView as well. So far, this is what I have been trying. /** * The base class for all PlanItems, which include ActionItems down to * ActionTasks, and Objectives down to Tasks. * * @author Toni-Tran */ public class PlanItem implements Comparable&lt;PlanItem&gt; { protected ObservableList&lt;PlanItem&gt; childPlanItems = FXCollections .observableArrayList(); protected TreeItem&lt;PlanItem&gt; treeItem = new TreeItem&lt;&gt;(this); This is the base class for all those items. In its constructor: public PlanItem() { CustomBinding.bindLists(treeItem.getChildren(), childPlanItems, PlanItem::getTreeItem); } I am using my custom binding, which binds two lists of different objects together. (Alternatively, I could have used EasyBind). /** * Binds a source list's elements to a destination list. Any changes made in * the source list will reflect in the destination list. * * @param &lt;SRC&gt; The source list's object type. * @param &lt;DEST&gt; The destination list's object type. * @param dest The destination list that will be bound to the src list. * @param src The source list to watch for changes, and propagate up to the * destination list. * @param transformer A function that will transform a source list data * type, A, into a destination list data type, B. */ public static &lt;SRC extends Object, DEST extends Object&gt; void bindLists( ObservableList&lt;DEST&gt; dest, ObservableList&lt;SRC&gt; src, Function&lt;SRC, DEST&gt; transformer) { /*Add the initial data into the destination list.*/ for (SRC a : src) { dest.add(transformer.apply(a)); } /*Watch for future data to add to the destination list. Also watch for removal of…
tagged with: javafx-8
has title: Automatically Updating TreeView of Nested Items
tagged with: java
tagged with: javafx

http://stackoverflow.com/comment/40190819
comment on: http://stackoverflow.com/a/25711123
type: Comment
score: 2
type: AnswerComment
has text: This is not an answer to the question.

http://stackoverflow.com/comment/39928899
type: Comment
comment on: http://stackoverflow.com/a/25567294
type: AnswerComment
score: 0
has text: @HotLicks thanks. When i am print it out it is giving me "{\"application\":\"admin\",\"keytype\":\"PRODUCTION\",\"callbackUrl\":\"qwerewqr;ewqrwerq;qwerqwerq\",\"authorizedDomains\":\"ALL\",\"validityTime\":\"3600000\",\"retryAfterFailure\":true}"

http://stackoverflow.com/a/26583728
answers question: http://stackoverflow.com/q/25707728
has comment: http://stackoverflow.com/comment/78228144
downvote count: 2
score: 28
upvote count: 30
has body: It is not supported to define multiple @SerializedName annotations to a field at Gson. Reason: By default Deserialization is managed with a LinkedHashMap and the keys are defined by incoming json's field names (not the custom class's field names or the serializedNames) and there is a one to one mapping. You can see the implementation(how deserialization works) at ReflectiveTypeAdapterFactory class's inner class Adapter&lt;T&gt;'s read(JsonReader in) method. Solution: You can write a custom TypeAdapter which handles name, person and user json tags and maps them to name field of your custom class MyClass: class MyClassTypeAdapter extends TypeAdapter&lt;MyClass&gt; { @Override public MyClass read(final JsonReader in) throws IOException { final MyClass myClassInstance = new MyClass(); in.beginObject(); while (in.hasNext()) { String jsonTag = in.nextName(); if ("id".equals(jsonTag)) { myClassInstance.id = in.nextInt(); } else if ("name".equals(jsonTag) || "person".equals(jsonTag) || "user".equals(jsonTag)) { myClassInstance.name = in.nextString(); } } in.endObject(); return myClassInstance; } @Override public void write(final JsonWriter out, final MyClass myClassInstance) throws IOException { out.beginObject(); out.name("id").value(myClassInstance.id); out.name("name").value(myClassInstance.name); out.endObject(); } } Test case: String jsonVal0 = "{\"id\": 5382, \"user\": \"Mary\" }"; String jsonVal1 = "{\"id\": 2341, \"person\": \"Bob\"}"; final GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeAdapter(MyClass.class, new MyClassTypeAdapter()); final Gson gson = gsonBuilder.create(); MyClass myClassInstance0 = gson.fromJson(jsonVal0, MyClass.class); MyClass myClassInstance1 = gson.fromJson(jsonVal1, MyClass.class); System.out.println("jsonVal0 :" + gson.toJson(myClassInstance0)); // output: jsonVal0 :{"id":5382,"name":"Mary"} System.out.println("jsonVal1 :" + gson.toJson(myClassInstance1)); // output: jsonVal1 :{"id":2341,"name":"Bob"} Examples about T…
type: Answer

http://stackoverflow.com/q/25600122
upvote count: 2
downvote count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/39989596
has comment: http://stackoverflow.com/comment/39989120
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4690892
has comment: http://stackoverflow.com/comment/39989086
tagged with: oop
has comment: http://stackoverflow.com/comment/39989313
linked to: http://stackoverflow.com/q/9759792
tagged with: java
tagged with: jpanel
has body: This is my second post related to Java Swing, so pardon me if my question is too straightforward. I'm trying to get multiple JPanels to communicate with each other. I'm building a simple 2D grid that I can add walls/blocked cells to, and then run a simple Floodfill/A* Search algorithm on (given start and goal locations). To isolate my issue, I decided that working with an example would be easier. So I created a simple application, that allows the user to write to a text box, provided that he/she has clicked on a "Start" button. Once writing to the text box is done, the user can click on the "Start" button to flip it to the "Stop" state. In the "Stop" state, the user cannot add any text to the text box (i.e. the application should not register any keystrokes at all). This is a simple problem that really brings out my question here. Here's how the UI looks like right now: My question: I should be able to write when the button shows "Stop" (since it is in edit mode) and I shouldn't be able to write in the text area when the button shows "Start" (since it is not it edit mode). However, from the above images, you can see that I'm able to write in the text area in any case. How do I then make the editing of the text area dependent on the button state? Here's my code which attempts at setting up that connection between the button panel and the text panel, but it somehow isn't working as expected. I looked at StackOverflow posts here and here, but frankly, the answers didn't seem clear to me. SimpleTextPanel: public class SimpleTextPanel extends JPanel implements PropertyChangeListener, ChangeListener { private boolean canWrite; public SimpleTextPanel() { // set the border properties canWrite = true; TitledBorder title = BorderFactory.createTitledBorder("Simple Text Panel"); title.setTitleColor(Color.BLACK); title.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.DARK_GRAY, Color.GRAY)); this.setBorder(title); JTextArea editSpace = new JTextArea(10, 20); …
has answer: http://stackoverflow.com/a/25600510
accepted answer: http://stackoverflow.com/a/25600510
favorite count: 0
type: Question
has title: Java Swing API - How Can Two JPanels Communicate With Each Other?
has comment: http://stackoverflow.com/comment/39988880
has answer: http://stackoverflow.com/a/25600383
answer count: 2
has comment: http://stackoverflow.com/comment/39989268
possible better answer: http://stackoverflow.com/a/25600383
has comment: http://stackoverflow.com/comment/39988839

http://stackoverflow.com/q/25605181
tagged with: java
has title: Java compare Lottery numbers
has comment: http://stackoverflow.com/comment/39998252
favorite count: 0
type: Question
has body: I have an array with 5 random numbers. Like this: int correct[] = {11,23,54,13,5}; I have another array, the user's guesses. Like this: int userGuesses[] = {23,5,5,11,50}; I want to find how many times the user guessed the lotter numbers correctly, so it cannot repeat. Like if userGuesses has 2 same numbers and user guessed correctly, but correct[] has only one value, not two, then the program shouldn't count that. This is what I have so far. public static void main(String[] args) { int correct = 0; int good[] = {1,2,3,4,5}; int bad[] = {2,1,5,5,12,3}; for (int i = 0; i &lt; 5; i++) { if(good[i] == bad[i]){ correct++; } } System.out.println(correct); }
has comment: http://stackoverflow.com/comment/39998184
has comment: http://stackoverflow.com/comment/39998239
answer count: 2
has comment: http://stackoverflow.com/comment/39998347
tagged with: for-loop
accepted answer: http://stackoverflow.com/a/25605287
downvote count: 2
tagged with: arrays
upvote count: 1
has comment: http://stackoverflow.com/comment/39998261
score: -1
has answer: http://stackoverflow.com/a/26194053
possible better answer: http://stackoverflow.com/a/26194053
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39998276
has answer: http://stackoverflow.com/a/25605287
tagged with: random

http://stackoverflow.com/a/25631596
has body: I assume from your directory structure that you are using maven. In maven project, src/main/resources is always in the classpath so you need to specify just the file name without the path. Try this: File schemaFile = new File("vast_2.0.1.xsd");
score: 0
answers question: http://stackoverflow.com/q/25631506
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40047060
accepted answer of: http://stackoverflow.com/q/25631506
has comment: http://stackoverflow.com/comment/40047110
type: Answer

http://stackoverflow.com/comment/40057006
comment on: http://stackoverflow.com/a/25582701
has text: ,@assylias ,@Oli Charlesworth click this [link](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html) u r not getting my question.. according to Java specification operator precedence , postfix should be evaluated before prefix operator, so accordingly "e--" should be evaluated before "e++"...plz everybody see the link before commenting..
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25625380
favorite count: 0
type: Question
type: UnansweredQuestion
downvote count: 0
tagged with: spring
has title: sessionFactory configuration in spring with hibernate version 4+
has answer: http://stackoverflow.com/a/25625551
has body: When we use Hibernate 3.x with Spring, we can configure our localSessionFactoryBean using postProcess methods: postProcessMappings postProcessConfiguration But when I use LocalSessionFactoryBean with Hibernate version 4+ this methods seems have been deleted from LocalSessionFactoryBean class. Does Spring add some other ability for configuration sessionFactory like in previous versions?
upvote count: 1
score: 1
tagged with: java
tagged with: hibernate
answer count: 1

http://stackoverflow.com/a/25625085
score: 0
answers question: http://stackoverflow.com/q/25624713
has body: This is how you can do it: Create a URL with the url text you have. URL.getQuery() will return the whole query part (after the ? character). Split the query at the parameter separator character (String.split("&amp;"). This will give you an array of "paramname=paramvalue" strings. Iterate over the array, and split each element at the '=' character. This will give you an array of 2 strings: the parameter name and parameter value. Decode each param name and param value using the URLDecoder.decode() method to get back a valid text. Put the parameters that start with "stud" into one array, and parameters that start with "age" into an another array, to the index specified by the number being in the parameter name after the underscore ('_') character. Storing elements at the specified index in Step 6 will ensure that the elements in the array are in order, if you need a list instead of the array, use Collections.asList().
type: Answer

http://stackoverflow.com/comment/40110348
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25651812
has text: See my edit to have colors based on the status, but still without making the edits , if you change status of PLAN-A's status to "Success", the graph would show "Green" bar only.
type: Comment

http://stackoverflow.com/comment/39986675
has text: Did you import JOptionPane? It does not seem to be able to resolve that.
type: QuestionComment
comment on: http://stackoverflow.com/q/25598974
type: Comment
score: 4

http://stackoverflow.com/q/25621522
has body: I am getting below when i try to read single json value into a string, how can i do it ? String jsonString = "{\"publisher\":\"Test\"}"; String publisher = new ObjectMapper().readValue(jsonString, String.class); System.out.println("publisher name : " + publisher); Error org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token at [Source: java.io.StringReader@42f3fe0; line: 1, column: 1]
has comment: http://stackoverflow.com/comment/40030255
has comment: http://stackoverflow.com/comment/40029848
answer count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
favorite count: 0
type: Question
type: UnansweredQuestion
downvote count: 0
upvote count: 1
tagged with: jackson
has title: Read single json value into a string from jackson objectmapper

http://stackoverflow.com/a/25594370
has body: Specify the texture coordinates for each of the vertices of the primitive: for each call to glVertex3f, there should be a matching call to glTexCoord2f. Regarding the actual values of the texture coordinates, it depends on what you want to achieve. A simple way would be to derive the 2D texture coordinates (s, t) from the indices used for the triangle strips. Here is an example implementing this: glNewList(heightmapDisplayList, GL_COMPILE); for (int z = 0; z &lt; data.length - 1; z++) { glBegin(GL_TRIANGLE_STRIP); // The t texture coordinate for z and z + 1 float t0 = (float)z / (data.length - 1); // t0 in [0,1] float t1 = (float)(z + 1) / (data.length - 1); // t1 in [0,1] for (int x = 0; x &lt; data[z].length; x++) { // The s texture coordinate for x float s = (float)x / (data[z].length - 1); // s in [0, 1] glTexCoord2f(s, t0); glVertex3f(x, data[z][x], z); glTexCoord2f(s, t1); glVertex3f(x, data[z + 1][x], z + 1); } glEnd(); } glEndList();
accepted answer of: http://stackoverflow.com/q/25593630
type: Answer
has comment: http://stackoverflow.com/comment/39980425
has comment: http://stackoverflow.com/comment/39981160
upvote count: 2
score: 1
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/39980963
answers question: http://stackoverflow.com/q/25593630

http://stackoverflow.com/comment/39955424
has text: Code would be useful
comment on: http://stackoverflow.com/q/25581726
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25559908
tagged with: google-cloud-datastore
tagged with: google-app-engine
type: AnsweredQuestion
downvote count: 0
score: 1
has body: How do I run a projection query using keys ? I would like to be able to select using a list of keys and then project on a property. ofy().load().type(Entity.class).filterKey(" in ", keys).project("property1") I got an error message saying: '__key_ _ in ' is not a legal filter condition Also I tried to query by ids which also did not work. // convert keys to ids // ... // ... ofy().load.type(Entity.class).filter(" id in ", ids).project("property1"); I got an error message saying I cannot use id in filter. I remember being able to do this using the low level datastore api. Please let me know if there is a way using objectify. Regards, Sathya
upvote count: 1
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25563051
accepted answer: http://stackoverflow.com/a/25563051
favorite count: 0
has title: Objectify projection query using keys
type: Question
tagged with: objectify

http://stackoverflow.com/comment/39919311
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25562641
has text: @ScaryWombat that's what I mean.
type: Comment

http://stackoverflow.com/comment/40047659
has text: Did you still need the example...sorry got busy in my own project :(
comment on: http://stackoverflow.com/a/25626471
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25598745
linked to: http://stackoverflow.com/q/19525129
type: AnsweredQuestion
score: 0
tagged with: atmosphere
tagged with: java
answer count: 1
tagged with: websocket
has answer: http://stackoverflow.com/a/25598873
tagged with: tomcat7
has title: not able to get broadcast on WebSocketHandlerAdapter
type: Question
tagged with: javascript
has body: I'm building a websocket proof of concept based on atmosphere. Created a javascript client that subscribes to 2 channels, and created thread on the server that creates two broadcasters and keep sending data to then, but I'm not able to get the data on the client. Is there a way to check if the messages are getting stuck on the server side or client side ? Am I dropping the ball somewhere ? :) This is what I have until now : PublishServerState - create the broadcasters and send message import javax.servlet.http.HttpServlet; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.atmosphere.cpr.AtmosphereFramework; import org.atmosphere.cpr.Broadcaster; import org.atmosphere.cpr.BroadcasterFactory; // TODO desligar os threads quando a app esta desligando public class PublishServerState extends HttpServlet { private static final long serialVersionUID = 1L; public static String value1 = "um-"; public static String value2 = "dois-"; private final Logger logger = LogManager .getLogger(PublishServerState.class); private static BroadcasterFactory broadcasterFactory; public void init() { BasicConfigurator.configure(); logger.info("init()"); AtmosphereFramework framework = (AtmosphereFramework) getServletContext() .getAttribute("AtmosphereServlet"); broadcasterFactory = framework.getBroadcasterFactory(); Thread t = new Thread() { public void run() { /** * cria canais para publicacao separada, um para cada jogo */ logger.info("cria os canais"); Broadcaster canal1 = broadcasterFactory.get("/canal/1"); Broadcaster canal2 = broadcasterFactory.get("/canal/2"); logger.info("adiciona a lista"); GameSubscription.getInstance().addBroadCast("/canal/1", canal1); GameSubscription.getInstance().addBroadCast("/canal/2", canal2); long threshold = 5000; int messages = 0; long start = System.currentTimeMillis(); String time = ""; while (true) { time = Long.toString(System.currentTimeMillis()); messages ++; canal1.broadcast(new …
accepted answer: http://stackoverflow.com/a/25598873

http://stackoverflow.com/comment/40279548
type: QuestionComment
has text: the logout is working perfectly . but what I am looking for is the following : when the user sty away from the computer , i expect shiro to log him out automatically and that is what its doing but when that happened it wont redirect him to the login page again , instead it will sty in the same page until he click on some link . i wanted to force the redirection to the login page
comment on: http://stackoverflow.com/q/25708706
score: 0
type: Comment

http://stackoverflow.com/comment/40184983
has text: In the first alert: [Object FormData]
type: Comment
comment on: http://stackoverflow.com/a/25707848
score: 0
type: AnswerComment

http://stackoverflow.com/q/25711119
linked to: http://stackoverflow.com/q/6903885
score: 0
tagged with: provider
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/79687829
tagged with: date
has body: I use this code to insert a new message into the sms provider: ContentValues values = new ContentValues(); values.put("address", phoneNumber); values.put("date", timer); values.put("body", testo); values.put("type", inbox); values.put("read", read); context.getContentResolver().insert(Uri.parse("content://sms"), values); This works correctly when timer is greater than System.currentTimeMillis(), but when timer is less than System.currentTimeMillis(), I am finding an error. This image helps me to illustrate it: The second message (New) came at the right time, but not the first (Old): It had to be at 8.02 and instead is at 10.04, which is the current time. If I click on one of them and consult their details known, however, that they are correct. The second image helps me to explain. How can I solve this problem? This appends both on android 2.3.x and on android 4.4.x. Thank you to all.
type: Question
has title: Android SMS Provider
has comment: http://stackoverflow.com/comment/40191149
tagged with: sms
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40191036

http://stackoverflow.com/a/25681226
upvote count: 1
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25681147
has body: Try to add ButterKnife Dependencies to your AndroidTest folder.
has comment: http://stackoverflow.com/comment/40136093
downvote count: 0

http://stackoverflow.com/q/25597213
has comment: http://stackoverflow.com/comment/39983796
has title: DBCP (DataBase Connection Pooling) from JavaSE with JPA
tagged with: java
possible better answer: http://stackoverflow.com/a/25619869
tagged with: persistence.xml
has answer: http://stackoverflow.com/a/25619869
type: Question
tagged with: database-connection
has body: For a JavaSE client, how is DBCP handled? With JDBC, I know how to add Apache DBCP. Can I add Apache DBCP to JPA? If so, how? Does the persistence.xml file have an option for this? code: package legacy.database; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.Query; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; public class MyQueries { private static final Logger log = Logger.getLogger(MyQueries.class.getName()); private EntityManagerFactory emf = Persistence.createEntityManagerFactory("LegacyDatabasePU"); private EntityManager em = emf.createEntityManager(); public MyQueries() { } private List<Clients> findAll() { Query q = em.createQuery("select c from Clients c"); List<Clients> clients = q.getResultList(); em.close(); return clients; } public List<Clients> selectByCriteria(Criteria criteria) { CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder(); CriteriaQuery<Clients> clientCriteriaQuery = criteriaBuilder.createQuery(Clients.class); Root<Clients> clientRoot = clientCriteriaQuery.from(Clients.class); clientCriteriaQuery.select(clientRoot); List<Predicate> predicates = new ArrayList<>(); predicates.add(criteriaBuilder.like(clientRoot.get(Clients_.phone1), "%" + criteria.getPhone1() + "%")); if (!criteria.getStatus().equalsIgnoreCase("all")) { predicates.add(criteriaBuilder.like(clientRoot.get(Clients_.status), "%" + criteria.getStatus() + "%")); } clientCriteriaQuery.where(predicates.toArray(new Predicate[0])); List<Clients> clients = em.createQuery(clientCriteriaQuery).getResultList(); em.close(); return clients; } public Clients findById(int id) { Clients client = em.find(Clients.class, id); em.close(); return client; } } persistence.xml:…
tagged with: jpa
has answer: http://stackoverflow.com/a/25602531
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39983730
tagged with: connection-pooling
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39983788
accepted answer: http://stackoverflow.com/a/25602531

http://stackoverflow.com/q/25597683
has answer: http://stackoverflow.com/a/25597721
has answer: http://stackoverflow.com/a/25597791
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25597774
has answer: http://stackoverflow.com/a/25597825
favorite count: 0
possible better answer: http://stackoverflow.com/a/25597721
has comment: http://stackoverflow.com/comment/39984867
type: Question
upvote count: 2
answer count: 5
has comment: http://stackoverflow.com/comment/39984737
tagged with: arrays
has answer: http://stackoverflow.com/a/25597765
has comment: http://stackoverflow.com/comment/39985471
tagged with: string
has title: Report matching status of all characters in a phrase with all characters in an alphabet
downvote count: 1
has body: I have the following method in Java: void searchPhrase(String[] phrase){ searchResult = new int[phrase.length]; int j=0, k=0; for (int i=0; i&lt;frase.length;i++) if (!phrase[i].equals(alphabet[k])){ System.out.println("\nLetter "+phrase[i]+" was not found when comparing it to "+alphabet[k]); k++; } else{ System.out.println("\nLetter "+phrase[i]+" was found when comparing it to "+alphabet[k]); searchResult[j] = i; k=0; } } I have two String arrays, phrase and alphabet. Phrase is any given phrase, and alphabet contains the alphabet from A to Z. I need the method to receive a phrase, let's say: "HELLO STACK". Then, it must compare every letter to the alphabet, like this: H == A? No. H == B? No. ... H == H? Yes Then, searchResult[0] = 7, because letter H from phrase[i] was equal to alphabet[7]. Now that it's found letter H, it should go on with letter E, and so on. Unfortunately, my code is doing this: H == A? No. E == B? No. L == C? No. L == D? No. O == E? No. (blank space) == F? No. S == G? No. and it goes on until it completes the phrase "HELLO STACK". What can I do to stop it from going onto the next letter if it is not found in the alphabet? Many Thanks!
has comment: http://stackoverflow.com/comment/39984664
has comment: http://stackoverflow.com/comment/39984794
has answer: http://stackoverflow.com/a/25597774
type: AnsweredQuestion

log4j
tags question: http://stackoverflow.com/q/25635180
tags question: http://stackoverflow.com/q/25666394
tags question: http://stackoverflow.com/q/25679963
tags question: http://stackoverflow.com/q/25563882
tags question: http://stackoverflow.com/q/25704527
tags question: http://stackoverflow.com/q/25694782
tags question: http://stackoverflow.com/q/25638994
tags question: http://stackoverflow.com/q/25674175
tags question: http://stackoverflow.com/q/25657983
tags question: http://stackoverflow.com/q/25604914
tags question: http://stackoverflow.com/q/25680442
tags question: http://stackoverflow.com/q/25691455
tags question: http://stackoverflow.com/q/25683210
tags question: http://stackoverflow.com/q/25689474
type: Tag
tags question: http://stackoverflow.com/q/25663882
tags question: http://stackoverflow.com/q/25669574
tags question: http://stackoverflow.com/q/25700300
tags question: http://stackoverflow.com/q/25639653
tags question: http://stackoverflow.com/q/25685217
tags question: http://stackoverflow.com/q/25685151
tag name: log4j
tags question: http://stackoverflow.com/q/25679326

http://stackoverflow.com/comment/40132417
comment on: http://stackoverflow.com/q/25674175
type: Comment
score: 0
type: QuestionComment
has text: @ErikPragt maybe, don't know how to check. So can you tell me please how to check that and how to solve?

http://stackoverflow.com/q/25654375
type: Question
has title: Pass params of one view to a controller
tagged with: playframework-2.3
tagged with: java
has body: I'm using the Play Framework 2.x and I'm trying to pass the value of one button to a method in my controller, I have this: View: &lt;form action="@routes.Application.changeLanguage()" method="get"/&gt; &lt;input name="language" type="submit" value="en" title="@Messages("button.en")" &lt;/&gt; &lt;input name="language" type="submit" value="es" title="@Messages("button.es")" &lt;/&gt; &lt;/form&gt; Route: GET / controllers.Application.changeLanguage(language: String ?= "") Controller: public static Result changeLanguage(String language){ if(language == null || language.isEmpty()){ changeLang("en"); } else { changeLang(language); } return ok(index.render("")); } In my URL I can see this language=en but the method changeLanguage never receive the value of language, some one can I help me??
type: UnansweredQuestion
tagged with: forms
has comment: http://stackoverflow.com/comment/40101080
tagged with: playframework
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25829270

http://stackoverflow.com/q/25669258
tagged with: android
upvote count: 16
has body: I want to use android downloadManager to download files; But the url is in http basic authentication. And I can get the user name and password in the application. What should I do to download files from my host? DownloadManager downloadManager = (DownloadManager) appContext.getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); downloadManager.enqueue(request); This is my code. I want to download file via "url"; But it need http basic authentication. I want to know how to add authentication like this: httpClient.getState().setCredentials(new AuthScope(HOST, 80), new UsernamePasswordCredentials(user.getEmail(), user.getPassword()));
has title: how android downloadManager do http basic authentication
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25677680
downvote count: 0
tagged with: java
answer count: 1
score: 16
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40114654
accepted answer: http://stackoverflow.com/a/25677680

http://stackoverflow.com/comment/98634559
type: Comment
type: AnswerComment
has text: THANKS!! The simplest solution in a little bti of lines
comment on: http://stackoverflow.com/a/51019783
score: 3

http://stackoverflow.com/comment/40015747
comment on: http://stackoverflow.com/a/25614543
type: Comment
score: 0
type: AnswerComment
has text: You're creating new `Enemy` instances while the `Player` thread is running, that's why you're getting more and more bitmaps on the canvas. You should think about what you really want. If you want only 3 enemies on the screen, then you should extract the "`Enemy` loop" to a separat method that will check if there are 3 instances available and create new one if necessary. You should also store the available enemy instance in a `List<Enemy>` as a variable in the `Player` class to allow access the current enemies. Use that List instead of `Enemy[]`.

http://stackoverflow.com/q/25626339
tagged with: java
downvote count: 0
favorite count: 0
type: Question
type: UnansweredQuestion
has body: Okay so the source tab on Netbeans 8.0 shows up on my school computers but not my personal tablet computer. I am frustrated beyond reason because i have no idea how to get my source tabe to appear on my personal computer. Any help beyond uninstalling and reinstalling would be much appreciated as i have tried to uninstall and reinstall.
has comment: http://stackoverflow.com/comment/40036946
has answer: http://stackoverflow.com/a/25626599
has answer: http://stackoverflow.com/a/40298003
has answer: http://stackoverflow.com/a/58124302
has comment: http://stackoverflow.com/comment/40036812
tagged with: netbeans
score: 3
has comment: http://stackoverflow.com/comment/40043565
answer count: 3
has title: Why Netbeans 8.0 is not showing Source code
linked to: http://stackoverflow.com/q/39943294
upvote count: 3

http://stackoverflow.com/comment/40056118
has text: Can you add full sacktrace please?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25636985
score: 0

http://stackoverflow.com/q/25605421
tagged with: java
tagged with: xamarin
has answer: http://stackoverflow.com/a/25607977
favorite count: 0
type: Question
upvote count: 2
tagged with: exception
has body: I'm writing an app in Xamarin for Android, and all is going well, but all of a sudden, i'm getting this "java.lang.illegalStateExeption error when i run the program. I have done nothing to the code that might have caused this, and i've even gone back to copies of the program that i've backed up, where i know there was nothing wrong, and it's still throwing the exception. The exception is thrown on the first line of the OnCreate method, here: protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // error thrown here and this is the error: You need to use a Theme.AppCompat theme (or descendant) with this activity. At the top of the Main activity, i DO declare an AppCompat theme, like this: [Activity(Label = "FrogPoint", Theme = "@style/Theme.AppCompat.Light", LaunchMode = LaunchMode.SingleTask, ScreenOrientation = ScreenOrientation.Portrait)] //master copy public class MainActivity : ActionBarActivity, IBeaconConsumer { this is driving me nuts, particularly as it's just started happening for no apparent reason. Every time the app runs, the error is thrown. I have tried both with, and without, the following in the Android Manifest: &lt;activity android:name="MainActivity" android:theme="@style/Theme.AppCompat" android:label="@string/app_name"&gt;&lt;/activity&gt; It makes no difference. Can anybody please help? Here is the stack trace: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:102) at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58) at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98) at frogpoint.droid.MainActivity.n_onCreate(Native Method) at frogpoint.droid.MainActivity.onCreate(MainActivity.java:41) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.call…
tagged with: android
downvote count: 0
tagged with: android-theme
type: UnansweredQuestion
answer count: 1
has title: Xamarin Android Theme.AppCompat exception
score: 2

http://stackoverflow.com/comment/39926064
comment on: http://stackoverflow.com/a/25565400
score: 0
type: AnswerComment
has text: Thanks for your help. I've replaced the parts in my pom.xml and web.xml. But that just results in even more errors in the Console, see edit on my original post.
type: Comment

http://stackoverflow.com/comment/39967316
comment on: http://stackoverflow.com/q/25588325
type: Comment
has text: Post your logcat output.
type: QuestionComment
score: 0

http://stackoverflow.com/q/25705053
answer count: 1
has comment: http://stackoverflow.com/comment/40180289
tagged with: arrays
has title: How much memory is allocated in Java when initializing a Object array?
has comment: http://stackoverflow.com/comment/40180349
has comment: http://stackoverflow.com/comment/40194576
has body: When Java has no idea how big each element of the array is going to be, how much memory does it allocate?
type: AnsweredQuestion
tagged with: object
has answer: http://stackoverflow.com/a/25705074
tagged with: oop
has comment: http://stackoverflow.com/comment/40180159
tagged with: java
linked to: http://stackoverflow.com/q/3444395
downvote count: 3
accepted answer: http://stackoverflow.com/a/25705074
favorite count: 0
score: -1
type: Question
upvote count: 2

http://stackoverflow.com/comment/40173599
score: 0
comment on: http://stackoverflow.com/q/25701658
type: Comment
type: QuestionComment
has text: I know that annotationconfigapplicationcontext is used to load @Configurable class to create/manage beans.but don't know how to achieve this using Jersey.

http://stackoverflow.com/q/25597256
tagged with: cassandra
has title: Cassandra Consistency (when nodes offline)
tagged with: consistency
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25597392
has body: Lets assume I have a cluster of 4 nodes. And I initiate a write operation with ConsistenyLevel.ALL Assuming all 4 nodes are connected, it would succeed as expected. Assuming all 4 nodes are connected, but 1 fails for whatever reason (primary key already exists, etc). it would fail. My question is: if 1 of the 4 nodes is offline, when executing a write with ConsistentyLevel.ALL will it fail? or does it consider 'reachability'? (i.e. if the node is offline..the effective cluster size is 3 and not 4). If it were to succeed, when the 4 node comes back online does it sync before accepting new client requests? ps. not sure if this matters but I would be using the Datastax Java Driver.
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25602231
type: Question
has answer: http://stackoverflow.com/a/25614533

http://stackoverflow.com/q/25655930
has body: I want to do some thing like that object.set(lineIndex, wordIndex, value); and this for retrieve value=object.get(lineIndex,wordIndex); But ArrayList And HashMap didn't support 2 keys for value Any Idea!! Thanks
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40090923
tagged with: android
possible better answer: http://stackoverflow.com/a/25655966
has answer: http://stackoverflow.com/a/25655966
accepted answer: http://stackoverflow.com/a/25655970
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25655970
has title: How to use 2 keys for get or set value on HashMap or ArrayList
tagged with: java

http://stackoverflow.com/comment/39958428
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25576966
has text: @OliCharlesworth I thought when a function was called stack space was allocated for the variables, the return value, and the **parameters**.
type: Comment

http://stackoverflow.com/comment/40102937
comment on: http://stackoverflow.com/q/25661853
score: 0
type: Comment
has text: Hi please have a look at my answer [here](http://stackoverflow.com/questions/23623060/can-we-have-both-of-button-and-onitemclick-listener-in-listview-in-android/23623096#23623096). Hope will help you...
type: QuestionComment

http://stackoverflow.com/a/25727854
type: Answer
score: 4
upvote count: 4
downvote count: 0
has body: It does depend on the actual instance created, neurite, as you surmised. It is important to note that the KeyPairGenerator class is abstract, and implementing subclasses override the generateKeyPair method. Thus, the authors of the abstract class KeyPairGenerator are not in a position to claim that it is thread-safe. All they could do is ensure that they did nothing to compromise thread safety. The standard way of getting a KeyPairGenerator using the static getInstance method returns an instance of a class derived from KeyPairGenerator: see the KeyPairGenerator.Delegate class. Its implementation of generateKeyPair also does nothing to compromise thread safety, so if you get your KeyPairGenerator that way, you are fine†. But you could also get a KeyPairGenerator like this: KeyPairGenerator kpg=new KeyPairGenerator("RSA"){ @Override public KeyPair generateKeyPair(){ return doSomethingThatIsntThreadSafe(); } }; Now of course, you would never do this, but the authors of KeyPairGenerator can't know that, so they can't tell you that any instance of KeyPairGenerator is thread-safe. † where fine means dependent on your cryptography SPI to do the right thing!
answers question: http://stackoverflow.com/q/25691151

http://stackoverflow.com/comment/40185179
comment on: http://stackoverflow.com/q/25707992
score: 0
has text: dict.get(str) --> will give you an int[] array, when toString() is invoked on an array, it will just print out its hashcode, and thats what you are getting. If you want the values in it, iterate the int[] that you get on making dict.get(str).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39963938
comment on: http://stackoverflow.com/q/25586490
score: 0
type: Comment
has text: I am in control of my server. can you please post your answer related to docroot, so that I can give it a try. And I tried [p] flag but doesn't work.
type: QuestionComment

http://stackoverflow.com/comment/139908177
has text: It still doesn’t work. I entered `21/09/2002`. Expected Sep 21 2002 and month 9. Got `Your Date of Birth isMon Jan 21 00:09:00 CET 2002`, `1` and `21` (only 21 is correct).
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25629905

http://stackoverflow.com/comment/40159357
score: 0
type: Comment
has text: \r also works on most consoles - takes your cursor to start of line
type: AnswerComment
comment on: http://stackoverflow.com/a/25693558

http://stackoverflow.com/comment/40043128
comment on: http://stackoverflow.com/q/25629385
score: 0
type: QuestionComment
type: Comment
has text: Yes, you right. It throws something else, I use Exception instead of IOException and it works. Thanks.

http://stackoverflow.com/comment/40300462
type: AnswerComment
comment on: http://stackoverflow.com/a/25626096
has text: You may also want to take a look at https://speakerdeck.com/salmar/deep-dive-into-spring-websockets to understand more about the message flow
score: 0
type: Comment

http://stackoverflow.com/q/25664331
answer count: 1
tagged with: spring-tool-suite
has comment: http://stackoverflow.com/comment/40109531
tagged with: grails
has comment: http://stackoverflow.com/comment/40105443
has comment: http://stackoverflow.com/comment/40109136
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25681381
score: 0
tagged with: groovy
has answer: http://stackoverflow.com/a/25681381
tagged with: java
has comment: http://stackoverflow.com/comment/40109278
has comment: http://stackoverflow.com/comment/40109303
has comment: http://stackoverflow.com/comment/40107855
has title: Timeout when importing a grails project
type: Question
has body: I am trying to import a Grails project into STS. I'm running STS 3.6.1. I've also got the Groovy plugin installed, running compiler 1.8.6. Finally, I have Grails 2.1.4. When I try to import a Grails project though (which is a Subversion repository), it is painfully slow, before it finally gives up: The command 'C:\Program Files\Java\jdk1.6.0_45\bin\javaw.exe (4 Sep 2014 12:10:28)' was terminated because it didn't produce new output for some time. See details for the output produced so far. If you think the command simply needed more time, you can increase the time limit in the Grails preferences page. See menu Windows >> Preferences >> Grails >> Launch Command: C:\Program Files\Java\jdk1.6.0_45\bin\javaw.exe (4 Sep 2014 12:10:28) ---- System.out ---- | Loading Grails 2.1.4 | Configuring classpath | Downloading: C:\Users\607534885\Software\grails-2.1.4\plugins\database-migration-1.3.2.pom | Downloading: C:\Users\607534885\Software\grails-2.1.4\lib\org.liquibase\liquibase-core\ivy-2.0.5.xml | Downloading: C:\Users\607534885\Software\grails-2.1.4\plugins\jquery-1.8.3.pom ---- System.err ---- Terminating process: Timeout: no new output for 180000 milliseconds ------System.out:----------- | Loading Grails 2.1.4 | Configuring classpath | Downloading: C:\Users\607534885\Software\grails-2.1.4\plugins\database-migration-1.3.2.pom | Downloading: C:\Users\607534885\Software\grails-2.1.4\lib\org.liquibase\liquibase-core\ivy-2.0.5.xml | Downloading: C:\Users\607534885\Software\grails-2.1.4\plugins\jquery-1.8.3.pom ------System.err:----------- Terminating process: Timeout: no new output for 180000 milliseconds Why is Grails proving to be so slow? Or is this an issue with something else?
has comment: http://stackoverflow.com/comment/40106143
has comment: http://stackoverflow.com/comment/40107764

http://stackoverflow.com/comment/40150254
type: Comment
type: QuestionComment
has text: How was I supposed to search for this question by the single-character string of "|". Give me a break :)
score: 0
comment on: http://stackoverflow.com/q/25688977

http://stackoverflow.com/a/25679861
has body: You are mistakenly returning a and b in your clone() methods. This causes an exception in B.clone(), since you can't cast an integer to a B. To fix, just ensure you return your clone variable instead. Also note that fields values are automatically copied to your clone object. There is no need to assign field values to your clone, unless they are mutable and you wish to defensively copy them. In your clone methods, you have these redundant lines: clone.a = this.a; and clone.b = this.b; You can remove both lines from your B.clone() method, since strings and integers are immutable.
has comment: http://stackoverflow.com/comment/40134133
answers question: http://stackoverflow.com/q/25679759
score: 0
type: Answer

http://stackoverflow.com/comment/40093251
score: 0
type: AnswerComment
has text: Updated answer, I think this is what you need.
type: Comment
comment on: http://stackoverflow.com/a/25656986

http://stackoverflow.com/q/25637152
has title: Easiest way in Java to turn String into UUID
has answer: http://stackoverflow.com/a/53123945
downvote count: 0
has comment: http://stackoverflow.com/comment/40056376
has comment: http://stackoverflow.com/comment/40058034
has body: How to generate a valid UUID from a String? The String alone is not what I'm looking for. Rather, I'm looking for something like a hash function converting any String to a valid UUID.
has comment: http://stackoverflow.com/comment/40056494
favorite count: 0
upvote count: 39
score: 39
tagged with: java
linked to: http://stackoverflow.com/q/40230276
has answer: http://stackoverflow.com/a/25637316
type: Question
linked to: http://stackoverflow.com/q/201705
answer count: 2
tagged with: uuid
has comment: http://stackoverflow.com/comment/102344334
type: UnansweredQuestion

http://stackoverflow.com/a/25705589
type: Answer
accepted answer of: http://stackoverflow.com/q/25705572
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25705572
has body: Just like in Maven, the dependencies you declared can have further dependencies that are declared by the package supplier (a.k.a transitive dependency management) - those will be added automatically, just like you observed. More info here.
score: 3
upvote count: 3

http://stackoverflow.com/q/25712068
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/47136951
tagged with: akka-persistence
tagged with: logging
score: 2
answer count: 0
upvote count: 2
has body: I am using the java version of akka-persistence 2.3.4 where I have several actors which extend PersistentActor and which handle both RecoveryCompleted and RecoveryFailure. I am using the default journaling and snapshot plugins. I'm running into this an issue with recovery where on some of my actors I get neither a RecoveryCompleted nor RecoveryFailure message and the actor gets stuck. What kind of diagnostics can I use to figure out why this may be happening? I have tried turning on debug logging but no akka logging shows up there.
has title: Akka Persistence - issue with Recovery - how to diagnose?
tagged with: akka
tagged with: java
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/a/25600876
answers question: http://stackoverflow.com/q/25600831
has comment: http://stackoverflow.com/comment/39990298
has body: Start by doing some research into java.text.SimpleDateFormat which can be used to parse String values of a verity of formats into a java.util.Date. You can then use another SimpleDateFormat to format the value to the format that you want, for example try { String in = "2014-08-31 13:53:42.0"; SimpleDateFormat sdfIn = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); Date date = sdfIn.parse(in); System.out.println(date); SimpleDateFormat sdfOut = new SimpleDateFormat("dd-MMM-yy hh:mm.ss a"); System.out.println(sdfOut.format(date)); } catch (ParseException ex) { } Which outputs Sun Aug 31 13:53:42 EST 2014 31-Aug-14 01:53.42 PM
type: Answer
has comment: http://stackoverflow.com/comment/39990366
has comment: http://stackoverflow.com/comment/39990332
upvote count: 5
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/39990448
has comment: http://stackoverflow.com/comment/39990256

http://stackoverflow.com/a/25572005
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25571821
has body: As Kyllopardium already said, BFS eats a lot of memory, but your problem is that you try to start a new Thread which is not going in your case. This can be caused by the RAM, by the Thread Limit of your OS, and so on. An easier solution would be to use Thread Pools. Read this article from Oracle about it. A Thread Pool as you need it has some Threads called "Worker Threads" that handle your actions. If there is currently no worker thread available, and no one could be started (for what reasons ever), your job is placed in a queue until it can be executed by a worker thread that currently has no job. This will make sure that Exceptions like this won't be thrown.
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39937359

http://stackoverflow.com/a/25574250
has comment: http://stackoverflow.com/comment/39945122
has comment: http://stackoverflow.com/comment/39942619
has comment: http://stackoverflow.com/comment/39943927
upvote count: 3
has comment: http://stackoverflow.com/comment/39943856
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39944195
accepted answer of: http://stackoverflow.com/q/25571843
downvote count: 0
has comment: http://stackoverflow.com/comment/39944757
has body: The problem with Weblogic is that it looks for a class that directly implements WebApplicationInitializer to load the context. You probably extend SpringBootServletInitializer. Try to create a class that implemets WebApplicationInitializer and copy the content of SpringBootServletInitializer in it(you will need to also copy one package level class from the spring source, so your custom class can see it, as far as I remember).
answers question: http://stackoverflow.com/q/25571843
score: 3
has comment: http://stackoverflow.com/comment/39944218
type: Answer

http://stackoverflow.com/q/25672857
tagged with: activiti
downvote count: 0
upvote count: 1
has title: Business key is Null Exception while using activiti and camel with activeMQ
favorite count: 0
has body: I am working on a POC to design workflow for our company. we heavily use ActiveMQ in our system. I am working on integrating activiti and camel routes that has activeMQ queues inside it.when I run the process, it goes through the camel route containing the queues and creates the new queues but the messages is not passed from one queue to another. I get this following message on the target queue: Unknown message type [org.apache.activemq.command.ActiveMQMessage] ActiveMQMessage below is the stack trace: 2:11:59.705 [Camel (camelContext) thread #0 - JmsConsumer[TESTQUEUE]] WARN o.a.c.c.jms.EndpointMessageListener - Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - org.activiti.engine.ActivitiIllegalArgumentException: Business key is null] org.apache.camel.RuntimeCamelException: org.activiti.engine.ActivitiIllegalArgumentException: Business key is null at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1363) ~[camel-core-2.13.2.jar:2.13.2] at org.apache.camel.component.jms.EndpointMessageListener$EndpointMessageListenerAsyncCallback.done(EndpointMessageListener.java:186) ~[camel-jms-2.13.1.jar:2.13.1] at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:107) ~[camel-jms-2.13.1.jar:2.13.1] at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562) ~[spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500) ~[spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468) ~[spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325) [spri…
type: Question
score: 1
tagged with: java
tagged with: bpmn
tagged with: apache-camel
answer count: 0
tagged with: activemq-classic
type: UnansweredQuestion

http://stackoverflow.com/q/25566622
tagged with: java
has title: Error when trying to update database in android sqlite
tagged with: sqlite
has body: I have a problem on adding subcategories,I want for example as discribed in the table below,to write a method in android that takes the parent id wich is the id of Animal and put it in the column parentid of doggie. | id | parentid | name | ----------------------------------------- | 1 | null | animal | | 2 | null |vegetable | | 3 | 1 | doggie | | 4 | 2 | carrot | | | | | | | | | this is my query to create the table in android: private static final String CREATE_TABLE_CATEGORIES="CREATE TABLE "+TABLE_CATEGORIES+"(id INTEGER PRIMARY KEY AUTOINCREMENT,"+category_name+ " TEXT,parentid INTEGER null,foreign key (parentid) references "+TABLE_CATEGORIES+" (id));"; then : public void onCreate(SQLiteDatabase db){ //Creation required tables db.execSQL(CREATE_TABLE_CATEGORIES); } ........... ........... ........... public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){ // on upgrade drop older tables db.execSQL("PRAGMA foreign_keys = ON;"); db.execSQL("DROP TABLE IF EXISTS " + CREATE_TABLE_CATEGORIES); // create new table onCreate(db); } Now I want to link a child categorie with the parent categorie using update. public void AddSubCategory(Categories parent,Categories child){ SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(String.valueOf(child.getParentid()),parent.getId()); db.update(TABLE_CATEGORIES,values,KEY_ID + " = ?",new String[] {String.valueOf(child.getId())}); } The error: at dalvik.system.NativeStart.main(Native Method) Caused by: android.database.sqlite.SQLiteException: near "0": syntax error (code 1): , while compiling: UPDATE Categories SET 0=? WHERE id = ? at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25567950
possible better answer: http://stackoverflow.com/a/25567950
has answer: http://stackoverflow.com/a/25566649
accepted answer: http://stackoverflow.com/a/25566649
tagged with: android
type: AnsweredQuestion
answer count: 2
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/39930818
score: 0
type: Comment
has text: As far as I can tell that bug was fixed. In the thread you linked to they say they fixed that in beta 1 and I looked at the source and it looked like it was using the path.
type: AnswerComment
comment on: http://stackoverflow.com/a/25564618

http://stackoverflow.com/a/25563415
answers question: http://stackoverflow.com/q/25563286
downvote count: 0
has body: It helps to reduce coupling between the presentation (i.e. the XML schema) and the business logic. For example in case of schema changes you don't have to touch the business logic, just the mapping between the objects. In simple cases it might not be worth the additional complexity. But if the objects are used extensively in the business logic component you should consider it.
type: AcceptedAnswer
type: Answer
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25563286

http://stackoverflow.com/q/25678216
linked to: http://stackoverflow.com/q/15698790
type: AnsweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/51019783
score: 103
upvote count: 105
tagged with: connectivity
tagged with: java
has answer: http://stackoverflow.com/a/55422512
possible better answer: http://stackoverflow.com/a/55422512
has answer: http://stackoverflow.com/a/72953660
favorite count: 0
has answer: http://stackoverflow.com/a/58468010
has answer: http://stackoverflow.com/a/71548049
has comment: http://stackoverflow.com/comment/83647178
has answer: http://stackoverflow.com/a/59651816
type: Question
has title: Android: Internet connectivity change listener
has answer: http://stackoverflow.com/a/65777257
has answer: http://stackoverflow.com/a/66517237
linked to: http://stackoverflow.com/q/34884442
has answer: http://stackoverflow.com/a/73646116
has answer: http://stackoverflow.com/a/49255340
has answer: http://stackoverflow.com/a/25678314
tagged with: android
has body: I already have this code which listens to connectivity change - public class NetworkStateReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { Log.d("app","Network connectivity change"); if(intent.getExtras() != null) { NetworkInfo ni = (NetworkInfo) intent.getExtras().get(ConnectivityManager.EXTRA_NETWORK_INFO); if(ni != null &amp;&amp; ni.getState() == NetworkInfo.State.CONNECTED) { Log.i("app", "Network " + ni.getTypeName() + " connected"); } } if(intent.getExtras().getBoolean(ConnectivityManager.EXTRA_NO_CONNECTIVITY, Boolean.FALSE)) { Log.d("app", "There's no network connectivity"); } } } And I check Internet connectivity using this code - Internet Check But the problem is that if network suddenly loses internet connection without any connectivity change, this code is useless. Is there any way to create Broadcast Receiver listener for Internet connectivity change? I have a web app and sudden Internet connectivity changes can cause problems.
accepted answer: http://stackoverflow.com/a/25678314
linked to: http://stackoverflow.com/q/6493517
has answer: http://stackoverflow.com/a/75604794
has answer: http://stackoverflow.com/a/57991600
linked to: http://stackoverflow.com/q/4238921
answer count: 13

http://stackoverflow.com/comment/40033582
type: AnswerComment
has text: Understood, apologies if I was not clear, I'm not invoking `team.getMailboxes()`, yet mailboxes are fully-instantiated
comment on: http://stackoverflow.com/a/25624053
type: Comment
score: 0

http://stackoverflow.com/comment/52926643
type: AnswerComment
comment on: http://stackoverflow.com/a/25688745
score: 0
type: Comment
has text: @scottb `mo` is `T`, `fromRow` is `T`, but it's not necessarily the case that `mo.getClass() == fromRow.getClass()`! In other words, we know that `mo` can be assigned to a `T`, and `fromRow` can be assigned to a `T`, but the compiler doesn't know that `mo = fromRow` is valid based on declared types.

http://stackoverflow.com/a/25596537
answers question: http://stackoverflow.com/q/25592290
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25592290
has comment: http://stackoverflow.com/comment/40010573
has comment: http://stackoverflow.com/comment/78816526
has body: In Eclipse, open Window | Preferences | Java | Installed JREs, make sure there's a JDK (and not just a JRE) for Java 1.7, then go to the submenu Execution Environments and mark this JDK as compatible with JavaSE-1.7. After that, Maven | Update Project should work as desired.
has comment: http://stackoverflow.com/comment/79318593
type: Answer
score: 14
upvote count: 14

http://stackoverflow.com/a/25692682
score: 0
answers question: http://stackoverflow.com/q/25692316
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25692316
has body: Right click on your android project - > Google -> Generate AppEngine Backend Write the endpoints there Generate client library You could write only the @Entity class then -> right click -> Google -> Generate Could Endpoint Class, that would generate the C.R.U.D operations. then you could generate the endpont library for android. HINT: New -> Other -> Android -> Appengine Connected Android Project You need both appengine and android projects to link them.
type: Answer

http://stackoverflow.com/comment/40139019
score: 0
has text: @JavaDeveloper I don't think you'll find an easier approach than allowing the test case to define the delay. I don't really see a downside to that approach.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25680974

http://stackoverflow.com/comment/39916981
has text: Thanks @Smith_61 (+1) - are you saying that its odd that I'm shutting down the my pool? Or are you saying it's odd that I'm shutting it down and its not shutting down properly? If the former, what should I be doing instead of shutting down?
score: 0
comment on: http://stackoverflow.com/q/25560878
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25683627
tagged with: spring
score: 4
has comment: http://stackoverflow.com/comment/40141295
has body: I have four packages: com.spring.org Files: HomeController.java com.spring.org.dao Files: SubscriberDao.java , SubscriberDaoImpl.java com.spring.org.model Files: Subscriber.java com.spring.org.service Files: SubscriberService.java , SubscriberServiceImpl.java I put all my controller classes in com.spring.org package and others in different packages based on its type. If I run my application I get this error message : HTTP Status 500 - Servlet.init() for servlet appServlet threw exception No qualifying bean of type [com.spring.org.service.SubscriberService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency..... FYI: I am using autowired annoation in my Controller like following: @Autowired private SubscriberService subService; But if I put all my classes and interfaces in com.spring.org package then my application works perfectly. I have tried using these tags in my servlet-context.xml file to solve the problem, but still it did not work: &lt;annotation-driven /&gt; &lt;context:annotation-config /&gt; &lt;context:component-scan base-package="com.spring.org.**" /&gt; &lt;context:component-scan base-package="com.spring.org.dao" /&gt; &lt;context:component-scan base-package="com.spring.org.model" /&gt; &lt;context:component-scan base-package="com.spring.org.service" /&gt; I also tried only this: &lt;context:component-scan base-package="com.spring.org" /&gt; You can see the code of my servlet-context.xml file here http://postimg.org/image/s6bnjccrn/ Could you please tell me how to solve this problem ? Please let me know if you need to see any other files. Update My Code for SubscriberService : @Service public interface SubscriberService { public void addSubscriber(Subscriber subscriber); public void updateSubscriber(Subscriber subscriber); public Subscriber getSubscriberById(int subId); public List&lt;Subscriber&gt; listSubs(); public int removeSubscriber(int subId); } Root Cause org.springframework.beans.factory.Bea…
upvote count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/34336975
has comment: http://stackoverflow.com/comment/40140289
has comment: http://stackoverflow.com/comment/40142834
has answer: http://stackoverflow.com/a/25683887
has title: Spring @autowired do not work if all classes are not in the same package
downvote count: 0
answer count: 7
possible better answer: http://stackoverflow.com/a/25683823
has answer: http://stackoverflow.com/a/25683673
has answer: http://stackoverflow.com/a/25683823
has comment: http://stackoverflow.com/comment/40140429
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40140200
has answer: http://stackoverflow.com/a/25684247
tagged with: spring-mvc
accepted answer: http://stackoverflow.com/a/25684617
has comment: http://stackoverflow.com/comment/40142723
has answer: http://stackoverflow.com/a/25684617
has comment: http://stackoverflow.com/comment/40140371
tagged with: java
has answer: http://stackoverflow.com/a/25683972
has comment: http://stackoverflow.com/comment/40143132

http://stackoverflow.com/q/25618129
score: 0
tagged with: java
has body: driver.findElement(By.id("ssn_button_5")).click(); assertEquals("999-99-null", driver.findElement(By.id("ssn_display_5")).getText()); This is my the ssn button and the ssn display digit is change dynamically. Where can I use regular expression use and how can I write the code please give step by step
type: Question
has answer: http://stackoverflow.com/a/25618525
has comment: http://stackoverflow.com/comment/40022211
type: UnansweredQuestion
answer count: 1
has title: How to use regular expression in HTML By id in selenium webdriver?
tagged with: selenium-webdriver

http://stackoverflow.com/comment/40067873
has text: can you show the annotations etc.. also?
type: QuestionComment
comment on: http://stackoverflow.com/q/25642153
type: Comment
score: 0

android-dialog
type: Tag
tags question: http://stackoverflow.com/q/25587202
tag name: android-dialog

http://stackoverflow.com/a/25696040
upvote count: 1
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25695998
answers question: http://stackoverflow.com/q/25695998
has body: If you want the "splashScreen" activity to be the entrance of your application, add the declaration as the following to your manifest.xml <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40054796
has text: And what if I really need to set the id on the constructor?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25636143

http://stackoverflow.com/a/25569034
has comment: http://stackoverflow.com/comment/40118021
upvote count: 4
has comment: http://stackoverflow.com/comment/40104627
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25564651
has comment: http://stackoverflow.com/comment/40117534
answers question: http://stackoverflow.com/q/25564651
type: Answer
has body: It is a design flaw of JUnique (last version I found here). There is simply no support for the use case of a computer crash (BSOD, power interrupt). It is assumed that the ShutdownHook (which removes the locks, see JUnique.java) is always executed. The flaw is evident in the releaseLock api-docs: "Please note that a lock can be realeased only by the same JVM that has previously acquired it. If the given ID doens't correspond to a lock that belongs to the current JVM, no action will be taken." But there is no method forceReleaseLock(String id) which in turn means that after a computer crash, the application can no longer be started. In these kind of cases it is quite common to present the user a dialog with a message "The application is already running" and an "OK" button that shows the window of the running application. In this case, you could add a button "No, it is not" and when clicked: check that there is no open window of the application. check that JUnique.sendMessage returns null. delete the contents of new File(System.getProperty("user.home"), ".junique"); (the LOCK_FILES_DIR, see JUnique.java), or something similar that is less crude. start the application.
score: 4

http://stackoverflow.com/comment/40106770
has text: Do you get any exception? Try to remove `init-param` from web.xml file.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25661611

http://stackoverflow.com/a/25595587
has body: I've been using OnKeyListener which caused this problem. Switching to OnEditorActionListener stops the Keyboard from closing when pressing Enter and allows me to have full control of it. editText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_DONE) { //DO THINGS HERE return true; } return false; } });
downvote count: 0
answers question: http://stackoverflow.com/q/25595414
score: 6
upvote count: 6
type: Answer

http://stackoverflow.com/a/25573072
score: 0
has body: I solved it by copying it with this code as @Marco13 has mentioned in the comment above: Deep Copy public static int[][] deepCopyArray(int[][] oldArray){ int[][] newArray = new int[oldArray.length][]; for(int i=0; i&lt;oldArray.length; i++) { newArray[i] = new int[oldArray[i].length]; for(int j=0; j&lt;oldArray[i].length; j++) newArray[i][j] = oldArray[i][j]; } return newArray; }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25572709
answers question: http://stackoverflow.com/q/25572709
type: Answer

http://stackoverflow.com/comment/40126216
has text: Thanks a ton! After a little brain storm session I was able to write the location method on my own. Slightly different than yours but it still gets the job done.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25674825

throw
tags question: http://stackoverflow.com/q/25617680
tag name: throw
tags question: http://stackoverflow.com/q/25587341
type: Tag

http://stackoverflow.com/comment/39919756
comment on: http://stackoverflow.com/a/25562859
type: Comment
has text: Actually there are loseless JPEG modifications if OP wants to use JPEG so hard. https://en.wikipedia.org/wiki/Lossless_JPEG
score: 0
type: AnswerComment

http://stackoverflow.com/a/25653041
answers question: http://stackoverflow.com/q/25652969
type: Answer
score: 0
has body: I think you have a typo here: if(correct){ out.println("correct"); } if(correct) { out.println("incorret");} } This will print out both correct and incorret when correct is true. Try: if(correct){ out.println("correct"); } if(!correct) { out.println("incorret");} }
has comment: http://stackoverflow.com/comment/40085443
has comment: http://stackoverflow.com/comment/40178420

atmosphere
tag name: atmosphere
type: Tag
tags question: http://stackoverflow.com/q/25598745

http://stackoverflow.com/comment/39996256
score: 0
type: AnswerComment
has text: can i set the color using color picker have you any code for this
comment on: http://stackoverflow.com/a/25603626
type: Comment

http://stackoverflow.com/a/25645586
accepted answer of: http://stackoverflow.com/q/25645392
score: 3
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25645392
has body: The project changelog says: v2.22.0 ======= WebDriver: * JRE dependency upped to Java 6. which implies that v2.21.0 still supported Java 5. Checking the pom for that release shows: <plugin> maven-compiler-plugin <configuration> 1.5 1.5 so that looks like a good place to start. Note that JDK 5 has been unsupported since 2009.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40012086
type: Comment
type: QuestionComment
has text: @RuslanSlobodyanik The eclipse (Helios) from 2010 is not compatible with Java 8. I would suggest you upgrade eclipse to Luna, or downgrade Java.
comment on: http://stackoverflow.com/q/25598254
score: 0

http://stackoverflow.com/comment/39910835
type: QuestionComment
score: 0
has text: I did search it, but I didn't see that question. I must not have gone through enough search results or just missed it. Sorry about that.
comment on: http://stackoverflow.com/q/25557746
type: Comment

http://stackoverflow.com/q/25608059
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
tagged with: error-handling
has comment: http://stackoverflow.com/comment/40003546
tagged with: libraries
tagged with: eclipse
has title: Java JSON Jar NoClassDefFound Caused by ClassNotFoundException
type: Question
type: UnansweredQuestion
has body: I have a simple java file packaged as a Jar on a server called by a PHP script. I have the "json-simple-1.1.1" library included in my java program. However, when I run it gives me the below error. I've added the json-simple jar to my project and import the correct classes. From what I've read it doesn't seem to be adding the json-simple library to my manifest file. Any ideas on how to fix this. I'm using eclipse if that helps. Exception in thread "main" java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2570) at java.lang.Class.getMethod0(Class.java:2813) at java.lang.Class.getMethod(Class.java:1663) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486) Caused by: java.lang.ClassNotFoundException: org.json.simple.parser.ParseException at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
has answer: http://stackoverflow.com/a/25608279
score: 0

http://stackoverflow.com/a/25598161
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25596568
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25596568
upvote count: 1
has body: Get hold of one of the bytecode manipulation package, such as ASM. Read the docs and sample programs. Write a program that automates the code modification you're interested in.

http://stackoverflow.com/q/25701605
tagged with: android
tagged with: http-status-code-404
has answer: http://stackoverflow.com/a/68086030
tagged with: httpurlconnection
has answer: http://stackoverflow.com/a/25701711
possible better answer: http://stackoverflow.com/a/25701711
type: AnsweredQuestion
upvote count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25701719
accepted answer: http://stackoverflow.com/a/25701719
tagged with: java
has body: I have a service deployed in Heroku that produces a pdf file output. When I hit the URL in the browser, I am able to download the pdf file (I am not prompting to save (as per my requirement), it auto save to defined path in the code). So service is up and available. But when I am accessing it using HttpURLConnection I am getting 404 error. . Could anyone help me out on this? Following is the link I am accessing: http://quiet-savannah-7144.herokuapp.com/services/time/temp Here is the service code, deployed in Heroku server: @jawax.ws.rs.core.Context ServletContext context; @GET @path("/temp") @Produces("application/pdf") public Response getPdf() throws IOException{ InputStream is = context.getResourceAsStream("/static/temp.pdf"); ResponseBuilder res = Response.ok(is); res.header("Content-Disposition","attachment; filename=temp.pdf"); return res.build(); } Note: I have my file in the location webapp/static/temp.pdf Client code is as follows: try { URL url = new URL("http://quiet-savannah-7144.herokuapp.com/sevices/time/temp"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("GET"); conn.setRequestProperty("Content-Type", "application/json"); int code = conn.getResponseCode(); System.out.println("code&gt;&gt;"+code+"&lt;&lt;"); if (conn.getResponseCode() == 200) { System.out.println("*************************done****************************"); InputStream inputStream = conn.getInputStream(); OutputStream output = new FileOutputStream("D:/copyOfTest.pdf"); byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = inputStream.read(buffer)) != -1) { output.write(buffer, 0, bytesRead); } output.close(); } else { Scanner scanner = new Scanner(conn.getErrorStream()); while(scanner.hasNext()) System.out.println(scanner.next()); scanner.close(); } conn.disconnect(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } I tried content type with pdf and …
favorite count: 0
has title: Getting 404 for HttpURLConnection
type: Question
tagged with: heroku
score: 3
answer count: 3

http://stackoverflow.com/q/25617615
has comment: http://stackoverflow.com/comment/40102419
tagged with: jboss6.x
has body: I am using Default message listener class for listening to MQ which is configured in Jboss using resource adapter. The session acknowledge mode is set to Client acknowledge . I am acknowledging the message if the processing is successful . However in case of failure I am not acknowledging the message but still it gets deleted from queue. I am setting up re-delivery using session.recover. What could be wrong here. Why is it not working? Ideally the message should hold on to queue till it gets acknowledged. Jboss version used is 6.0 Here is the code public class EventListener implements SessionAwareMessageListener { @Override public void onMessage(Message message, Session session) { Event event = null; try { message.acknowledge(); } catch (ValidationException validationException) { try { message.acknowledge(); } catch (JMSException e) { } } catch (RouterException routerException) { session.recover(); } catch (NoMatchingRouterException noMatchingRouterException) { try { message.acknowledge(); } catch (JMSException e) { } catch (Exception e) { } } catch (Exception e) { } } } &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt; &lt;jee:jndi-lookup id="eventQueueConnectionFactory" jndi-name="java:/eventQueueConnectionFactory" proxy-interface="javax.jms.QueueConnectionFactory"/&gt; &lt;jee:jndi-lookup id="eventQueueDestination" jndi-name="java:/EventMQ"/&gt; &lt;bean id="eventQueueMessageListener" class="com.eventtier.listener.EventListener" /&gt; &lt;bean id="dms…
score: 0
has title: Default Message Listener with Client acknowledge causes messages to be deleted from queue even if not acknowledged
tagged with: spring-jms
answer count: 0
has comment: http://stackoverflow.com/comment/40021088
tagged with: java
tagged with: jms
type: Question
tagged with: jca
type: UnansweredQuestion

http://stackoverflow.com/q/25622880
type: Question
score: 3
has answer: http://stackoverflow.com/a/41831637
has title: How to convert Excel file to Java object
has answer: http://stackoverflow.com/a/25622923
upvote count: 4
answer count: 2
has body: I am looking for a jar file that convert Excel file to an Java object, similar to javax.xml.bind. I use eBay.xcelite but it can convert only by sheet as object and row as attributes. And i want to specify the object type by cell X data.
type: UnansweredQuestion
tagged with: java
downvote count: 1
favorite count: 0

mysql
tags question: http://stackoverflow.com/q/25663888
tags question: http://stackoverflow.com/q/25615583
tags question: http://stackoverflow.com/q/25711262
tags question: http://stackoverflow.com/q/25562277
tags question: http://stackoverflow.com/q/25653702
tags question: http://stackoverflow.com/q/25615423
tags question: http://stackoverflow.com/q/25699316
tags question: http://stackoverflow.com/q/25653140
tags question: http://stackoverflow.com/q/25705762
tags question: http://stackoverflow.com/q/25657554
tags question: http://stackoverflow.com/q/25617578
tags question: http://stackoverflow.com/q/25586600
tags question: http://stackoverflow.com/q/25624500
tags question: http://stackoverflow.com/q/25700052
tags question: http://stackoverflow.com/q/25696764
tags question: http://stackoverflow.com/q/25663573
tags question: http://stackoverflow.com/q/25602207
tags question: http://stackoverflow.com/q/25626675
type: Tag
tags question: http://stackoverflow.com/q/25622301
tags question: http://stackoverflow.com/q/25689277
tags question: http://stackoverflow.com/q/25649554
tags question: http://stackoverflow.com/q/25712132
tags question: http://stackoverflow.com/q/25679525
tag name: mysql
tags question: http://stackoverflow.com/q/25659008
tags question: http://stackoverflow.com/q/25600907
tags question: http://stackoverflow.com/q/25580210
tags question: http://stackoverflow.com/q/25660241
tags question: http://stackoverflow.com/q/25616249
tags question: http://stackoverflow.com/q/25684276
tags question: http://stackoverflow.com/q/25668945
tags question: http://stackoverflow.com/q/25703759
tags question: http://stackoverflow.com/q/25702939
tags question: http://stackoverflow.com/q/25612096
tags question: http://stackoverflow.com/q/25562778
tags question: http://stackoverflow.com/q/25649925
tags question: http://stackoverflow.com/q/25688339
tags question: http://stackoverflow.com/q/25691312
tags question: http://stackoverflow.com/q/25689162
tags question: http://stackoverflow.com/q/25609518
tags question: http://stackoverflow.com/q/25594944
tags question: http://stackoverflow.com/q/25609856
tags question: http://stackoverflow.com/q/25685383
tags question: http://stackoverflow.com/q/25629706
tags question: http://stackoverflow.com/q/25651120
tags question: http://stackoverflow.com/q/25563645
tags question: http://stackoverflow.com/q/25680329
tags question: http://stackoverflow.com/q/25674226
tags question: http://stackoverflow.com/q/25705278
tags question: http://stackoverflow.com/q/25567966
tags question: http://stackoverflow.com/q/25629485
tags question: http://stackoverflow.com/q/25571553
tags question: http://stackoverflow.com/q/25559341
tags question: http://stackoverflow.com/q/25664009
tags question: http://stackoverflow.com/q/25583113
tags question: http://stackoverflow.com/q/25698557
tags question: http://stackoverflow.com/q/25686621
tags question: http://stackoverflow.com/q/25646122
tags question: http://stackoverflow.com/q/25603945
tags question: http://stackoverflow.com/q/25564521
tags question: http://stackoverflow.com/q/25558613
tags question: http://stackoverflow.com/q/25572641
tags question: http://stackoverflow.com/q/25607603
tags question: http://stackoverflow.com/q/25621013
tags question: http://stackoverflow.com/q/25581319
tags question: http://stackoverflow.com/q/25699590
tags question: http://stackoverflow.com/q/25686350
tags question: http://stackoverflow.com/q/25555292
tags question: http://stackoverflow.com/q/25699578
tags question: http://stackoverflow.com/q/25579301
tags question: http://stackoverflow.com/q/25687598
tags question: http://stackoverflow.com/q/25559417
tags question: http://stackoverflow.com/q/25626028
tags question: http://stackoverflow.com/q/25601467
tags question: http://stackoverflow.com/q/25704182
tags question: http://stackoverflow.com/q/25557094
tags question: http://stackoverflow.com/q/25684785
tags question: http://stackoverflow.com/q/25710365
tags question: http://stackoverflow.com/q/25560742

http://stackoverflow.com/comment/40060477
type: AnswerComment
has text: Thank you for your explanation. I'm not familiar with image resize and i didn't know what really happen when i resize an image. I check the image i was uploading. it is 4896x1890; this means that, according to what you said, my site is handling a 27 mb binary stream. Now im wondering how big sites like facebook can handle the uploading of thousands of pics at the same moment.
comment on: http://stackoverflow.com/a/25604235
type: Comment
score: 0

http://stackoverflow.com/comment/40144400
has text: why do you want to do that?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25685993
score: 1

http://stackoverflow.com/comment/40230074
score: 0
has text: I've edited the answer, just changed ... } else { ... to }else if(temp != 0){ This should work now ;)
type: Comment
comment on: http://stackoverflow.com/a/25704127
type: AnswerComment

http://stackoverflow.com/q/25682954
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25683557
tagged with: java
tagged with: stream
tagged with: outputstream
linked to: http://stackoverflow.com/q/25680210
tagged with: inputstream
has title: Can't understand use of input stream and output stream
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25683557
answer count: 2
has body: I am confused regarding use of input stream and output stream. From a stack overflow question confused about stdin, stdout and stderr? : Standard input - this is the file handle that your process reads to get information from you. Standard output - your process writes normal information to this file handle. I was trying to run an external process(A python script) using java.Which is an interactive one and requires input from user. Now as concept says that: standard input is used when your process reads to get information from you. So I should get input stream from the process to write values to it.I tried to it and failed .So I searched on stack overflow gave me a question with same problem which was taking output stream from process and then was writing to it.I tried that and that worked. My question is that why that worked? Shouldn't it be input stream which I should use to give input to that external process or I have understood input stream and output stream totally wrong. Please help me to understand it with an easy explanation . Edit : My code was : Process process=Runtime.getRuntime().exec("/usr/bin/python /home/abhijeet/test.py"); OutputStream stdin = process.getOutputStream (); String line = "30" + "\n"; stdin.write(line.getBytes() );
upvote count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/25683098
linked to: http://stackoverflow.com/q/3385201
has answer: http://stackoverflow.com/a/25683098

http://stackoverflow.com/a/25633153
has body: I was finally able to solve my problem thank to this thread Wrong Manifest.mf in IntelliJ IDEA created .jar the most upvoted answer. I think it's a bug in IntelliJ that needs to be fixed : when the MANIFEST.MF is in main/java instead of /main/ressources it isn't included in the final .jar which mean that the .jar only contains the manifest relative to the external libraries but not the manifest that tells what is the main class.
score: 1
answers question: http://stackoverflow.com/q/25623605
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/25594998
type: AnsweredQuestion
upvote count: 3
downvote count: 0
tagged with: selenium
answer count: 1
tagged with: browsermob
favorite count: 0
has title: Setting a custom header using BrowserMob-Proxy REST api
accepted answer: http://stackoverflow.com/a/25596166
tagged with: proxy
has body: I have a browsermob proxy running on port 9091. I am trying to use browsermob-proxy REST API to set a custom header. When I make a request to my app using Selenium via the proxy, I don't see the header printed in my apps console. Below is my code. The request body is based on documentation here. My requirement is to use BrowserMob proxy API and not its Java library for this particular use case. Anything I am doing wrong in the code below? Proxy proxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress("localhost", 9091)); String bpmUrl = "http://localhost:8787/proxy/9091/interceptor/request"; Client client = Client.create(); String requestBody = "request.getMethod().addHeader(\"custom-header\", \"Bananabot/1.0\");"; WebResource resource = client.resource(bpmUrl); resource.type(MediaType.TEXT_PLAIN_TYPE).post(requestBody); String url = "http://localhost:8004"; DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(CapabilityType.PROXY, proxy); WebDriver driver = new FirefoxDriver(capabilities); driver.get(url); driver.quit(); Edit 1 I tried @Erki's solution which I think should work, but its not. Anything missing here? String bpmUrl = "http://localhost:8787/proxy/9091/headers"; Map&lt;String,String&gt; data = new HashMap&lt;String, String&gt;(); data.put("user-agent","Bananabot"); ClientConfig cc = new DefaultClientConfig(); cc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); Client client = Client.create(cc); WebResource resource = client.resource(bpmUrl); resource.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, data); Edit 2 Found the answer, I tried Java API, it worked and noticed that the browser is using proxy as expected. With my code above, obviously the browser was not using proxy. So instead of using java.net.Proxy I used org.openqa.selenium.Proxy which worked. So the only code change I needed was the way I initialize the proxy, rest …
has answer: http://stackoverflow.com/a/25596166
type: Question
score: 3
tagged with: java
tagged with: webdriver

http://stackoverflow.com/comment/40118299
comment on: http://stackoverflow.com/q/25671384
has text: Well, the only reasons to return your own type from a method like that are generally for factory/chaining methods or for immutable types. It's probably one or the other, and the answer to the question depends on which one it is. There isn't just one right answer here, and it all depends what the code is supposed to do.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40028134
score: 0
comment on: http://stackoverflow.com/q/25609607
type: Comment
type: QuestionComment
has text: My problem that I want to compare requests performed in the browser with requests sent by my app. More specific: I think there is a tiny difference that prevents my back-end code to issue a facebook token after login, and I want to find it.

http://stackoverflow.com/a/25657132
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25653512
score: 0
answers question: http://stackoverflow.com/q/25653512
has body: HTML is not JSON, and it can not be parsed into JSONObjects. The top answer for org.json.JSONException: Value &lt;!DOCTYPE of type java.lang.String cannot be converted to JSONObject is pretty good at explaining this further.

http://stackoverflow.com/comment/40071867
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25635534
type: AnswerComment
has text: This causes the background image to be displayed initially but then the background goes black immediately after I begin dragging. The draggable bitmap is performing properly.

http://stackoverflow.com/comment/80322865
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27611703
type: Comment
has text: @Mig82, Please direct such questions to Jenkins Development mailing list.

http://stackoverflow.com/comment/114568592
comment on: http://stackoverflow.com/a/25684202
type: AnswerComment
score: 1
type: Comment
has text: @shareef: Well it reduces how much memory is required, which potentially the frequency of garbage collection, but I'd be surprised to see it be measurable.

http://stackoverflow.com/comment/40099001
comment on: http://stackoverflow.com/a/25655843
type: Comment
score: 0
type: AnswerComment
has text: Unfortunatly any approach does not work in my case: 1) The first one continue return empty response as the following code are present in: Object body = responseEntity.getBody(); if (body != null) { writeWithMessageConverters(body, returnType, inputMessage, outputMessage); } else { // flush headers to the HttpServletResponse outputMessage.getBody(); }. So it's just preint null as priviues and avoid writeWithMessageConverters method.

http://stackoverflow.com/a/25693516
has body: I wrote an e-mail to them and they said its all good because I was using Libgdx and they coudn't detect it and they fixed the issue now.
type: Answer
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25650322
accepted answer of: http://stackoverflow.com/q/25650322

http://stackoverflow.com/comment/40090140
has text: can you please post the error so that we can see where the error is and what exactly it says.
type: Comment
comment on: http://stackoverflow.com/q/25655458
type: QuestionComment
score: 0

http://stackoverflow.com/a/25649080
has comment: http://stackoverflow.com/comment/40078028
answers question: http://stackoverflow.com/q/25649005
has body: May this help you: private static int nummber( int a){ Random r = new Random(); a =r.nextInt(999); System.out.println(a); return a; } private static void search(int b, int a){ b = 0; if(b =! a){ for(b =1; b =! a ; b++){ if(b == a){ System.out.println("found the number " + b); } } } } public static void main(String args[]){ int a = nummber(0); search(0, a); }
type: Answer
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/40078013
downvote count: 1

http://stackoverflow.com/comment/40173309
type: AnswerComment
comment on: http://stackoverflow.com/a/25701441
score: 0
type: Comment
has text: @Tom No, of course it isn't, and I never claimed that, did I? My answer was meant to point out that rows might not appear in a specific order, and thus it can be perceived as rows being skipped if the first row in a set was expected to appear later. After re-reading the question it seems that the issue here is the use of `first()` and `next()`. The `ORDER BY` still matters in my opinion.

http://stackoverflow.com/q/25626369
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25627583
type: Question
has body: I have a maven-changes-plugin configured for a build process. Sometimes, JIRA intranet server is down and the build takes ages waiting for a long timeout on JIRA. Is there a way to configure the timeout?
has answer: http://stackoverflow.com/a/25627583
tagged with: maven
has title: How to configure timeout for maven-changes-plugin?
tagged with: maven-changes-plugin
type: AnsweredQuestion
tagged with: java
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/comment/50068566
comment on: http://stackoverflow.com/a/26414487
type: Comment
has text: I had similar issue on Liferay Developer Studio and this worked for me like a charm ! Thank you.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40124023
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25674473
has text: Is Tomcat doing anything else during this time, handling other requests? Are you running both scenarios on the same machine?

http://stackoverflow.com/comment/39946742
type: QuestionComment
comment on: http://stackoverflow.com/q/25576966
has text: All of these are semantically pass-by-value. Could the compiler optimise under-the-hood? Sure, it's possible.
score: 3
type: Comment

http://stackoverflow.com/a/25552297
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25552218
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25552218
has body: It is not quite clear what will be an essense of such stream. General answer: no, there is not such streams in java api. But if you will compose the essense of it, you can create your own, which will implement something like: public interface InputFileItemStream implements Closeable { File read(); void close(); void reset(); ... }

http://stackoverflow.com/q/25641379
tagged with: spring-security
tagged with: spring-security-oauth2
has answer: http://stackoverflow.com/a/25653642
type: AnsweredQuestion
has body: I've created a RESTful web services to execute actions on a workflow. The web service is secured with oauth2 with my own authorization server. I want to add information to my workflow about who executed an action on it. What I can't figure out is who to get the user name of the one calling the web service. For web service implementation I'm using jersey (1.18.1) and for security I'm using spring-security-oauth2 (2.0.2.RELEASE). I'm using a database token store and this contains a table OAUTH_ACCESS_TOKEN (TOKEN_ID, TOKEN, AUTHENTICATION_ID, USER_NAME, CLIENT_ID, AUTHENTICATION, REFRESH_TOKEN) that looks like containing the correct information. It has the user name and token but the token looks like a serialized java object so I can't query it myself. Web service: @Component @Path("/workflows") public class WorkflowRestService { @POST @Path("/{id}/actions") @Produces(MediaType.APPLICATION_JSON) @Transactional public Response executeActions(@PathParam("id") String id, Map<String, Object> actionArgs) throws JAXBException, HealthDataException { //would like to have/get username here. Workflow workflow = workflowService.get(id); Action action = actionFactory.getAction(actionArgs); workflow.execute(action); Workflow update = workflowService.update(workflow); return Response.ok(update).build(); } } Web service security config: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:oauth="http://www.springframework.org/schema/security/oauth2" xmlns:sec="http://www.springframework.org/schema/security" xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.…
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
type: Question
score: 9
has title: Spring security oauth2: get username in REST webservice
upvote count: 9
tagged with: jersey
accepted answer: http://stackoverflow.com/a/25653642

http://stackoverflow.com/comment/39943455
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25575168
score: 0
has text: possible duplicate of [How to call power off,reboot dialog from application?](http://stackoverflow.com/questions/4791790/how-to-call-power-off-reboot-dialog-from-application)

http://stackoverflow.com/q/25571007
downvote count: 0
tagged with: swtbot
type: UnansweredQuestion
tagged with: swt
answer count: 1
favorite count: 0
score: 2
has body: I have a paint program written in java with SWT. I am testing with SWTBot. My test case is to draw a picture on the canvas, capture the image of the canvas, and compare to the expected image. The problem is that I can't find any way to move the mouse using the SWTBot. Apparently it only allows me to click the mouse. I want to move to an x,y location mouse down move to another x,y location mouse up Any advice?
has title: SWTBot to drag the mouse
tagged with: java
has answer: http://stackoverflow.com/a/25789389
tagged with: mouseevent
type: Question
upvote count: 2

http://stackoverflow.com/a/25599988
has comment: http://stackoverflow.com/comment/39992458
type: Answer
answers question: http://stackoverflow.com/q/25553622
has body: Spreadsheet key that works with drive: I had a problem that sounds the same as this. I switch to using a key created with google apps script. function getSpreadsheetURLKey() { var spreadsheetId = SpreadsheetApp.getActiveSpreadsheet().getId(); var spreadsheetDriveFile = DriveApp.getFileById(spreadsheetId); var spreadsheetURLKey = spreadsheetDriveFile.getId(); return spreadsheetURLKey; }
score: 0
has comment: http://stackoverflow.com/comment/39990461

http://stackoverflow.com/comment/39983526
has text: If this is a duplicate question could you please to point me to a discussion of this that applies to my situation. I am more than willing to do the research and work to find an answer but I am not finding any threads that apply to my situation.
type: Comment
score: 2
comment on: http://stackoverflow.com/q/25596942
type: QuestionComment

http://stackoverflow.com/q/25641964
has answer: http://stackoverflow.com/a/25648241
has comment: http://stackoverflow.com/comment/40075308
tagged with: servlets
tagged with: spring-mvc
has title: Controller mapping works but jsp giving 404
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40082600
has comment: http://stackoverflow.com/comment/40069468
type: Question
has comment: http://stackoverflow.com/comment/40074655
type: UnansweredQuestion
has body: I have a jersey webapp running and i'm trying to integrate spring mvc in to it. couple of breakpoints later i found that when controllers request mapping is accessible but the jsp is giving a 404. Any help here would be greatly helpful. Here's my dispatcher view resolver <property name="prefix" value="/WEB-INF/jsp/"/> <property name="suffix" value=".jsp"/> The jsp i'm trying to load is login and it is available at path /WEB-INF/jsp/login.jsp My jersey servlet mapping is set to default mapper / Jersey-Web / I have spring dispatcher set to dispatch on following patterns mvcDispatcher /f/login mvcDispatcher /static/* mvcDispatcher *.jsp mvcDispatcher *.js mvcDispatcher *.css mvcDispatcher /WEB-INF/jsp/login.jsp mvcDispatcher /login.jsp When I access /f/login I see that the corresponding controller is being triggered. I'm returning a ModelAndView from my controller like this ModelAndView mav = new ModelAndView( "login" ); return mav; What I'm trying to achieve ? I want all the jsp's and mentioned paths in url pattern to be served through mvcDispatcher and I want any other request to be served through jersey servlet What I have tried ? I tried setting spring-mvc to map to default path /, it was rightly rejected saying that two default servlets are not allowed I tried making jersey servlet pattern to /* and spring-mvc to /, *.jsp but as the jsp spec mentioned the pattern *.jsp was overriden by the /* EDIT To reiterate my default servlet is not dispatcherServlet, my default servlet is jersey servlet
tagged with: jsp
tagged with: spring

http://stackoverflow.com/a/25558161
has body: curiosu is right that XPath 1 doesn't support regexps, and moreover Selenium doesn't support XPath 2. :-( As you pointed out, ends-with() doesn't exist in XPath 1.0. So we can adapt CiaPan's answer as follows: By.xpath("//div[starts-with(@id, 'type-') and substring(@id, string-length(@id)-6) = '-model']"));
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25557538
has comment: http://stackoverflow.com/comment/39935164
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40112801
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25667914
has text: Issuing an `insert` statement via Hibernate is odd. Why don't you do: `User user = new User(/* parameters */); session.save(user);`?
type: Comment

http://stackoverflow.com/comment/39935678
score: 0
has text: This might work based on the description. Have you used this particular parser yourself? The key is that I do not want to use the JDBC drivers but yet arrive to the same column labels. I will give it a try.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25571056

jlink
tags question: http://stackoverflow.com/q/25577295
type: Tag
tag name: jlink

http://stackoverflow.com/comment/39931053
comment on: http://stackoverflow.com/a/25568283
score: 3
has text: There is no `main` method as you didn’t specify in your question what that `main` method should do. I already addressed this in the beginning of my answer. I provided a `static` method accepting a byte array and providing a byte array. Where you get that array from and what you will do with the result, that depends on what you really wanna do. I can’t read your mind.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25589699
has comment: http://stackoverflow.com/comment/39969972
upvote count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/39970166
answers question: http://stackoverflow.com/q/25589524
has body: You can try configure your server.Assuming apache: # mod_expires directives: # enable expires/max-age headers and set default to 0 seconds from last access time ExpiresActive On ExpiresDefault A0 # configure ExpiresByType on your specific types, eg ExpiresByType text/css A0 # mod_headers directives: # send variety of no-cache directives, should cover any quirky clients and gateways Header set Cache-Control "max-age=0, private, no-cache, no-store, must-revalidate, proxy-revalidate, no-transform" Header set Pragma "no-cache" # enclose this in &lt;Files&gt; directive for specific file eg &lt;Files *.js&gt; This is a good article on explaining caching for webpages: http://www.mnot.net/cache_docs/
type: Answer
score: -1

http://stackoverflow.com/q/25570425
has comment: http://stackoverflow.com/comment/39934111
has title: How can I get exact division of decimals for more than 9 digits?
answer count: 6
has comment: http://stackoverflow.com/comment/39934150
has answer: http://stackoverflow.com/a/25570571
has body: When doing this float d = (106108048) / (float)10; The output is 1.0610805E7, but I need exactly 10610804.8. What is correct way to do that? On Hacker Rank, I was solving the following problem: You are given a number N, you need to print the number of positions where digits exactly divides N. Input: 1 106108048 Result: 5 My Solution: import java.io.*; import java.util.*; import java.math.*; public class Solution{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int p = 0; boolean check = true; while(sc.hasNext()){ if(check){ check= false; sc.next(); } Integer number = sc.nextInt(); String snumner = number.toString(); int q = 1; int j = 0; for(int i = 0 ; i&lt; snumner.length();i++ ){ q = q *10; p = q; System.out.println("p:"+p) System.out.println("number:"+number); float d = (number)/(float)p;//problem is here System.out.println("ddd:"+d); String ss = String.valueOf(d); System.out.println("SS:"+ss); int index = ss.indexOf('.'); System.out.println("in"+index); System.out.println("VV"+ss.charAt(index+1)); String newn = " " + ss.charAt(index+1); int sss= Integer.parseInt(newn.trim()); System.out.println("SSS"+sss); if(sss != 0){ if(number%sss ==0){ j++; } } } System.out.println("no:"+j); } } }
score: 2
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25570485
possible better answer: http://stackoverflow.com/a/25570485
has answer: http://stackoverflow.com/a/25570661
has comment: http://stackoverflow.com/comment/39934066
has comment: http://stackoverflow.com/comment/39934104
downvote count: 0
tagged with: floating-accuracy
has answer: http://stackoverflow.com/a/25570503
has comment: http://stackoverflow.com/comment/39935084
favorite count: 0
has comment: http://stackoverflow.com/comment/39934130
type: Question
has comment: http://stackoverflow.com/comment/39934315
has answer: http://stackoverflow.com/a/25570546
accepted answer: http://stackoverflow.com/a/25570546
has answer: http://stackoverflow.com/a/25570494
tagged with: java

http://stackoverflow.com/comment/39987598
comment on: http://stackoverflow.com/a/25590701
score: 0
type: Comment
has text: You are also using a `for`-loop to iterate over an array with fixed size 1. What purpose does that serve in your code? Why are you even using an array of fixed size 1? Why wasn't that replaced with a simple variable? This is quite bad code, even more so with regard to its teaching value.
type: AnswerComment

http://stackoverflow.com/comment/40046044
has text: So, I can use it anyway? Do I just @SuppressWarnings?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25631037
score: 0

groovy
tags question: http://stackoverflow.com/q/25688639
tags question: http://stackoverflow.com/q/25565020
tags question: http://stackoverflow.com/q/25664331
tags question: http://stackoverflow.com/q/25650235
tags question: http://stackoverflow.com/q/25556825
tags question: http://stackoverflow.com/q/25670045
tags question: http://stackoverflow.com/q/25673851
tags question: http://stackoverflow.com/q/25620066
tags question: http://stackoverflow.com/q/25565898
tags question: http://stackoverflow.com/q/25641210
tags question: http://stackoverflow.com/q/25620618
tags question: http://stackoverflow.com/q/25570190
tags question: http://stackoverflow.com/q/25566943
tags question: http://stackoverflow.com/q/25584286
type: Tag
tags question: http://stackoverflow.com/q/25652298
tags question: http://stackoverflow.com/q/25569388
tags question: http://stackoverflow.com/q/25574554
tags question: http://stackoverflow.com/q/25566114
tags question: http://stackoverflow.com/q/25601467
tags question: http://stackoverflow.com/q/25678750
tags question: http://stackoverflow.com/q/25565764
tags question: http://stackoverflow.com/q/25703551
tags question: http://stackoverflow.com/q/25695697
tags question: http://stackoverflow.com/q/25671705
tags question: http://stackoverflow.com/q/25566851
tags question: http://stackoverflow.com/q/25564799
tag name: groovy

http://stackoverflow.com/comment/40129577
comment on: http://stackoverflow.com/a/25633980
score: 0
type: AnswerComment
has text: I don't see how NodeList can only send back name or value based on the XPath expression. Either it needs to return a NodeList when the xPathString = "/project/*" or String when the xPathString = "name(/project/*[3])". One option is for the method signature to be 'public List<String> xpath2NodeList(Document doc, String xPathString) throws XPathExpressionException'. Vary the XPathConstants to NODESET or STRING, depending if the xPathString starts with 'name('. When using NODESET place all the retrieved values in a List. When using String only return the element name in List index 0.
type: Comment

http://stackoverflow.com/comment/40012803
score: 0
comment on: http://stackoverflow.com/a/25613039
type: Comment
has text: @PatrickW.McMahon: no don't use static anything here, and no don't use the singleton pattern. That's gross overkill which has pitfalls of its own that you don't want and don't need.
type: AnswerComment

http://stackoverflow.com/q/25626965
answer count: 1
type: Question
has body: I have a filter which maps just before the Faces Servlet and populate some Attributes in the HttpSession before it proceeds with the request if (_clientUser != null && !_clientUser.isEmpty()) { session.setAttribute(CLIENT_USER_URI_PARAM_NAME, _clientUser); filterChain.doFilter(servletRequest, servletResponse); return; } Within the URI there are some informations for which Task-flow should be addressed faces/adf.task-flow?adf.tfId=task-flow-definition-id&adf.tfDoc=/WEB-INF/task-flow-definition-id.xml After I proceed the request there is a method-call within the bounded task flow which is called before the view (lets call the view MainPage), by making it default activity doStuff The Method itself is within a PageFlowScoped Managed Bean, which is added to the task-flow-definition-id.xml Here is the doStuff Method which is called before the "MainPage"-View public class Controller{ public void doStuff { FacesContext ctx = FacesContext.getCurrentInstance(); Map sessionMap = ctx.getExternalContext().getSessionMap(); String clientUser = (String) sessionMap.get(CLIENT_USER_URI_PARAM_NAME); AppModImpl am = getApplicationModule(); DBTransaction transaction = am.getDBTransaction(); //do more stuff } } public AppModImpl getApplicationModule() { FacesContext fc = FacesContext.getCurrentInstance(); Application app = fc.getApplication(); ExpressionFactory elFactory = app.getExpressionFactory(); ELContext elContext = fc.getELContext(); ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{data.AppModDataControl.dataProvider}", Object.class); AppModImpl am = (AppModImpl) valueExp.getValue(elContext); return am; } Everything works fine till here. But if I try to get the Application Module. There is non. This application normally doesn't have any DataControl, because is just a root Application which holds different components which have been added by ADFLibrarys, but I added an DataControl to the DataBindings.cpx and a iterator to the MainPagePageDef (just to include…
type: UnansweredQuestion
tagged with: oracle-database
tagged with: oracle-adf
has title: Get Application Module during invocation of Bounded Taskflow
tagged with: facescontext
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25627853

http://stackoverflow.com/comment/39924253
type: QuestionComment
has text: have you tried "LATITUDE1":"41", "LATITUDE2":"06962" ?
score: 0
comment on: http://stackoverflow.com/q/25565377
type: Comment

http://stackoverflow.com/comment/39968478
type: AnswerComment
has text: @KickButtowski sorry man i dint notice that things i thought she was just stuck over the while thing
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25588929

http://stackoverflow.com/a/25712662
downvote count: 0
score: 4
has body: The order of modifier keywords does not matter.
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25712650

http://stackoverflow.com/a/25617717
answers question: http://stackoverflow.com/q/25617680
has body: throw use for throwing actual Exception and throws declare at method it might throws Exception. public int findMax(int[] array) throws Exception{ if(array==null) throw new NullPointerException(...); ... }
downvote count: 0
upvote count: 7
score: 7
type: Answer

http://stackoverflow.com/comment/40067704
has text: Actually, see [What is an X/Y Problem?](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). That's why I asked. Don't be so defensive
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25643167
score: 1

http://stackoverflow.com/a/25671124
score: 0
has body: I think you want something like this, (?:\\w+\\.?)?domain\\.com DEMO
answers question: http://stackoverflow.com/q/25671049
type: Answer

http://stackoverflow.com/q/25708825
linked to: http://stackoverflow.com/q/31732169
has comment: http://stackoverflow.com/comment/40186757
has comment: http://stackoverflow.com/comment/40187262
has comment: http://stackoverflow.com/comment/40187116
has comment: http://stackoverflow.com/comment/40186839
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/40187252
downvote count: 0
has comment: http://stackoverflow.com/comment/40186897
tagged with: webview
has comment: http://stackoverflow.com/comment/40186683
has comment: http://stackoverflow.com/comment/40186878
has comment: http://stackoverflow.com/comment/40187031
has comment: http://stackoverflow.com/comment/40186737
has comment: http://stackoverflow.com/comment/40187226
answer count: 1
has comment: http://stackoverflow.com/comment/40186784
favorite count: 0
has comment: http://stackoverflow.com/comment/40186898
type: Question
accepted answer: http://stackoverflow.com/a/25709269
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/40187070
has comment: http://stackoverflow.com/comment/40186888
tagged with: android
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/25709269
has comment: http://stackoverflow.com/comment/40187383
has comment: http://stackoverflow.com/comment/40187350
has comment: http://stackoverflow.com/comment/40186659
has body: I've never encountered this problem before, and my setup is pretty much the same as previous occasions. The error its self is: android.view.InflateException: Binary XML file line #7: Error inflating class android.webkit.WebView I am launching a WebView in an XML file like so: &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;WebView android:id="@+id/facebookWebview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingBottom="0dp" android:paddingLeft="0dp" android:paddingRight="0dp" android:paddingTop="0dp" /&gt; &lt;/RelativeLayout&gt; I am using tab fragments, and the fragment that launches the xml file is like so: public class FragmentTab1 extends Fragment{ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.tabfacebook, container, false); // allocate and instanciate webview WebView webView = (WebView) view.findViewById(R.id.facebookWebview); webView.getSettings().setJavaScriptEnabled(true); // load fb url into it webView.loadUrl("https://www.facebook.com/urlinhere"); webView.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { Log.d("TAG", " ==&gt; " + url); view.loadUrl(url); return true; } }); return view; } } Again, this is as I have always done it. I have commented out the bulk of this code to see if the problem is here, however it is in the XML file not the .java file. Any suggestions? EDIT: Entire stack trace 09-07 09:19:06.870 1150-1150/ourpackage.com.ourpackage E/WebViewFactory﹕ Chromium WebView does not exist 09-07 09:19:06.910 1150-1150/ourpackage.com.ourpackage E/WebViewFactory﹕ Chromium WebView does not exist 09-07 09:19:06.910 1150-1150/ourpackage.com.ourpackage D/AndroidRuntime﹕ Shutting down VM 09-07 09:19:06.910 115…
has comment: http://stackoverflow.com/comment/40186857
has comment: http://stackoverflow.com/comment/40187409
tagged with: http://stackoverflow.com/tag/xml
has title: Error inflating class android.webkit.WebView when loading webview
has comment: http://stackoverflow.com/comment/40186977
has comment: http://stackoverflow.com/comment/40186923

http://stackoverflow.com/a/25607675
type: Answer
accepted answer of: http://stackoverflow.com/q/25604832
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
has body: The fact that you ask that question should make you think about the design. I see no reason why isSameMonth should be a static method if every usage is connected with the preserved instance. Not strictly an answer to the question in the topic, but apparently it helped
answers question: http://stackoverflow.com/q/25604832

http://stackoverflow.com/comment/39923905
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25565080
has text: Thanks for your quick comment! But is it possible to delay the close() operation? I tried Thread.sleep(sometime) and that played the sound but it also stopped the game thread.
type: Comment

firefox
type: Tag
tags question: http://stackoverflow.com/q/25562702
tags question: http://stackoverflow.com/q/25571796
tag name: firefox

http://stackoverflow.com/comment/40092989
comment on: http://stackoverflow.com/q/25656843
score: 0
type: Comment
type: QuestionComment
has text: You can't call a non-static method from a static method. You'll have to change one of them...

http://stackoverflow.com/q/25678084
has answer: http://stackoverflow.com/a/27022408
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40544935
has comment: http://stackoverflow.com/comment/62612405
has comment: http://stackoverflow.com/comment/40143703
tagged with: java
answer count: 1
downvote count: 0
score: 1
has title: Hadoop : Reducer class not called even with Overrides
upvote count: 1
tagged with: mapreduce
tagged with: eclipse
has body: I was trying a mapreduce wordcount code in hadoop, but the reducer class is never called and the program terminates after running the mapper class. import java.io.IOException; import java.util.*; import org.apache.hadoop.fs.Path; import org.apache.hadoop.conf.*; import org.apache.hadoop.io.*; import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; public class WordCount { public static class Map extends Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); @Override public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); StringTokenizer tokenizer = new StringTokenizer(line); while (tokenizer.hasMoreTokens()) { word.set(tokenizer.nextToken()); context.write(word, one); } } } public static class Reduce extends Reducer&lt;Text, IntWritable, Text, IntWritable&gt; { @Override public void reduce(Text key, Iterable&lt;IntWritable&gt; values, Context context) throws IOException, InterruptedException { int sum = 0; for (IntWritable val : values) { sum += val.get(); } context.write(key, new IntWritable(sum)); } } public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "wordcount"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.waitForCompletion(true); } } I have even Overridden the classes as required. ID…
favorite count: 0
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/40134938

http://stackoverflow.com/comment/39973568
score: 5
has text: you are missing an `else` before the second `if`. It should be `else if (ord.equalsIgnoreCase("no"))` Voting to close as a typo.
comment on: http://stackoverflow.com/q/25591716
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40183448
comment on: http://stackoverflow.com/a/25696270
type: Comment
score: 0
type: AnswerComment
has text: ah ha!! work like a charm!! thank again Arvind, you're awesome!!

http://stackoverflow.com/q/25658814
has comment: http://stackoverflow.com/comment/40099837
upvote count: 2
score: 1
tagged with: java
answer count: 1
downvote count: 1
favorite count: 0
type: Question
has title: open website code in java as illusion of web browser
has body: I want to open a website in web browser. I know it is easy but i want to do it in different way ... It is like proxy server .I have made a java code that will get content(source code) of webpage and when browser request localhost on particular port number this code writes source code in browser. But instead of getting web page I am getting source code of webpage in browser and also i want to make a request from java code as a illusion of browser means server should feel that that request is made from a browser and not from java console. import java.net.*; import java.io.*; public class URLConnectionReader { public static void main(String args[]) throws Exception{ URL ul = null; HttpURLConnection ulc = null; ServerSocket server = null; Socket client = null; DataInputStream in = null; DataOutputStream out = null; String c = null; server = new ServerSocket(9898); System.out.println("Server is waiting for clients on port no 9898...."); while(client == null){ client = server.accept(); } System.out.println("Connected....."); out = new DataOutputStream(client.getOutputStream()); ul = new URL("http://www.google.com"); ulc = (HttpURLConnection)ul.openConnection(); in = new DataInputStream(ulc.getInputStream()); while((c = in.readLine())!=null){ out.writeBytes(c); } in.close(); out.close(); client.close(); } }
has answer: http://stackoverflow.com/a/25660165
has comment: http://stackoverflow.com/comment/40106375
tagged with: network-programming
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40100543

http://stackoverflow.com/q/25597794
has answer: http://stackoverflow.com/a/25602751
possible better answer: http://stackoverflow.com/a/25602751
has answer: http://stackoverflow.com/a/29265327
accepted answer: http://stackoverflow.com/a/29265327
type: AnsweredQuestion
has title: GAE JPA 2.0 Txn rollback fast
downvote count: 0
tagged with: transactions
upvote count: 1
score: 1
tagged with: java
has body: One more time I am going nuts over something that never used to happen before. I have changed a few files in my project (In the presentation layer and the entities them selves, and have nothing to do with the data handling layer). Can someone please tell me why would the following code result in this error log? I mean why doesnt it see that I have commited the Txn and closed the EntityManager. I have made the warning in bold because that is the problem, not the NullPointerException. The NullPointerException is a result that the query didnt return anything and teacher stayed null because the transaction rolled back and I have no clue why. String Email = "xyz@xyz.com"; EntityManager em = EMF.get().createEntityManager(); em.getTransaction().begin(); TypedQuery&lt;Teacher&gt; query = em.createQuery("SELECT s FROM Teacher s WHERE s.Email = ?1", Teacher.class); query.setParameter(1, Email); Teacher teacher = (Teacher)query.getSingleResult(); teacher.getTeacherInf(); // Lazy Parameter em.getTransaction().commit(); em.close(); //Lazy Parameter must be fetched before closing. Tried without fetching, same result Here is the Teacher.class @Entity public class Teacher implements Serializable { private static final long serialVersionUID = 5426530769458891752L; @Id private long ID; private String FName; private String LName; private String Email; @OneToOne(cascade = CascadeType.ALL,fetch=FetchType.LAZY) private TeacherInfo teacherInf; // Constructor &amp; getters &amp; setters ...} and finally here is the Error and Warning Sep 01, 2014 5:01:28 AM com.google.apphosting.utils.servlet.TransactionCleanupFilter handleAbandonedTxns WARNING: Request completed without committing or rolling back transaction with id 1. Transaction will be rolled back. Sep 01, 2014 5:01:28 AM com.google.apphosting.utils.jetty.JettyLogger warn WARNING: /Login java.lang.NullPointerException at com.google.appengine.datanucleus.query.QueryEntityPKFetchFieldManager.fetchLongField(QueryEntityPKFetchFieldManager.j…
favorite count: 0
type: Question
answer count: 2
tagged with: google-app-engine
tagged with: jpa

http://stackoverflow.com/comment/40194302
type: AnswerComment
has text: Okay thank you. Although I'm still a little unclear on why the method without the return statement would always return false as opposed to messing up in a different way. Let's say I do: palChecker("aa"). I expect this to happen: palChecker("aa") = palChecker(palChecker("")) = palChecker(true) Am I right that once it reaches the bottom and starts going backwards palChecker is getting a boolean passed to it? Why doesn't it mess up because this is the wrong type. I think I'm imagining how this function executes incorrectly. What is the correct sequence of steps?
comment on: http://stackoverflow.com/a/25712728
score: 0
type: Comment

http://stackoverflow.com/a/25691334
has comment: http://stackoverflow.com/comment/77684936
answers question: http://stackoverflow.com/q/25665421
type: Answer
has body: I left a comment above on how to do this by looking at an open source product that does this in many built-in-functions. Let me put some detail here. If you want to cancel tasks that are beginning or are currently executing, then each task needs to know about every other task. When one task finds what it wants, that task need to inform every other task to stop. You cannot do this with dyadic recursive division (RecursiveTask, etc.) since you create new tasks recursively and the old tasks will never know about the new ones. I’m sure you could pass a reference to a stop-me field to each new task, but it will get very messy and debugging would be “interesting.” You can do this with Java8 CountedCompleter(). The framework was butchered to support this class so things that should be done by the framework needs doing manually, but it can work. Each task needs a volatile boolean and a method to set it to true. Each tasks need an array of references to all the other tasks. Create all the tasks up front, each with an empty array of to-be references to the other tasks. Fill in the array of references to every other task. Now submit each task (see the doc for this class, fork() addPendingCount() etc.) When one tasks finds what it wants, it uses the array of references to the other tasks to set their boolean to true. If there is a race condition with multiple threads, it doesn’t matter since all threads set “true.” You will also need to handle tryComplete(), onCompletion() etc. This class is very muddled. It is used for the Java8 stream processing which is a story in itself. What you cannot do is purge pending tasks from the deques before they begin. You need to wait until the task starts and check the boolean for true. If the execution is lengthy, then you may also want to check the boolean for true periodically. The overhead of a volatile read is not that bad and there really is no other way.
has comment: http://stackoverflow.com/comment/40172291
score: 0
has comment: http://stackoverflow.com/comment/40163086
has comment: http://stackoverflow.com/comment/77683110

http://stackoverflow.com/comment/40166733
type: AnswerComment
comment on: http://stackoverflow.com/a/25697764
score: 0
has text: But why claer is not working ?? That is actually the OP's question.
type: Comment

http://stackoverflow.com/q/25602313
has title: java: how to check methods calling within a project
has answer: http://stackoverflow.com/a/25604147
tagged with: selenium
tagged with: maven
has answer: http://stackoverflow.com/a/25602391
has comment: http://stackoverflow.com/comment/39992867
has comment: http://stackoverflow.com/comment/39992828
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5268998
has answer: http://stackoverflow.com/a/25602400
score: 0
answer count: 3
has body: I have given a small project to understand the flow and functionality. I am a fresher. This project contains 3 packages with each containing 4 to 5 java classes. now I study a method and confused with its calling. Is there any way to know fwhere where in the project, that method is called from. If i try running single single classes , then few methods don't get called so not able to see their exact output.
upvote count: 1
tagged with: java
downvote count: 1
accepted answer: http://stackoverflow.com/a/25602391
tagged with: eclipse
favorite count: 0
tagged with: testng
type: Question
possible better answer: http://stackoverflow.com/a/25602400

http://stackoverflow.com/a/25712440
has comment: http://stackoverflow.com/comment/40196284
upvote count: 19
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40196110
score: 19
answers question: http://stackoverflow.com/q/25712348
has body: 0x12.2P2 is 0x122 / 1610 * 22 0x122 = 29010 divided by 1610 = 18.12510 multiplied by 22 leads to 72.510 More formally (?), for the part before the P, you can use this very classic conversion table: decimal point here ▼ +-----+-----+-----+-----+-+-----+-----+-----+ | 16³ | 16² | 16¹ | 16⁰ | | 16⁻¹| 16⁻²| 16⁻³| +-----------------------------------------+ | | | 1 | 2 |.| 2 | | | +-----+-----+-----+-----+-+-----+-----+-----+ So 0x12.2 is 1⨯16¹+2x16⁰+2⨯16⁻¹ = 18.125
type: Answer
accepted answer of: http://stackoverflow.com/q/25712348
has comment: http://stackoverflow.com/comment/40193735
has comment: http://stackoverflow.com/comment/40193996

http://stackoverflow.com/comment/39940450
type: Comment
comment on: http://stackoverflow.com/q/25571843
score: 0
has text: That sample isn't immediately convertible to a war just by changing the packaging. Did you see the "converting" guides, e.g. https://github.com/spring-guides/gs-convert-jar-to-war-maven?
type: QuestionComment

http://stackoverflow.com/a/25684247
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25683627
has comment: http://stackoverflow.com/comment/40141307
type: Answer
has body: Specify the base scan as follows and remove the annotation from interface and keep only in the implementation class e.g. @Service, @Repository, @Component, etc. &lt;context:component-scan base-package="com.spring.org"/&gt; EDIT: I looked into your code.You have given your component scan as But your SubscriberService.java is in the package com.spring.service. Kindly change the package to com.spring.org.service.

http://stackoverflow.com/comment/40033145
type: QuestionComment
has text: what is wrong with your chart? That is what your question should state :)
comment on: http://stackoverflow.com/q/25624186
score: 0
type: Comment

http://stackoverflow.com/comment/40238362
type: QuestionComment
comment on: http://stackoverflow.com/q/25660193
score: 0
type: Comment
has text: Try reading from both the `stdout` and `stderr` of the process, or merge them.

http://stackoverflow.com/comment/40106244
type: QuestionComment
score: 0
has text: can u explain how to authenticate oAuth 2.0 redirect URl.. i think my problem is creating linkedin application..
comment on: http://stackoverflow.com/q/25664704
type: Comment

http://stackoverflow.com/comment/40081829
type: QuestionComment
comment on: http://stackoverflow.com/q/25650558
score: 1
type: Comment
has text: Please edit your question to include a [complete example](http://stackoverflow.com/help/mcve) that does not use the NetBeans GUI editor.

http://stackoverflow.com/comment/39982512
type: Comment
has text: Looks good, I usually avoid using the `GridBagLayout` just because it complicates things like this very easily, but in this case its entirely necessary over the `BoxLayout`.
type: AnswerComment
comment on: http://stackoverflow.com/a/25595969
score: 0

http://stackoverflow.com/a/25671898
has body: If all you need is the average, you don't need to keep all the numbers you get from user input. Just keep one variable that holds their sum. define the sum variable outside the loop (initialized to 0), and add to it each number you get from user input.
downvote count: 0
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/25671856
type: Answer

http://stackoverflow.com/comment/39988669
has text: Is `name` null or `name.getText()`?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25599990
type: QuestionComment

http://stackoverflow.com/comment/40004722
has text: Can you show your `MessageInspector` implementation?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25608557
type: Comment

http://stackoverflow.com/comment/40134077
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25679996
has text: Thanks a lot, I have edited the post with a runnable example and a screenshot.
type: AnswerComment

http://stackoverflow.com/q/25702667
has comment: http://stackoverflow.com/comment/40178334
has body: This is the error I'm getting: Compilation error: javac Class not found: org.eclipse.jdt.core.JDTCompilerAdapter I'm trying to run a build config with an ant build step and keep getting this error. As far as I know I've set environment variables properly and I assume TeamCity comes with everything required to compile .java files, why can't it find javac.exe? Tell me what details I can provide. The repository can be found here: https://code.google.com/p/ci-research-teamcity-test-project/source/browse
tagged with: ant
tagged with: teamcity
accepted answer: http://stackoverflow.com/a/25776379
has comment: http://stackoverflow.com/comment/40178115
has answer: http://stackoverflow.com/a/25776379
tagged with: buildconfiguration
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40176083
score: 0
has comment: http://stackoverflow.com/comment/40178347
has comment: http://stackoverflow.com/comment/40177620
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/40177837
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40178415
type: Question
has comment: http://stackoverflow.com/comment/40177870
has comment: http://stackoverflow.com/comment/40178387
has title: TeamCity can't find javac, trying to run a build config with an ant build step
has comment: http://stackoverflow.com/comment/40178172
has comment: http://stackoverflow.com/comment/40178191

http://stackoverflow.com/q/25606777
has answer: http://stackoverflow.com/a/25607217
upvote count: 1
tagged with: image
type: AnsweredQuestion
tagged with: bash
has body: I'm writing a GUI application which takes an image from a camera using the gphoto2 package in Raspbian. When I enter the command gphoto2 --capture-image-and-download into the terminal manually, the camera takes an image and saves it to the current folder. However, when I execute the same command via a button in my Java code, the camera takes the image but it is not saved. Redirected output from bash says that the image is saved to the camera (which I could cope with) but the image is neither saved to the camera or to the current directory, in fact, it doesn't appear to be saved at all. Here is the button code: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Runtime com = getRuntime(); try { //Reset USB Device to prevent warnings Process mand = com.exec("../../../usbreset /dev/bus/usb/001/005"); //Capture image Process get = com.exec("gphoto2 --capture-image-and-download"); Send Bash output(s) to text area BufferedReader in1 = new BufferedReader(new InputStreamReader(mand.getInputStream())); BufferedReader in2 = new BufferedReader(new InputStreamReader(get.getInputStream())); String inputLine1; while ((inputLine1 = in1.readLine()) != null) { msgArea.append(inputLine1 + "\n"); } in1.close(); String inputLine2; while ((inputLine2 = in2.readLine()) != null) { msgArea.append(inputLine2 + "\n"); } in2.close(); } catch (IOException ex) { Logger.getLogger(Home.class.getName()).log(Level.SEVERE, null, ex); } } I can't work out if the problem resides in my bash commands or my Java code. I've tried both with and without a card present in the camera, and have also tried with a specified filename for the image, all to no avail. I'm not sure if it's significant but the Pi is being controlled via PuTTY ssh with X11 forwarding on a Debian laptop. Java is written in Netbeans 8. GPhoto2 is version 2.4.14 and the camera is a Canon EOS 1100D, though I suspect this last fact is surplus to requirements. I'd be really grateful if anyone could help - this is an impor…
score: 1
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
type: Question
tagged with: netbeans
tagged with: raspberry-pi
has title: Gphoto2 fails to save image when captured via Java .jar (Raspberry Pi - Raspbian)
accepted answer: http://stackoverflow.com/a/25607217

http://stackoverflow.com/comment/39958587
score: 0
has text: @chrylis The original type is String. the messageId is actually a UUID, which if stored in Mongo in binary encoded format would save me space.
comment on: http://stackoverflow.com/q/25576153
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25562778
tagged with: mysql
has body: I use mysql with Hibernate and Spring HibernateTransactionManager. And my mysql connection will ablwys be in ACTIVE ,but no dead lock. Here is my exception: (The deallock problem and fk problem has been fixed!) java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1084) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4232) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4164) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2838) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2082) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2334) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2262) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2246) Here is my show engine innodb status: ===================================== 140829 13:53:06 INNODB MONITOR OUTPUT ===================================== Per second averages calculated from the last 2 seconds ----------------- BACKGROUND THREAD ----------------- srv_master_thread loops: 4284857 1_second, 4284854 sleeps, 42740 10_second, 27639 background, 27639 flush srv_master_thread log flush and writes: 483491 ---------- SEMAPHORES ---------- OS WAIT ARRAY INFO: reservation count 20783, signal count 101656 Mutex spin waits 884986, rounds 328183, OS waits 297 RW-shared spins 133015, rounds 3335038, OS waits 9873 RW-excl spins 149331, rounds 1801472, OS waits 10558 Spin rounds per wait: 0.37 mutex, 25.07 RW-shared, 12.06 RW-excl ------------------------ LATEST FOREIGN KEY ERROR ------------------------ 140825 16:22:01 Error in foreign key constraint of table lecheng/queqiaocontactmap: there is no index in the table which would contain the columns as the first columns, or the data types in the table do not …
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/39920083
type: UnansweredQuestion
has title: Hibernate transaction always be active
has comment: http://stackoverflow.com/comment/39920444
score: 0
has comment: http://stackoverflow.com/comment/39919619
tagged with: transactions
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/25636626
type: AnsweredQuestion
upvote count: 0
tagged with: web-services
has comment: http://stackoverflow.com/comment/40056273
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/40055784
favorite count: 0
has title: How do I import data from Activie directories through LDAP URL
tagged with: ldap
type: Question
has body: I have got a requirement to connect Active directory systems through LDAP URL. I need to start this development very easiest way and looking to deliver this ASAP. Kindly share your thoughts. I will be using Oracle JDeveloper for this development.
has answer: http://stackoverflow.com/a/25637163
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/25637163

struts2
tags question: http://stackoverflow.com/q/25706731
tags question: http://stackoverflow.com/q/25555907
tags question: http://stackoverflow.com/q/25572714
tags question: http://stackoverflow.com/q/25635385
tags question: http://stackoverflow.com/q/25630913
tags question: http://stackoverflow.com/q/25599741
tags question: http://stackoverflow.com/q/25685048
tags question: http://stackoverflow.com/q/25634150
tags question: http://stackoverflow.com/q/25564633
tags question: http://stackoverflow.com/q/25661611
tags question: http://stackoverflow.com/q/25643451
tags question: http://stackoverflow.com/q/25592717
tags question: http://stackoverflow.com/q/25638917
tags question: http://stackoverflow.com/q/25642712
tags question: http://stackoverflow.com/q/25645082
tags question: http://stackoverflow.com/q/25588359
tags question: http://stackoverflow.com/q/25593893
tags question: http://stackoverflow.com/q/25581842
tags question: http://stackoverflow.com/q/25690010
tags question: http://stackoverflow.com/q/25602590
tags question: http://stackoverflow.com/q/25711040
tags question: http://stackoverflow.com/q/25683126
tags question: http://stackoverflow.com/q/25574501
tags question: http://stackoverflow.com/q/25570391
tags question: http://stackoverflow.com/q/25644283
tags question: http://stackoverflow.com/q/25705860
tags question: http://stackoverflow.com/q/25580207
tags question: http://stackoverflow.com/q/25633121
tag name: struts2
tags question: http://stackoverflow.com/q/25604644
tags question: http://stackoverflow.com/q/25636232
tags question: http://stackoverflow.com/q/25687635
type: Tag
tags question: http://stackoverflow.com/q/25708025
tags question: http://stackoverflow.com/q/25672160
tags question: http://stackoverflow.com/q/25685310
tags question: http://stackoverflow.com/q/25617519
tags question: http://stackoverflow.com/q/25691464
tags question: http://stackoverflow.com/q/25689509
tags question: http://stackoverflow.com/q/25658841
tags question: http://stackoverflow.com/q/25674746
tags question: http://stackoverflow.com/q/25618066

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/25592290

http://stackoverflow.com/comment/40104842
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25663738
has text: can u tell what should i write in my controller for the authentiation..?give me some hints or links which are useful

http://stackoverflow.com/comment/40153222
score: 0
comment on: http://stackoverflow.com/q/25690473
type: Comment
type: QuestionComment
has text: add a mouse listener on the button and implement mouse up method...

http://stackoverflow.com/q/25584117
tagged with: collections
tagged with: copy
linked to: http://stackoverflow.com/q/1106102
score: 0
tagged with: clone
linked to: http://stackoverflow.com/q/2427883
tagged with: java
has comment: http://stackoverflow.com/comment/39959432
duplicate of: http://stackoverflow.com/q/2427883
type: Question
answer count: 0
type: UnansweredQuestion
has title: Difference between copy and clone in context of java
has body: In a java interview, I was asked what is the different between copy and clone function. What I think both the method are used to make a copy of a object. Another problem related with clone: How to make a deep copy of a list and hashmap? For above question, can we directly call list Object#clone method? here copy refer to the function present in collections.
has comment: http://stackoverflow.com/comment/39959439

http://stackoverflow.com/a/25697191
downvote count: 0
has body: You can try google lightweight musicg API It supports the following features: Current features Clap Api - Detect whether the input audio is a clap Whistle Api - Detect whether the input audio is a whistle Read PCM WAVE Headers Read audio data Trim the audio data Save the edited audio file Read amplitude-time domain data Read frequency-time domain data Render audio wave form image (Requires Java 2D &amp; Java Image I/O, Android non-compatible) Render audio spectrogram image (Requires Java 2D &amp; Java Image I/O, Android non-compatible)
accepted answer of: http://stackoverflow.com/q/25697152
score: 3
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/25697152
type: AcceptedAnswer

http://stackoverflow.com/comment/39927474
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25564880
has text: U ARE RIGHT ,i made some configuration, and i have another error,i edit it (see over)
score: 0